1 | <?php |
||
17 | class ClassName extends AbstractRoute |
||
18 | { |
||
19 | /** @var string The class name this route will instantiate */ |
||
20 | public $class = ''; |
||
21 | |||
22 | /** @var array Constructor params for the built instance */ |
||
23 | public $constructorParams = array(); |
||
24 | |||
25 | /** @var object The built class instance */ |
||
26 | protected $instance = null; |
||
27 | |||
28 | /** |
||
29 | * @param string $method The HTTP method (GET, POST, etc) |
||
30 | * @param string $pattern The URI pattern for this route (like /users/*) |
||
31 | * @param string $class The class name |
||
32 | * @param array $params Constructor params for the class |
||
33 | * |
||
34 | * @see Respect\Rest\Routes\ClassName::$class |
||
35 | * @see Respect\Rest\Routes\ClassName::$constructorParams |
||
36 | */ |
||
37 | 10 | public function __construct( |
|
47 | |||
48 | /** |
||
49 | * Creates an instance of the class this route builds |
||
50 | * |
||
51 | * @return object The created instance |
||
52 | */ |
||
53 | 6 | protected function createInstance() |
|
75 | |||
76 | /** |
||
77 | * Gets the reflection for a specific method. For this route, the reflection |
||
78 | * is given for the class method having the same name as the HTTP method. |
||
79 | * |
||
80 | * @param string $method The HTTP method for this implementation |
||
81 | * |
||
82 | * @return ReflectionMethod The returned reflection object |
||
83 | */ |
||
84 | 4 | public function getReflection($method) |
|
92 | |||
93 | /** |
||
94 | * Runs the class method when this route is matched with params |
||
95 | * |
||
96 | * @param string $method The HTTP method for this implementation |
||
97 | * @param array $params An array of params for this request |
||
98 | * |
||
99 | * @see Respect\Rest\Request::$params |
||
100 | * |
||
101 | * @return mixed Whatever the class method returns |
||
102 | */ |
||
103 | 6 | public function runTarget($method, &$params) |
|
114 | } |
||
115 |