@@ -32,128 +32,128 @@ |
||
| 32 | 32 | use Symfony\Component\Routing\Route as SymfonyRoute; |
| 33 | 33 | |
| 34 | 34 | class Route extends SymfonyRoute implements IRoute { |
| 35 | - /** |
|
| 36 | - * Specify the method when this route is to be used |
|
| 37 | - * |
|
| 38 | - * @param string $method HTTP method (uppercase) |
|
| 39 | - * @return \OC\Route\Route |
|
| 40 | - */ |
|
| 41 | - public function method($method) { |
|
| 42 | - $this->setMethods($method); |
|
| 43 | - return $this; |
|
| 44 | - } |
|
| 35 | + /** |
|
| 36 | + * Specify the method when this route is to be used |
|
| 37 | + * |
|
| 38 | + * @param string $method HTTP method (uppercase) |
|
| 39 | + * @return \OC\Route\Route |
|
| 40 | + */ |
|
| 41 | + public function method($method) { |
|
| 42 | + $this->setMethods($method); |
|
| 43 | + return $this; |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | - /** |
|
| 47 | - * Specify POST as the method to use with this route |
|
| 48 | - * @return \OC\Route\Route |
|
| 49 | - */ |
|
| 50 | - public function post() { |
|
| 51 | - $this->method('POST'); |
|
| 52 | - return $this; |
|
| 53 | - } |
|
| 46 | + /** |
|
| 47 | + * Specify POST as the method to use with this route |
|
| 48 | + * @return \OC\Route\Route |
|
| 49 | + */ |
|
| 50 | + public function post() { |
|
| 51 | + $this->method('POST'); |
|
| 52 | + return $this; |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - /** |
|
| 56 | - * Specify GET as the method to use with this route |
|
| 57 | - * @return \OC\Route\Route |
|
| 58 | - */ |
|
| 59 | - public function get() { |
|
| 60 | - $this->method('GET'); |
|
| 61 | - return $this; |
|
| 62 | - } |
|
| 55 | + /** |
|
| 56 | + * Specify GET as the method to use with this route |
|
| 57 | + * @return \OC\Route\Route |
|
| 58 | + */ |
|
| 59 | + public function get() { |
|
| 60 | + $this->method('GET'); |
|
| 61 | + return $this; |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | - /** |
|
| 65 | - * Specify PUT as the method to use with this route |
|
| 66 | - * @return \OC\Route\Route |
|
| 67 | - */ |
|
| 68 | - public function put() { |
|
| 69 | - $this->method('PUT'); |
|
| 70 | - return $this; |
|
| 71 | - } |
|
| 64 | + /** |
|
| 65 | + * Specify PUT as the method to use with this route |
|
| 66 | + * @return \OC\Route\Route |
|
| 67 | + */ |
|
| 68 | + public function put() { |
|
| 69 | + $this->method('PUT'); |
|
| 70 | + return $this; |
|
| 71 | + } |
|
| 72 | 72 | |
| 73 | - /** |
|
| 74 | - * Specify DELETE as the method to use with this route |
|
| 75 | - * @return \OC\Route\Route |
|
| 76 | - */ |
|
| 77 | - public function delete() { |
|
| 78 | - $this->method('DELETE'); |
|
| 79 | - return $this; |
|
| 80 | - } |
|
| 73 | + /** |
|
| 74 | + * Specify DELETE as the method to use with this route |
|
| 75 | + * @return \OC\Route\Route |
|
| 76 | + */ |
|
| 77 | + public function delete() { |
|
| 78 | + $this->method('DELETE'); |
|
| 79 | + return $this; |
|
| 80 | + } |
|
| 81 | 81 | |
| 82 | - /** |
|
| 83 | - * Specify PATCH as the method to use with this route |
|
| 84 | - * @return \OC\Route\Route |
|
| 85 | - */ |
|
| 86 | - public function patch() { |
|
| 87 | - $this->method('PATCH'); |
|
| 88 | - return $this; |
|
| 89 | - } |
|
| 82 | + /** |
|
| 83 | + * Specify PATCH as the method to use with this route |
|
| 84 | + * @return \OC\Route\Route |
|
| 85 | + */ |
|
| 86 | + public function patch() { |
|
| 87 | + $this->method('PATCH'); |
|
| 88 | + return $this; |
|
| 89 | + } |
|
| 90 | 90 | |
| 91 | - /** |
|
| 92 | - * Defaults to use for this route |
|
| 93 | - * |
|
| 94 | - * @param array $defaults The defaults |
|
| 95 | - * @return \OC\Route\Route |
|
| 96 | - */ |
|
| 97 | - public function defaults($defaults) { |
|
| 98 | - $action = $this->getDefault('action'); |
|
| 99 | - $this->setDefaults($defaults); |
|
| 100 | - if (isset($defaults['action'])) { |
|
| 101 | - $action = $defaults['action']; |
|
| 102 | - } |
|
| 103 | - $this->action($action); |
|
| 104 | - return $this; |
|
| 105 | - } |
|
| 91 | + /** |
|
| 92 | + * Defaults to use for this route |
|
| 93 | + * |
|
| 94 | + * @param array $defaults The defaults |
|
| 95 | + * @return \OC\Route\Route |
|
| 96 | + */ |
|
| 97 | + public function defaults($defaults) { |
|
| 98 | + $action = $this->getDefault('action'); |
|
| 99 | + $this->setDefaults($defaults); |
|
| 100 | + if (isset($defaults['action'])) { |
|
| 101 | + $action = $defaults['action']; |
|
| 102 | + } |
|
| 103 | + $this->action($action); |
|
| 104 | + return $this; |
|
| 105 | + } |
|
| 106 | 106 | |
| 107 | - /** |
|
| 108 | - * Requirements for this route |
|
| 109 | - * |
|
| 110 | - * @param array $requirements The requirements |
|
| 111 | - * @return \OC\Route\Route |
|
| 112 | - */ |
|
| 113 | - public function requirements($requirements) { |
|
| 114 | - $method = $this->getMethods(); |
|
| 115 | - $this->setRequirements($requirements); |
|
| 116 | - if (isset($requirements['_method'])) { |
|
| 117 | - $method = $requirements['_method']; |
|
| 118 | - } |
|
| 119 | - if ($method) { |
|
| 120 | - $this->method($method); |
|
| 121 | - } |
|
| 122 | - return $this; |
|
| 123 | - } |
|
| 107 | + /** |
|
| 108 | + * Requirements for this route |
|
| 109 | + * |
|
| 110 | + * @param array $requirements The requirements |
|
| 111 | + * @return \OC\Route\Route |
|
| 112 | + */ |
|
| 113 | + public function requirements($requirements) { |
|
| 114 | + $method = $this->getMethods(); |
|
| 115 | + $this->setRequirements($requirements); |
|
| 116 | + if (isset($requirements['_method'])) { |
|
| 117 | + $method = $requirements['_method']; |
|
| 118 | + } |
|
| 119 | + if ($method) { |
|
| 120 | + $this->method($method); |
|
| 121 | + } |
|
| 122 | + return $this; |
|
| 123 | + } |
|
| 124 | 124 | |
| 125 | - /** |
|
| 126 | - * The action to execute when this route matches |
|
| 127 | - * |
|
| 128 | - * @param string|callable $class the class or a callable |
|
| 129 | - * @param string $function the function to use with the class |
|
| 130 | - * @return \OC\Route\Route |
|
| 131 | - * |
|
| 132 | - * This function is called with $class set to a callable or |
|
| 133 | - * to the class with $function |
|
| 134 | - */ |
|
| 135 | - public function action($class, $function = null) { |
|
| 136 | - $action = array($class, $function); |
|
| 137 | - if (is_null($function)) { |
|
| 138 | - $action = $class; |
|
| 139 | - } |
|
| 140 | - $this->setDefault('action', $action); |
|
| 141 | - return $this; |
|
| 142 | - } |
|
| 125 | + /** |
|
| 126 | + * The action to execute when this route matches |
|
| 127 | + * |
|
| 128 | + * @param string|callable $class the class or a callable |
|
| 129 | + * @param string $function the function to use with the class |
|
| 130 | + * @return \OC\Route\Route |
|
| 131 | + * |
|
| 132 | + * This function is called with $class set to a callable or |
|
| 133 | + * to the class with $function |
|
| 134 | + */ |
|
| 135 | + public function action($class, $function = null) { |
|
| 136 | + $action = array($class, $function); |
|
| 137 | + if (is_null($function)) { |
|
| 138 | + $action = $class; |
|
| 139 | + } |
|
| 140 | + $this->setDefault('action', $action); |
|
| 141 | + return $this; |
|
| 142 | + } |
|
| 143 | 143 | |
| 144 | - /** |
|
| 145 | - * The action to execute when this route matches, includes a file like |
|
| 146 | - * it is called directly |
|
| 147 | - * @param string $file |
|
| 148 | - * @return void |
|
| 149 | - */ |
|
| 150 | - public function actionInclude($file) { |
|
| 151 | - $function = function($param) use ($file) { |
|
| 152 | - unset($param["_route"]); |
|
| 153 | - $_GET=array_merge($_GET, $param); |
|
| 154 | - unset($param); |
|
| 155 | - require_once "$file"; |
|
| 156 | - } ; |
|
| 157 | - $this->action($function); |
|
| 158 | - } |
|
| 144 | + /** |
|
| 145 | + * The action to execute when this route matches, includes a file like |
|
| 146 | + * it is called directly |
|
| 147 | + * @param string $file |
|
| 148 | + * @return void |
|
| 149 | + */ |
|
| 150 | + public function actionInclude($file) { |
|
| 151 | + $function = function($param) use ($file) { |
|
| 152 | + unset($param["_route"]); |
|
| 153 | + $_GET=array_merge($_GET, $param); |
|
| 154 | + unset($param); |
|
| 155 | + require_once "$file"; |
|
| 156 | + } ; |
|
| 157 | + $this->action($function); |
|
| 158 | + } |
|
| 159 | 159 | } |
@@ -150,7 +150,7 @@ |
||
| 150 | 150 | public function actionInclude($file) { |
| 151 | 151 | $function = function($param) use ($file) { |
| 152 | 152 | unset($param["_route"]); |
| 153 | - $_GET=array_merge($_GET, $param); |
|
| 153 | + $_GET = array_merge($_GET, $param); |
|
| 154 | 154 | unset($param); |
| 155 | 155 | require_once "$file"; |
| 156 | 156 | } ; |