コード例 #1
0
ファイル: Application.php プロジェクト: minond/fabrico
 /**
  * I hate php. need non-static for closure binding
  * load an initializer file
  * @param string $name
  * @param array $args, default: array
  */
 public function initialize($name, array $args = [])
 {
     $word = new Word();
     $init = false;
     $project_init = sprintf('%s\\Initializer\\%s', $this->conf->get('app:namespace'), $word->classicalCase($name));
     $standard_init = sprintf('Fabrico\\Initializer\\StdInitializers\\%s', $word->classicalCase($name));
     if (!in_array($name, $this->initialized)) {
         $this->initialized[] = $name;
         if (class_exists($project_init)) {
             $init = $project_init;
         } elseif (class_exists($standard_init)) {
             $init = $standard_init;
         }
         if ($init) {
             $initializer = new $init();
             if ($initializer instanceof JitInitializer) {
                 $initializer->setConfiguration($this->conf);
                 $initializer->setProperties($args);
                 return $initializer->initialize();
             } else {
                 throw new RuntimeException(sprintf(''));
             }
         }
     }
 }
コード例 #2
0
ファイル: WordTest.php プロジェクト: minond/utilitatis
 /**
  * @dataProvider dataProviderStrings
  */
 public function testConvertingToClassicalCase($str)
 {
     $this->assertEquals('PropertyName', $this->word->classicalCase($str));
 }