コード例 #1
0
ファイル: FactoryTest.php プロジェクト: slince/routing
 function testCreate()
 {
     $this->assertInstanceOf('Slince\\Routing\\Matcher', Factory::createMatcher());
     $this->assertInstanceOf('Slince\\Routing\\Generator', Factory::createGenerator(RequestContext::create()));
     $this->assertInstanceOf('Slince\\Routing\\RouteCollection', Factory::createRoutes());
 }
コード例 #2
0
ファイル: Router.php プロジェクト: slince/routing
 /**
  * 获取generator
  * @return Generator|GeneratorInterface
  */
 function getGenerator()
 {
     if (is_null($this->generator)) {
         if (is_null($this->context)) {
             throw new InvalidArgumentException('Miss Argument "Context" for generator');
         }
         $this->generator = Factory::createGenerator($this->context);
     }
     return $this->generator;
 }