Ejemplo n.º 1
0
 public function present()
 {
     $defaultClassPath = Looker::getPresenterClassPath();
     $presenterClassSuffix = Looker::getPresenterClassSuffix();
     if (!isset($this->presenter)) {
         $classPath = explode('\\', get_class($this));
         $className = $classPath[count($classPath) - 1];
         $root = substr(get_class(), 0, strpos(get_class(), '\\'));
         $this->presenter = $root . '\\' . $defaultClassPath . '\\' . $className . $presenterClassSuffix;
     }
     if (!class_exists($this->presenter)) {
         throw new InvalidPresenterException($className);
     }
     if (!isset($this->presenterInstance)) {
         $this->presenterInstance = new $this->presenter($this);
     }
     return $this->presenterInstance;
 }
Ejemplo n.º 2
0
 /** @test */
 public function it_can_be_initialised()
 {
     \Looker\Looker::init('Tests\\Presenters', 'Presenter');
     $this->assertEquals('Tests\\Presenters', \Looker\Looker::getPresenterClassPath());
     $this->assertEquals('Presenter', \Looker\Looker::getPresenterClassSuffix());
 }