Overview

Namespaces

  • Deimos
    • Controller
      • Exceptions
      • Traits
  • PHP

Classes

  • Deimos\Controller\Controller
  • Deimos\Controller\Processor
  • Deimos\Controller\Proxy

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 Processor extends Builder
10: {
11: 
12:     use Request;
13: 
14:     /**
15:      * @var string
16:      */
17:     protected $attribute = 'controller';
18: 
19:     /**
20:      * Runner constructor.
21:      *
22:      * @param Builder $builder
23:      *
24:      * @throws \InvalidArgumentException
25:      */
26:     public function __construct(Builder $builder)
27:     {
28:         if ($builder instanceof self)
29:         {
30:             throw new \InvalidArgumentException('Instanceof SELF');
31:         }
32: 
33:         $this->builder = $builder;
34:     }
35: 
36:     /**
37:      * @return mixed
38:      *
39:      * @throws \InvalidArgumentException
40:      * @throws Exceptions\RequestNotFound
41:      * @throws Exceptions\DisplayNone
42:      * @throws ControllerNotFound
43:      */
44:     public function execute()
45:     {
46:         $name = $this->request()->attribute($this->attribute);
47: 
48:         if ($this->methodExists($name))
49:         {
50:             /**
51:              * @var Controller $instance
52:              */
53:             $instance = $this->instance($name);
54: 
55:             return $instance->execute();
56:         }
57: 
58:         throw new ControllerNotFound('Controller \'' . $name . '\' not found!');
59:     }
60: 
61: }
API documentation generated by ApiGen