@@ -116,7 +116,7 @@ |
||
| 116 | 116 | /** |
| 117 | 117 | * Dispatch the router |
| 118 | 118 | * @param string[] $args The arguments array. |
| 119 | - * @return boolean True if route was correctly dispatched. |
|
| 119 | + * @return null|boolean True if route was correctly dispatched. |
|
| 120 | 120 | */ |
| 121 | 121 | public static function run($args=null){ |
| 122 | 122 | if($args) { |
@@ -57,6 +57,9 @@ discard block |
||
| 57 | 57 | fwrite($this->socket, $payload); |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | + /** |
|
| 61 | + * @param integer $code |
|
| 62 | + */ |
|
| 60 | 63 | protected function expectCode($code){ |
| 61 | 64 | |
| 62 | 65 | $this->lastMessage = ''; |
@@ -98,6 +101,9 @@ discard block |
||
| 98 | 101 | $this->attachments[] = $file; |
| 99 | 102 | } |
| 100 | 103 | |
| 104 | + /** |
|
| 105 | + * @param string $body |
|
| 106 | + */ |
|
| 101 | 107 | protected function SMTPmail($to,$subject,$body,$heads=''){ |
| 102 | 108 | $this->connect(); |
| 103 | 109 | $this->expectCode(220); |
@@ -57,6 +57,9 @@ discard block |
||
| 57 | 57 | fwrite($this->socket, $payload); |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | + /** |
|
| 61 | + * @param integer $code |
|
| 62 | + */ |
|
| 60 | 63 | protected function expectCode($code){ |
| 61 | 64 | |
| 62 | 65 | $this->lastMessage = ''; |
@@ -98,6 +101,9 @@ discard block |
||
| 98 | 101 | $this->attachments[] = $file; |
| 99 | 102 | } |
| 100 | 103 | |
| 104 | + /** |
|
| 105 | + * @param string $body |
|
| 106 | + */ |
|
| 101 | 107 | protected function SMTPmail($to,$subject,$body,$heads=''){ |
| 102 | 108 | $this->connect(); |
| 103 | 109 | $this->expectCode(220); |
@@ -57,6 +57,9 @@ |
||
| 57 | 57 | return true; |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | + /** |
|
| 61 | + * @param ErrorException $e |
|
| 62 | + */ |
|
| 60 | 63 | public static function traceException($e){ |
| 61 | 64 | switch(self::$mode){ |
| 62 | 65 | case self::HTML : |
@@ -27,6 +27,9 @@ |
||
| 27 | 27 | return $this->exists($path) ? file_get_contents($this->realPath($path)) : false; |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | + /** |
|
| 31 | + * @param string|false $data |
|
| 32 | + */ |
|
| 30 | 33 | public function write($path, $data){ |
| 31 | 34 | $r_path = $this->realPath($path); |
| 32 | 35 | if ( ! is_dir($r_dir = dirname($r_path)) ) @mkdir($r_dir,0775,true); |
@@ -18,6 +18,9 @@ discard block |
||
| 18 | 18 | protected static $headers = []; |
| 19 | 19 | protected static $last_info = null; |
| 20 | 20 | |
| 21 | + /** |
|
| 22 | + * @param string $method |
|
| 23 | + */ |
|
| 21 | 24 | protected static function request($method, $url, $data=[], array $headers=[], $data_as_json=false, $username=null, $password = null){ |
| 22 | 25 | $http_method = strtoupper($method); |
| 23 | 26 | $ch = curl_init($url); |
@@ -97,6 +100,9 @@ discard block |
||
| 97 | 100 | return static::request('get',$url,$data,$headers,false,$username,$password); |
| 98 | 101 | } |
| 99 | 102 | |
| 103 | + /** |
|
| 104 | + * @param string $url |
|
| 105 | + */ |
|
| 100 | 106 | public static function post($url,$data=null,array $headers=[], $username = null, $password = null){ |
| 101 | 107 | return static::request('post',$url,$data,$headers,static::$json_data,$username,$password); |
| 102 | 108 | } |
@@ -118,7 +118,8 @@ |
||
| 118 | 118 | |
| 119 | 119 | /** |
| 120 | 120 | * Load the model from the persistence layer |
| 121 | - * @return mixed The retrieved object |
|
| 121 | + * @param integer $pk |
|
| 122 | + * @return boolean The retrieved object |
|
| 122 | 123 | */ |
| 123 | 124 | public static function load($pk){ |
| 124 | 125 | $table = static::persistenceOptions('table'); |
@@ -34,6 +34,9 @@ discard block |
||
| 34 | 34 | static::$charset = $charset; |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | + /** |
|
| 38 | + * @param string $mime |
|
| 39 | + */ |
|
| 37 | 40 | public static function type($mime){ |
| 38 | 41 | static::header('Content-Type',$mime . (static::$charset ? '; charset='.static::$charset : '')); |
| 39 | 42 | } |
@@ -89,7 +92,7 @@ discard block |
||
| 89 | 92 | |
| 90 | 93 | /** |
| 91 | 94 | * Check if an response output buffering is active. |
| 92 | - * @return boolean |
|
| 95 | + * @return boolean|null |
|
| 93 | 96 | */ |
| 94 | 97 | public static function isBuffering(){ |
| 95 | 98 | return static::$buffer; |
@@ -113,7 +116,6 @@ discard block |
||
| 113 | 116 | |
| 114 | 117 | /** |
| 115 | 118 | * Append a text to the buffer. |
| 116 | - * @param mixed $payload Text to append to the response buffer |
|
| 117 | 119 | */ |
| 118 | 120 | public static function text(){ |
| 119 | 121 | static::type(static::TYPE_TEXT); |
@@ -122,7 +124,6 @@ discard block |
||
| 122 | 124 | |
| 123 | 125 | /** |
| 124 | 126 | * Append an XML string to the buffer. |
| 125 | - * @param mixed $payload Data to append to the response buffer |
|
| 126 | 127 | */ |
| 127 | 128 | public static function xml(){ |
| 128 | 129 | static::type(static::TYPE_XML); |
@@ -131,7 +132,6 @@ discard block |
||
| 131 | 132 | |
| 132 | 133 | /** |
| 133 | 134 | * Append a SVG string to the buffer. |
| 134 | - * @param mixed $payload Data to append to the response buffer |
|
| 135 | 135 | */ |
| 136 | 136 | public static function svg(){ |
| 137 | 137 | static::type(static::TYPE_SVG); |
@@ -140,7 +140,6 @@ discard block |
||
| 140 | 140 | |
| 141 | 141 | /** |
| 142 | 142 | * Append an HTML string to the buffer. |
| 143 | - * @param mixed $payload Data to append to the response buffer |
|
| 144 | 143 | */ |
| 145 | 144 | public static function html(){ |
| 146 | 145 | static::type(static::TYPE_HTML); |
@@ -149,16 +148,21 @@ discard block |
||
| 149 | 148 | |
| 150 | 149 | /** |
| 151 | 150 | * Append a raw string to the buffer. |
| 152 | - * @param mixed $payload Data to append to the response buffer |
|
| 153 | 151 | */ |
| 154 | 152 | public static function add(){ |
| 155 | 153 | static::$payload[] = implode('',func_get_args()); |
| 156 | 154 | } |
| 157 | 155 | |
| 156 | + /** |
|
| 157 | + * @param integer $code |
|
| 158 | + */ |
|
| 158 | 159 | public static function status($code,$message=''){ |
| 159 | 160 | static::header('Status',$message?:$code,$code); |
| 160 | 161 | } |
| 161 | 162 | |
| 163 | + /** |
|
| 164 | + * @param string $name |
|
| 165 | + */ |
|
| 162 | 166 | public static function header($name,$value,$code=null){ |
| 163 | 167 | static::$headers[$name] = [$value,$code]; |
| 164 | 168 | } |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | /** |
| 170 | 170 | * Start a route definition, default to HTTP GET. |
| 171 | 171 | * @param string $URLPattern The URL to match against, you can define named segments to be extracted and passed to the callback. |
| 172 | - * @param $callback The callback to be invoked (with variables extracted from the route if present) when the route match the request URI. |
|
| 172 | + * @param Closure $callback The callback to be invoked (with variables extracted from the route if present) when the route match the request URI. |
|
| 173 | 173 | * @return Route |
| 174 | 174 | */ |
| 175 | 175 | public static function on($URLPattern, $callback = null){ |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | /** |
| 180 | 180 | * Start a route definition, for any HTTP Method (using * wildcard). |
| 181 | 181 | * @param string $URLPattern The URL to match against, you can define named segments to be extracted and passed to the callback. |
| 182 | - * @param $callback The callback to be invoked (with variables extracted from the route if present) when the route match the request URI. |
|
| 182 | + * @param Closure $callback The callback to be invoked (with variables extracted from the route if present) when the route match the request URI. |
|
| 183 | 183 | * @return Route |
| 184 | 184 | */ |
| 185 | 185 | public static function any($URLPattern, $callback = null){ |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | |
| 199 | 199 | /** |
| 200 | 200 | * Bind a middleware callback to invoked before the route definition |
| 201 | - * @param callable $before The callback to be invoked ($this is binded to the route object). |
|
| 201 | + * @param Closure $callback |
|
| 202 | 202 | * @return Route |
| 203 | 203 | */ |
| 204 | 204 | public function & before($callback){ |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | |
| 209 | 209 | /** |
| 210 | 210 | * Bind a middleware callback to invoked after the route definition |
| 211 | - * @param $callback The callback to be invoked ($this is binded to the route object). |
|
| 211 | + * @param Closure $callback The callback to be invoked ($this is binded to the route object). |
|
| 212 | 212 | * @return Route |
| 213 | 213 | */ |
| 214 | 214 | public function & after($callback){ |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | * @param string $pattern The URL schema with the named parameters |
| 319 | 319 | * @param string $URL The URL to process, if omitted the current request URI will be used. |
| 320 | 320 | * @param boolean $cut If true don't limit the matching to the whole URL (used for group pattern extraction) |
| 321 | - * @return array The extracted variables |
|
| 321 | + * @return callable The extracted variables |
|
| 322 | 322 | */ |
| 323 | 323 | protected static function extractVariablesFromURL($pattern,$URL=null,$cut=false){ |
| 324 | 324 | $URL = $URL ?: Request::URI(); |
@@ -413,6 +413,7 @@ discard block |
||
| 413 | 413 | /** |
| 414 | 414 | * Start the route dispatcher and resolve the URL request. |
| 415 | 415 | * @param string $URL The URL to match onto. |
| 416 | + * @param string $method |
|
| 416 | 417 | * @return boolean true if a route callback was executed. |
| 417 | 418 | */ |
| 418 | 419 | public static function dispatch($URL=null,$method=null){ |