/**
  * @param Container $container
  */
 private function setupPHPFileRepository(Container $container)
 {
     $this->addMany($container, ['pfr.serializer' => function () {
         return new PHPSerializer();
     }, 'pfr.database_path' => function (Container $container) {
         return new \SplFileInfo($container[ConfigurationProvider::CONFIG_KEY_DB_PATH]);
     }, 'pfr.properties_path' => function (Container $container) {
         return new \SplFileInfo($container[ConfigurationProvider::CONFIG_KEY_PROPS_PATH]);
     }, 'pfr.characters_directory' => function (Container $container) {
         return PHPRangeFileDirectory::fromPath($container['pfr.database_path']);
     }, 'pfr.properties_directory' => function (Container $container) {
         return PHPPropertyFileDirectory::fromPath($container['pfr.properties_path']);
     }, 'pft.property_aggregators.block' => function () {
         return new AggregatorRelay(new BlockKeyGenerator());
     }, 'pft.property_aggregators.general_category' => function () {
         return new AggregatorRelay(new GeneralCategoryKeyGenerator());
     }, 'pft.property_aggregators.script' => function () {
         return new AggregatorRelay(new ScriptKeyGenerator());
     }, 'pfr.property_aggregators' => function (Container $container) {
         $aggregators = new PropertyAggregators();
         $aggregators->registerAggregatorRelay(Property::ofType(Property::BLOCK), $container['pft.property_aggregators.block']);
         $aggregators->registerAggregatorRelay(Property::ofType(Property::GENERAL_CATEGORY), $container['pft.property_aggregators.general_category']);
         $aggregators->registerAggregatorRelay(Property::ofType(Property::SCRIPT), $container['pft.property_aggregators.script']);
         return $aggregators;
     }, 'repository.php' => function (Container $container) {
         return new FileRepository($container['pfr.characters_directory'], $container['pfr.properties_directory'], $container['pfr.property_aggregators'], $container['pfr.serializer']);
     }]);
 }
Ejemplo n.º 2
0
 public function let(RangeFileDirectory $charactersDirectory, PropertyFileDirectory $propertiesDirectory, PropertyAggregators $aggregators, Serializer $serializer)
 {
     $aggregators->getIterator()->willReturn(new \ArrayIterator());
     $aggregators->addCharacters(Argument::any())->willReturn(null);
     $this->serializer = $serializer;
     $this->beConstructedWith($charactersDirectory, $propertiesDirectory, $aggregators, $serializer);
 }
Ejemplo n.º 3
0
 /**
  * @param CodepointAssigned[] $characters
  */
 private function addCharactersToAggregators(array $characters)
 {
     $this->aggregators->addCharacters($characters);
 }