Overview

Namespaces

  • Deimos
    • Controller
      • Exceptions
      • Traits
  • PHP

Classes

  • Deimos\Controller\Controller
  • Deimos\Controller\Proxy
  • Deimos\Controller\Runner

Interfaces

  • Throwable

Traits

  • Deimos\Controller\Traits\Request

Exceptions

  • Deimos\Controller\Exceptions\ControllerNotFound
  • Deimos\Controller\Exceptions\DisplayNone
  • Deimos\Controller\Exceptions\RequestNotFound
  • Exception
  • InvalidArgumentException
  • LogicException
  • Overview
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Todo
 1: <?php
 2: 
 3: namespace Deimos\Controller;
 4: 
 5: use Deimos\Builder\Builder;
 6: use Deimos\Controller\Exceptions\ControllerNotFound;
 7: use Deimos\Controller\Traits\Request;
 8: 
 9: abstract class Runner extends Builder
10: {
11: 
12:     use Request;
13: 
14:     /**
15:      * Runner constructor.
16:      *
17:      * @param Builder $builder
18:      *
19:      * @throws \InvalidArgumentException
20:      */
21:     public function __construct(Builder $builder)
22:     {
23:         if ($builder instanceof self)
24:         {
25:             throw new \InvalidArgumentException('Instanceof SELF');
26:         }
27: 
28:         $this->builder = $builder;
29:     }
30: 
31:     /**
32:      * @return mixed
33:      *
34:      * @throws \InvalidArgumentException
35:      * @throws Exceptions\RequestNotFound
36:      * @throws Exceptions\DisplayNone
37:      * @throws ControllerNotFound
38:      */
39:     public function execute()
40:     {
41:         $name = $this->request()->attribute('controller');
42: 
43:         if ($this->methodExists($name))
44:         {
45:             /**
46:              * @var Controller $instance
47:              */
48:             $instance = $this->instance($name);
49: 
50:             return $instance->execute();
51:         }
52: 
53:         throw new ControllerNotFound($name);
54:     }
55: 
56: }
API documentation generated by ApiGen