/**
  * @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']);
     }]);
 }
Exemple #2
0
 /**
  * @return Repository
  */
 private static function createFileRepository()
 {
     $dbPathInfo = new \SplFileInfo(sprintf('%s/../../resources/generated/ucd', __DIR__));
     $charactersDirectory = PHPRangeFileDirectory::fromPath($dbPathInfo);
     $propsPathInfo = new \SplFileInfo(sprintf('%s/../../resources/generated/props', __DIR__));
     $propertiesDirectory = FileRepository\PropertyFile\PHPPropertyFileDirectory::fromPath($propsPathInfo);
     $aggregators = new FileRepository\PropertyAggregators();
     $serializer = new PHPSerializer();
     return new FileRepository($charactersDirectory, $propertiesDirectory, $aggregators, $serializer);
 }