@@ -227,12 +227,12 @@ |
||
| 227 | 227 | try { |
| 228 | 228 | |
| 229 | 229 | $this->_oFacebook->api('/'.$sUser.'/feed', 'post', array( |
| 230 | - 'message' => $sMessage, |
|
| 231 | - 'link' => $sLink, |
|
| 232 | - 'picture' => $sImg, |
|
| 233 | - 'name' => $sName, |
|
| 234 | - 'description'=> $sDescription |
|
| 235 | - ) |
|
| 230 | + 'message' => $sMessage, |
|
| 231 | + 'link' => $sLink, |
|
| 232 | + 'picture' => $sImg, |
|
| 233 | + 'name' => $sName, |
|
| 234 | + 'description'=> $sDescription |
|
| 235 | + ) |
|
| 236 | 236 | ); |
| 237 | 237 | } |
| 238 | 238 | catch(Exception $e) { |
@@ -137,15 +137,15 @@ discard block |
||
| 137 | 137 | |
| 138 | 138 | if (!isset(self::$_aCache['memcache'])) { |
| 139 | 139 | |
| 140 | - $oDbConf = Config::get('Memcache')->configuration; |
|
| 140 | + $oDbConf = Config::get('Memcache')->configuration; |
|
| 141 | 141 | |
| 142 | - if (isset($oDbConf->port)) { $sPort = $oDbConf->port; } |
|
| 143 | - else { $sPort = null; } |
|
| 142 | + if (isset($oDbConf->port)) { $sPort = $oDbConf->port; } |
|
| 143 | + else { $sPort = null; } |
|
| 144 | 144 | |
| 145 | - if (isset($oDbConf->timeout)) { $iTimeout = $oDbConf->timeout; } |
|
| 146 | - else { $iTimeout = null; } |
|
| 145 | + if (isset($oDbConf->timeout)) { $iTimeout = $oDbConf->timeout; } |
|
| 146 | + else { $iTimeout = null; } |
|
| 147 | 147 | |
| 148 | - self::$_aCache['memcache'] = new CacheMemcache($oDbConf->host, $sPort, $iTimeout); |
|
| 148 | + self::$_aCache['memcache'] = new CacheMemcache($oDbConf->host, $sPort, $iTimeout); |
|
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | return self::$_aCache['memcache']; |
@@ -160,8 +160,8 @@ discard block |
||
| 160 | 160 | |
| 161 | 161 | if (!isset(self::$_aCache['redis'])) { |
| 162 | 162 | |
| 163 | - $oDbConf = Config::get('Redis')->configuration; |
|
| 164 | - self::$_aCache['memcache'] = new Redis($oDbConf); |
|
| 163 | + $oDbConf = Config::get('Redis')->configuration; |
|
| 164 | + self::$_aCache['memcache'] = new Redis($oDbConf); |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | return self::$_aCache['redis']; |
@@ -40,28 +40,28 @@ discard block |
||
| 40 | 40 | */ |
| 41 | 41 | public function javascripts() : array { |
| 42 | 42 | |
| 43 | - $sDefaultPath = 'http://'.$_SERVER['HTTP_HOST'].'/getJs?'; |
|
| 44 | - $aJavascript = func_get_args(); |
|
| 45 | - $aReturns = array(); |
|
| 43 | + $sDefaultPath = 'http://'.$_SERVER['HTTP_HOST'].'/getJs?'; |
|
| 44 | + $aJavascript = func_get_args(); |
|
| 45 | + $aReturns = array(); |
|
| 46 | 46 | |
| 47 | - foreach($aJavascript as $aJsCombination) { |
|
| 47 | + foreach($aJavascript as $aJsCombination) { |
|
| 48 | 48 | |
| 49 | - $sJsPath = $sDefaultPath; |
|
| 49 | + $sJsPath = $sDefaultPath; |
|
| 50 | 50 | |
| 51 | - foreach ($aJsCombination as $sJsToAdd) { |
|
| 51 | + foreach ($aJsCombination as $sJsToAdd) { |
|
| 52 | 52 | |
| 53 | - $sJsPath = $sJsToAdd.'&'; |
|
| 54 | - } |
|
| 53 | + $sJsPath = $sJsToAdd.'&'; |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | - if (defined('ASSET_VERSION') && ASSET_VERSION) { |
|
| 56 | + if (defined('ASSET_VERSION') && ASSET_VERSION) { |
|
| 57 | 57 | |
| 58 | - $sJsPath = ASSET_VERSION; |
|
| 59 | - } |
|
| 58 | + $sJsPath = ASSET_VERSION; |
|
| 59 | + } |
|
| 60 | 60 | |
| 61 | - $aReturns[] = $sJsPath; |
|
| 62 | - } |
|
| 61 | + $aReturns[] = $sJsPath; |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | - return $aReturns; |
|
| 64 | + return $aReturns; |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | /** |
@@ -75,27 +75,27 @@ discard block |
||
| 75 | 75 | */ |
| 76 | 76 | public function stylesheets() : array { |
| 77 | 77 | |
| 78 | - $sDefaultPath = 'http://'.$_SERVER['HTTP_HOST'].'/getCss?'; |
|
| 79 | - $aCss = func_get_args(); |
|
| 80 | - $aReturns = array(); |
|
| 78 | + $sDefaultPath = 'http://'.$_SERVER['HTTP_HOST'].'/getCss?'; |
|
| 79 | + $aCss = func_get_args(); |
|
| 80 | + $aReturns = array(); |
|
| 81 | 81 | |
| 82 | - foreach($aCss as $aCssCombination) { |
|
| 82 | + foreach($aCss as $aCssCombination) { |
|
| 83 | 83 | |
| 84 | - $sCssPath = $sDefaultPath; |
|
| 84 | + $sCssPath = $sDefaultPath; |
|
| 85 | 85 | |
| 86 | - foreach ($aCssCombination as $sCssToAdd) { |
|
| 86 | + foreach ($aCssCombination as $sCssToAdd) { |
|
| 87 | 87 | |
| 88 | - $sCssPath = $sCssToAdd.'&'; |
|
| 89 | - } |
|
| 88 | + $sCssPath = $sCssToAdd.'&'; |
|
| 89 | + } |
|
| 90 | 90 | |
| 91 | - if (defined('ASSET_VERSION') && ASSET_VERSION) { |
|
| 91 | + if (defined('ASSET_VERSION') && ASSET_VERSION) { |
|
| 92 | 92 | |
| 93 | - $sJsPath = ASSET_VERSION; |
|
| 94 | - } |
|
| 93 | + $sJsPath = ASSET_VERSION; |
|
| 94 | + } |
|
| 95 | 95 | |
| 96 | - $aReturns[] = $sCssPath; |
|
| 97 | - } |
|
| 96 | + $aReturns[] = $sCssPath; |
|
| 97 | + } |
|
| 98 | 98 | |
| 99 | - return $aReturns; |
|
| 99 | + return $aReturns; |
|
| 100 | 100 | } |
| 101 | 101 | } |
@@ -35,13 +35,13 @@ discard block |
||
| 35 | 35 | class Debug extends AbstractLogger |
| 36 | 36 | { |
| 37 | 37 | /** |
| 38 | - * variable to activate or not the debug |
|
| 39 | - * @var boolean |
|
| 40 | - */ |
|
| 38 | + * variable to activate or not the debug |
|
| 39 | + * @var boolean |
|
| 40 | + */ |
|
| 41 | 41 | private static $_bActivateDebug = false; |
| 42 | 42 | |
| 43 | 43 | /** |
| 44 | - * variable to activate or not the error |
|
| 44 | + * variable to activate or not the error |
|
| 45 | 45 | * @var boolean |
| 46 | 46 | */ |
| 47 | 47 | private static $_bActivateError = false; |
@@ -76,37 +76,37 @@ discard block |
||
| 76 | 76 | */ |
| 77 | 77 | private static $_oInstance; |
| 78 | 78 | |
| 79 | - /** |
|
| 80 | - * Send back the isntance or create it |
|
| 81 | - * |
|
| 82 | - * @access public |
|
| 83 | - * @return \Venus\lib\Debug |
|
| 84 | - */ |
|
| 85 | - public static function getInstance() : Debug |
|
| 86 | - { |
|
| 87 | - if (!(self::$_oInstance instanceof self)) { self::$_oInstance = new self(); } |
|
| 79 | + /** |
|
| 80 | + * Send back the isntance or create it |
|
| 81 | + * |
|
| 82 | + * @access public |
|
| 83 | + * @return \Venus\lib\Debug |
|
| 84 | + */ |
|
| 85 | + public static function getInstance() : Debug |
|
| 86 | + { |
|
| 87 | + if (!(self::$_oInstance instanceof self)) { self::$_oInstance = new self(); } |
|
| 88 | 88 | |
| 89 | - return self::$_oInstance; |
|
| 90 | - } |
|
| 89 | + return self::$_oInstance; |
|
| 90 | + } |
|
| 91 | 91 | |
| 92 | 92 | /** |
| 93 | 93 | * activate debug |
| 94 | 94 | * |
| 95 | 95 | * @access public |
| 96 | 96 | * @return void |
| 97 | - */ |
|
| 97 | + */ |
|
| 98 | 98 | public static function activateDebug() |
| 99 | 99 | { |
| 100 | 100 | if (self::$_bFirstActivation === true) { |
| 101 | 101 | |
| 102 | 102 | self::_setFileNameInErrorFile(); |
| 103 | 103 | self::$_bFirstActivation = false; |
| 104 | - } |
|
| 104 | + } |
|
| 105 | 105 | |
| 106 | - self::_initLogFile(); |
|
| 107 | - self::$_bActivateDebug = true; |
|
| 108 | - self::activateError(E_ALL); |
|
| 109 | - self::activateException(E_ALL); |
|
| 106 | + self::_initLogFile(); |
|
| 107 | + self::$_bActivateDebug = true; |
|
| 108 | + self::activateError(E_ALL); |
|
| 109 | + self::activateException(E_ALL); |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | /** |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | */ |
| 118 | 118 | public static function deactivateDebug() |
| 119 | 119 | { |
| 120 | - self::$_bActivateDebug = false; |
|
| 120 | + self::$_bActivateDebug = false; |
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | /** |
@@ -125,54 +125,54 @@ discard block |
||
| 125 | 125 | * |
| 126 | 126 | * @access public |
| 127 | 127 | * @return boolean |
| 128 | - */ |
|
| 128 | + */ |
|
| 129 | 129 | public static function isDebug() : bool |
| 130 | 130 | { |
| 131 | 131 | return self::$_bActivateDebug; |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | /** |
| 135 | - * activate error reporting |
|
| 136 | - * |
|
| 137 | - * @access public |
|
| 138 | - * @param int $iLevel level of error |
|
| 139 | - * @return void |
|
| 140 | - */ |
|
| 135 | + * activate error reporting |
|
| 136 | + * |
|
| 137 | + * @access public |
|
| 138 | + * @param int $iLevel level of error |
|
| 139 | + * @return void |
|
| 140 | + */ |
|
| 141 | 141 | public static function activateError($iLevel) |
| 142 | 142 | { |
| 143 | - if (self::$_bFirstActivation === true) { |
|
| 143 | + if (self::$_bFirstActivation === true) { |
|
| 144 | 144 | |
| 145 | - self::_setFileNameInErrorFile(); |
|
| 146 | - self::$_bFirstActivation = false; |
|
| 147 | - } |
|
| 145 | + self::_setFileNameInErrorFile(); |
|
| 146 | + self::$_bFirstActivation = false; |
|
| 147 | + } |
|
| 148 | 148 | |
| 149 | - self::_initLogFile(); |
|
| 150 | - self::$_bActivateError = true; |
|
| 149 | + self::_initLogFile(); |
|
| 150 | + self::$_bActivateError = true; |
|
| 151 | 151 | |
| 152 | - error_reporting($iLevel); |
|
| 152 | + error_reporting($iLevel); |
|
| 153 | 153 | |
| 154 | - set_error_handler(function ($iErrNo, $sErrStr, $sErrFile, $iErrLine) |
|
| 155 | - { |
|
| 154 | + set_error_handler(function ($iErrNo, $sErrStr, $sErrFile, $iErrLine) |
|
| 155 | + { |
|
| 156 | 156 | $aContext = array('file' => $sErrFile, 'line' => $iErrLine); |
| 157 | 157 | |
| 158 | 158 | $sType = self::getTranslateErrorCode($iErrNo); |
| 159 | 159 | |
| 160 | - self::getInstance()->$sType($sErrStr, $aContext); |
|
| 160 | + self::getInstance()->$sType($sErrStr, $aContext); |
|
| 161 | 161 | |
| 162 | - return true; |
|
| 162 | + return true; |
|
| 163 | 163 | }, $iLevel); |
| 164 | 164 | |
| 165 | - register_shutdown_function(function() |
|
| 166 | - { |
|
| 165 | + register_shutdown_function(function() |
|
| 166 | + { |
|
| 167 | 167 | if (null !== ($aLastError = error_get_last())) { |
| 168 | 168 | |
| 169 | - $aContext = array('file' => $aLastError['file'], 'line' => $aLastError['line']); |
|
| 169 | + $aContext = array('file' => $aLastError['file'], 'line' => $aLastError['line']); |
|
| 170 | 170 | |
| 171 | - $sType = self::getTranslateErrorCode($aLastError['type']); |
|
| 171 | + $sType = self::getTranslateErrorCode($aLastError['type']); |
|
| 172 | 172 | |
| 173 | - self::getInstance()->$sType($aLastError['message'], $aContext); |
|
| 174 | - } |
|
| 175 | - }); |
|
| 173 | + self::getInstance()->$sType($aLastError['message'], $aContext); |
|
| 174 | + } |
|
| 175 | + }); |
|
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | /** |
@@ -180,10 +180,10 @@ discard block |
||
| 180 | 180 | * |
| 181 | 181 | * @access public |
| 182 | 182 | * @return void |
| 183 | - */ |
|
| 183 | + */ |
|
| 184 | 184 | public static function deactivateError() |
| 185 | 185 | { |
| 186 | - self::$_bActivateError = false; |
|
| 186 | + self::$_bActivateError = false; |
|
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | /** |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | */ |
| 195 | 195 | public static function isError() : bool |
| 196 | 196 | { |
| 197 | - return self::$_bActivateError; |
|
| 197 | + return self::$_bActivateError; |
|
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | */ |
| 296 | 296 | public function emergency($message, array $context = array()) |
| 297 | 297 | { |
| 298 | - $this->log(LogLevel::EMERGENCY, $message, $context); |
|
| 298 | + $this->log(LogLevel::EMERGENCY, $message, $context); |
|
| 299 | 299 | } |
| 300 | 300 | |
| 301 | 301 | /** |
@@ -307,10 +307,10 @@ discard block |
||
| 307 | 307 | * @param string $message |
| 308 | 308 | * @param array $context |
| 309 | 309 | * @return null |
| 310 | - */ |
|
| 310 | + */ |
|
| 311 | 311 | public function alert($message, array $context = array()) |
| 312 | 312 | { |
| 313 | - $this->log(LogLevel::ALERT, $message, $context); |
|
| 313 | + $this->log(LogLevel::ALERT, $message, $context); |
|
| 314 | 314 | } |
| 315 | 315 | |
| 316 | 316 | /** |
@@ -321,10 +321,10 @@ discard block |
||
| 321 | 321 | * @param string $message |
| 322 | 322 | * @param array $context |
| 323 | 323 | * @return null |
| 324 | - */ |
|
| 324 | + */ |
|
| 325 | 325 | public function critical($message, array $context = array()) |
| 326 | 326 | { |
| 327 | - $this->log(LogLevel::CRITICAL, $message, $context); |
|
| 327 | + $this->log(LogLevel::CRITICAL, $message, $context); |
|
| 328 | 328 | } |
| 329 | 329 | |
| 330 | 330 | /** |
@@ -334,10 +334,10 @@ discard block |
||
| 334 | 334 | * @param string $message |
| 335 | 335 | * @param array $context |
| 336 | 336 | * @return null |
| 337 | - */ |
|
| 337 | + */ |
|
| 338 | 338 | public function error($message, array $context = array()) |
| 339 | 339 | { |
| 340 | - $this->log(LogLevel::ERROR, $message, $context); |
|
| 340 | + $this->log(LogLevel::ERROR, $message, $context); |
|
| 341 | 341 | } |
| 342 | 342 | |
| 343 | 343 | /** |
@@ -349,10 +349,10 @@ discard block |
||
| 349 | 349 | * @param string $message |
| 350 | 350 | * @param array $context |
| 351 | 351 | * @return null |
| 352 | - */ |
|
| 352 | + */ |
|
| 353 | 353 | public function warning($message, array $context = array()) |
| 354 | 354 | { |
| 355 | - $this->log(LogLevel::WARNING, $message, $context); |
|
| 355 | + $this->log(LogLevel::WARNING, $message, $context); |
|
| 356 | 356 | } |
| 357 | 357 | |
| 358 | 358 | /** |
@@ -361,10 +361,10 @@ discard block |
||
| 361 | 361 | * @param string $message |
| 362 | 362 | * @param array $context |
| 363 | 363 | * @return null |
| 364 | - */ |
|
| 364 | + */ |
|
| 365 | 365 | public function notice($message, array $context = array()) |
| 366 | 366 | { |
| 367 | - $this->log(LogLevel::NOTICE, $message, $context); |
|
| 367 | + $this->log(LogLevel::NOTICE, $message, $context); |
|
| 368 | 368 | } |
| 369 | 369 | |
| 370 | 370 | /** |
@@ -375,10 +375,10 @@ discard block |
||
| 375 | 375 | * @param string $message |
| 376 | 376 | * @param array $context |
| 377 | 377 | * @return null |
| 378 | - */ |
|
| 378 | + */ |
|
| 379 | 379 | public function info($message, array $context = array()) |
| 380 | 380 | { |
| 381 | - $this->log(LogLevel::INFO, $message, $context); |
|
| 381 | + $this->log(LogLevel::INFO, $message, $context); |
|
| 382 | 382 | } |
| 383 | 383 | |
| 384 | 384 | /** |
@@ -387,10 +387,10 @@ discard block |
||
| 387 | 387 | * @param string $message |
| 388 | 388 | * @param array $context |
| 389 | 389 | * @return null |
| 390 | - */ |
|
| 390 | + */ |
|
| 391 | 391 | public function debug($message, array $context = array()) |
| 392 | 392 | { |
| 393 | - $this->log(LogLevel::DEBUG, $message, $context); |
|
| 393 | + $this->log(LogLevel::DEBUG, $message, $context); |
|
| 394 | 394 | } |
| 395 | 395 | |
| 396 | 396 | /** |
@@ -398,40 +398,40 @@ discard block |
||
| 398 | 398 | * |
| 399 | 399 | * @access public |
| 400 | 400 | * @return void |
| 401 | - */ |
|
| 401 | + */ |
|
| 402 | 402 | private static function _setFileNameInErrorFile() |
| 403 | 403 | { |
| 404 | - /** |
|
| 405 | - * We see if it's a cli call or a web call |
|
| 406 | - */ |
|
| 404 | + /** |
|
| 405 | + * We see if it's a cli call or a web call |
|
| 406 | + */ |
|
| 407 | 407 | |
| 408 | - if (defined('BASH_CALLED')) { |
|
| 408 | + if (defined('BASH_CALLED')) { |
|
| 409 | 409 | |
| 410 | - error_log(Bash::setColor('############### '.BASH_CALLED.' ###############', 'cyan')); |
|
| 411 | - } |
|
| 412 | - else { |
|
| 410 | + error_log(Bash::setColor('############### '.BASH_CALLED.' ###############', 'cyan')); |
|
| 411 | + } |
|
| 412 | + else { |
|
| 413 | 413 | |
| 414 | - if (isset($_SERVER['HTTP_HOST']) && isset($_SERVER['REQUEST_URI'])) { |
|
| 415 | - error_log(Bash::setColor('############### ' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . ' ###############', 'cyan')); |
|
| 416 | - } |
|
| 417 | - } |
|
| 414 | + if (isset($_SERVER['HTTP_HOST']) && isset($_SERVER['REQUEST_URI'])) { |
|
| 415 | + error_log(Bash::setColor('############### ' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . ' ###############', 'cyan')); |
|
| 416 | + } |
|
| 417 | + } |
|
| 418 | 418 | } |
| 419 | 419 | |
| 420 | 420 | /** |
| 421 | - * init the log file (error_log) |
|
| 421 | + * init the log file (error_log) |
|
| 422 | 422 | * |
| 423 | - * @access private |
|
| 423 | + * @access private |
|
| 424 | 424 | * @return void |
| 425 | - */ |
|
| 425 | + */ |
|
| 426 | 426 | private static function _initLogFile() |
| 427 | 427 | { |
| 428 | - self::$_sFileLog = str_replace(DIRECTORY_SEPARATOR.'bundles'.DIRECTORY_SEPARATOR.'lib', '', __DIR__).DIRECTORY_SEPARATOR. |
|
| 429 | - "data".DIRECTORY_SEPARATOR."log".DIRECTORY_SEPARATOR."php-error.log"; |
|
| 428 | + self::$_sFileLog = str_replace(DIRECTORY_SEPARATOR.'bundles'.DIRECTORY_SEPARATOR.'lib', '', __DIR__).DIRECTORY_SEPARATOR. |
|
| 429 | + "data".DIRECTORY_SEPARATOR."log".DIRECTORY_SEPARATOR."php-error.log"; |
|
| 430 | 430 | |
| 431 | - ini_set("log_errors", 1); |
|
| 432 | - ini_set("error_log", self::$_sFileLog); |
|
| 431 | + ini_set("log_errors", 1); |
|
| 432 | + ini_set("error_log", self::$_sFileLog); |
|
| 433 | 433 | |
| 434 | - if (file_exists(self::$_sFileLog) === false) { file_put_contents(self::$_sFileLog, ''); } |
|
| 434 | + if (file_exists(self::$_sFileLog) === false) { file_put_contents(self::$_sFileLog, ''); } |
|
| 435 | 435 | } |
| 436 | 436 | |
| 437 | 437 | /** |
@@ -197,12 +197,12 @@ discard block |
||
| 197 | 197 | |
| 198 | 198 | /** |
| 199 | 199 | * Response constructor. |
| 200 | - */ |
|
| 200 | + */ |
|
| 201 | 201 | public function __construct() |
| 202 | 202 | { |
| 203 | 203 | /** |
| 204 | 204 | * @return \Venus\lib\Request |
| 205 | - */ |
|
| 205 | + */ |
|
| 206 | 206 | $this->headers = function() { $request = new Request(); return $request->headers; }; |
| 207 | 207 | } |
| 208 | 208 | |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | |
| 235 | 235 | /** |
| 236 | 236 | * @return string |
| 237 | - */ |
|
| 237 | + */ |
|
| 238 | 238 | public function getContent() : string |
| 239 | 239 | { |
| 240 | 240 | return $this->content; |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | /** |
| 244 | 244 | * @param string $content |
| 245 | 245 | * @return Response |
| 246 | - */ |
|
| 246 | + */ |
|
| 247 | 247 | public function setContent(string $content) : Response |
| 248 | 248 | { |
| 249 | 249 | $this->content = $content; |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | |
| 253 | 253 | /** |
| 254 | 254 | * @return int |
| 255 | - */ |
|
| 255 | + */ |
|
| 256 | 256 | public function getStatusCode() : int |
| 257 | 257 | { |
| 258 | 258 | return $this->statusCode; |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | /** |
| 262 | 262 | * @param int $statusCode |
| 263 | 263 | * @return Response |
| 264 | - */ |
|
| 264 | + */ |
|
| 265 | 265 | public function setStatusCode(int $statusCode) : Response |
| 266 | 266 | { |
| 267 | 267 | $this->statusCode = $statusCode; |
@@ -47,11 +47,11 @@ discard block |
||
| 47 | 47 | */ |
| 48 | 48 | public function __construct() |
| 49 | 49 | { |
| 50 | - $this->cookies = function() { return new Cookies(); }; |
|
| 51 | - $this->files = function() { return new Files(); }; |
|
| 52 | - $this->headers = function() { return new Headers(); }; |
|
| 53 | - $this->query = function() { return new Query(); }; |
|
| 54 | - $this->request = function() { return new RequestPost(); }; |
|
| 50 | + $this->cookies = function() { return new Cookies(); }; |
|
| 51 | + $this->files = function() { return new Files(); }; |
|
| 52 | + $this->headers = function() { return new Headers(); }; |
|
| 53 | + $this->query = function() { return new Query(); }; |
|
| 54 | + $this->request = function() { return new RequestPost(); }; |
|
| 55 | 55 | $this->server = function() { return new Server(); }; |
| 56 | 56 | } |
| 57 | 57 | |
@@ -120,13 +120,13 @@ discard block |
||
| 120 | 120 | * |
| 121 | 121 | * @access public |
| 122 | 122 | * @return bool |
| 123 | - * @deprecated don't use this method because they return a false result |
|
| 124 | - * delete in the version 5 |
|
| 125 | - * @throws \Exception |
|
| 123 | + * @deprecated don't use this method because they return a false result |
|
| 124 | + * delete in the version 5 |
|
| 125 | + * @throws \Exception |
|
| 126 | 126 | */ |
| 127 | 127 | public static function getPreferredLanguage() |
| 128 | 128 | { |
| 129 | - throw new \Exception("Use getLanguages() method now!"); |
|
| 129 | + throw new \Exception("Use getLanguages() method now!"); |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | /** |
@@ -171,8 +171,8 @@ discard block |
||
| 171 | 171 | * @access public |
| 172 | 172 | * @param string $name |
| 173 | 173 | * @return mixed |
| 174 | - * @deprecated please use $this->request->get() |
|
| 175 | - * delete in the version 5 |
|
| 174 | + * @deprecated please use $this->request->get() |
|
| 175 | + * delete in the version 5 |
|
| 176 | 176 | */ |
| 177 | 177 | public function getPost(string $name) |
| 178 | 178 | { |
@@ -187,22 +187,22 @@ discard block |
||
| 187 | 187 | */ |
| 188 | 188 | public static function getPut() |
| 189 | 189 | { |
| 190 | - $aPut = array(); |
|
| 190 | + $aPut = array(); |
|
| 191 | 191 | |
| 192 | - $rPutResource = fopen("php://input", "r"); |
|
| 192 | + $rPutResource = fopen("php://input", "r"); |
|
| 193 | 193 | |
| 194 | - while ($sData = fread($rPutResource, 1024)) { |
|
| 194 | + while ($sData = fread($rPutResource, 1024)) { |
|
| 195 | 195 | |
| 196 | - $aSeparatePut = explode('&', $sData); |
|
| 196 | + $aSeparatePut = explode('&', $sData); |
|
| 197 | 197 | |
| 198 | - foreach($aSeparatePut as $sOne) { |
|
| 198 | + foreach($aSeparatePut as $sOne) { |
|
| 199 | 199 | |
| 200 | - $aOnePut = explode('=', $sOne); |
|
| 201 | - $aPut[$aOnePut[0]] = $aOnePut[1]; |
|
| 202 | - } |
|
| 203 | - } |
|
| 200 | + $aOnePut = explode('=', $sOne); |
|
| 201 | + $aPut[$aOnePut[0]] = $aOnePut[1]; |
|
| 202 | + } |
|
| 203 | + } |
|
| 204 | 204 | |
| 205 | - return $aPut; |
|
| 205 | + return $aPut; |
|
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | /** |
@@ -221,29 +221,29 @@ discard block |
||
| 221 | 221 | else if ($iCode === 404) { header('HTTP/1.1 404 Not Found'); } |
| 222 | 222 | } |
| 223 | 223 | |
| 224 | - /** |
|
| 225 | - * get http method |
|
| 226 | - * @return string |
|
| 227 | - */ |
|
| 228 | - public function getMethod() : string |
|
| 229 | - { |
|
| 230 | - return $this->server->get('REQUEST_METHOD'); |
|
| 231 | - } |
|
| 232 | - |
|
| 233 | - /** |
|
| 234 | - * return languages accepted by the customer |
|
| 235 | - * @return array |
|
| 236 | - */ |
|
| 237 | - public function getLanguages() : array |
|
| 238 | - { |
|
| 239 | - if (!self::isCliRequest()) { return explode(',', preg_replace('/^([^;]);?.*$/', '$1', $_SERVER['HTTP_ACCEPT_LANGUAGE'])); } |
|
| 240 | - else { return array(); } |
|
| 241 | - } |
|
| 224 | + /** |
|
| 225 | + * get http method |
|
| 226 | + * @return string |
|
| 227 | + */ |
|
| 228 | + public function getMethod() : string |
|
| 229 | + { |
|
| 230 | + return $this->server->get('REQUEST_METHOD'); |
|
| 231 | + } |
|
| 232 | + |
|
| 233 | + /** |
|
| 234 | + * return languages accepted by the customer |
|
| 235 | + * @return array |
|
| 236 | + */ |
|
| 237 | + public function getLanguages() : array |
|
| 238 | + { |
|
| 239 | + if (!self::isCliRequest()) { return explode(',', preg_replace('/^([^;]);?.*$/', '$1', $_SERVER['HTTP_ACCEPT_LANGUAGE'])); } |
|
| 240 | + else { return array(); } |
|
| 241 | + } |
|
| 242 | 242 | |
| 243 | 243 | /** |
| 244 | 244 | * get path info |
| 245 | 245 | * @return string |
| 246 | - */ |
|
| 246 | + */ |
|
| 247 | 247 | public function getPathInfo() : string |
| 248 | 248 | { |
| 249 | 249 | return $this->server->get('REQUEST_URI'); |
@@ -30,11 +30,11 @@ |
||
| 30 | 30 | */ |
| 31 | 31 | class Memory implements CacheInterface |
| 32 | 32 | { |
| 33 | - /** |
|
| 34 | - * A static variable to keep the cache |
|
| 35 | - * @var array |
|
| 36 | - */ |
|
| 37 | - private static $_aMemories = array(); |
|
| 33 | + /** |
|
| 34 | + * A static variable to keep the cache |
|
| 35 | + * @var array |
|
| 36 | + */ |
|
| 37 | + private static $_aMemories = array(); |
|
| 38 | 38 | |
| 39 | 39 | /** |
| 40 | 40 | * set a value |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | */ |
| 42 | 42 | public function get(string $sName, int &$iFlags = null, int $iTimeout = 0) |
| 43 | 43 | { |
| 44 | - return false; |
|
| 44 | + return false; |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | /** |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | */ |
| 80 | 80 | public function delete(string $sName) |
| 81 | 81 | { |
| 82 | - return false; |
|
| 82 | + return false; |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | /** |
@@ -32,25 +32,25 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | class Redis extends RealRedis implements CacheInterface |
| 34 | 34 | { |
| 35 | - /** |
|
| 36 | - * constructor with the connection to Redis |
|
| 37 | - * |
|
| 38 | - * @access public |
|
| 39 | - * @param string $sName name of the session |
|
| 40 | - * @param int $iFlags flags |
|
| 41 | - * @param int $iTimeout expiration of cache |
|
| 42 | - * @return mixed |
|
| 43 | - */ |
|
| 44 | - public function __construct($oConf) |
|
| 45 | - { |
|
| 46 | - if (!$this->connect($oConf->host, $oConf->port)) { |
|
| 35 | + /** |
|
| 36 | + * constructor with the connection to Redis |
|
| 37 | + * |
|
| 38 | + * @access public |
|
| 39 | + * @param string $sName name of the session |
|
| 40 | + * @param int $iFlags flags |
|
| 41 | + * @param int $iTimeout expiration of cache |
|
| 42 | + * @return mixed |
|
| 43 | + */ |
|
| 44 | + public function __construct($oConf) |
|
| 45 | + { |
|
| 46 | + if (!$this->connect($oConf->host, $oConf->port)) { |
|
| 47 | 47 | |
| 48 | - throw new Exception('Redis server unavailable'); |
|
| 49 | - } |
|
| 48 | + throw new Exception('Redis server unavailable'); |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | - // Select the REDIS db index |
|
| 52 | - $this->select($conf->index); |
|
| 53 | - } |
|
| 51 | + // Select the REDIS db index |
|
| 52 | + $this->select($conf->index); |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | 55 | /** |
| 56 | 56 | * get a value |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | */ |
| 64 | 64 | public function get(string $sName, int &$iFlags = null, int $iTimeout = 0) |
| 65 | 65 | { |
| 66 | - return parent::get($sName); |
|
| 66 | + return parent::get($sName); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | /** |