@@ -14,7 +14,6 @@ |
||
14 | 14 | */ |
15 | 15 | namespace Venus\core; |
16 | 16 | |
17 | -use stdClass; |
|
18 | 17 | use \Venus\lib\Debug as Debug; |
19 | 18 | |
20 | 19 | /** |
@@ -50,8 +50,7 @@ discard block |
||
50 | 50 | */ |
51 | 51 | public static function get(string $sName, string $sPortal = null, bool $bNoDoRedirect = false) |
52 | 52 | { |
53 | - if ($bNoDoRedirect === true) { $sNameCache = $sName.'_true'; } |
|
54 | - else { $sNameCache = $sName; } |
|
53 | + if ($bNoDoRedirect === true) { $sNameCache = $sName.'_true'; } else { $sNameCache = $sName; } |
|
55 | 54 | |
56 | 55 | if ($sPortal === null || !is_string($sPortal)) { |
57 | 56 | |
@@ -59,8 +58,7 @@ discard block |
||
59 | 58 | |
60 | 59 | $sPortal = PORTAL; |
61 | 60 | $aDirectories = array($sPortal); |
62 | - } |
|
63 | - else { |
|
61 | + } else { |
|
64 | 62 | |
65 | 63 | $sPortal = ''; |
66 | 64 | $aDirectories = scandir(str_replace('core', 'src', __DIR__)); |
@@ -187,8 +185,7 @@ discard block |
||
187 | 185 | { |
188 | 186 | $oConfig = self::get($sName, null, true); |
189 | 187 | |
190 | - if (isset($oConfig->redirect)) { return $oConfig->redirect; } |
|
191 | - else { return PORTAL; } |
|
188 | + if (isset($oConfig->redirect)) { return $oConfig->redirect; } else { return PORTAL; } |
|
192 | 189 | } |
193 | 190 | |
194 | 191 | /** |
@@ -207,8 +204,7 @@ discard block |
||
207 | 204 | |
208 | 205 | list($oConfFiles, $base) = self::_recursiveGet($oConfFiles, $base); |
209 | 206 | return $base; |
210 | - } |
|
211 | - else { |
|
207 | + } else { |
|
212 | 208 | |
213 | 209 | echo "The Json ".$sFileToMerge." has an error! Please verify!\n"; |
214 | 210 | $oDebug = Debug::getInstance(); |
@@ -232,12 +228,10 @@ discard block |
||
232 | 228 | if (is_object($oConfFiles) && is_object($base) && !isset($base->$sKey)) { |
233 | 229 | |
234 | 230 | $base->$sKey = $oConfFiles->$sKey; |
235 | - } |
|
236 | - else if (is_array($oConfFiles) && is_array($base) && !isset($base[$sKey])) { |
|
231 | + } else if (is_array($oConfFiles) && is_array($base) && !isset($base[$sKey])) { |
|
237 | 232 | |
238 | 233 | $base[$sKey] = $oConfFiles[$sKey]; |
239 | - } |
|
240 | - else if (!isset($base->$sKey) && is_array($mOne)) { |
|
234 | + } else if (!isset($base->$sKey) && is_array($mOne)) { |
|
241 | 235 | |
242 | 236 | $base->$sKey = new \StdClass; |
243 | 237 | list($oConfFiles, $base) = self::_recursiveGet($mOne, $base->$sKey); |
@@ -4,7 +4,6 @@ |
||
4 | 4 | |
5 | 5 | use \Venus\lib\Bash as Bash; |
6 | 6 | use \Venus\src\Batch\common\Controller as Controller; |
7 | -use PHPUnit_Util_Fileloader; |
|
8 | 7 | |
9 | 8 | class Phpunit extends Controller |
10 | 9 | { |
@@ -361,8 +361,7 @@ |
||
361 | 361 | 'fb_exchange_token' => $this->getAccessToken(), |
362 | 362 | ) |
363 | 363 | ); |
364 | - } |
|
365 | - catch (FacebookApiException $e) { |
|
364 | + } catch (FacebookApiException $e) { |
|
366 | 365 | // most likely that user very recently revoked authorization. |
367 | 366 | // In any event, we don't have an access token, so say so. |
368 | 367 | return false; |
@@ -56,12 +56,10 @@ |
||
56 | 56 | if ($content) { |
57 | 57 | |
58 | 58 | $this->assertTrue(true); |
59 | - } |
|
60 | - else { |
|
59 | + } else { |
|
61 | 60 | $this->assertTrue(false); |
62 | 61 | } |
63 | - } |
|
64 | - catch(\Exception $e) { |
|
62 | + } catch(\Exception $e) { |
|
65 | 63 | $this->assertTrue(false); |
66 | 64 | } |
67 | 65 |
@@ -113,8 +113,7 @@ |
||
113 | 113 | */ |
114 | 114 | public function unbind() : bool |
115 | 115 | { |
116 | - if ($this->_bConnected) { return $this->_bConnected = ldap_unbind($this->_rConnect); } |
|
117 | - else { return true; } |
|
116 | + if ($this->_bConnected) { return $this->_bConnected = ldap_unbind($this->_rConnect); } else { return true; } |
|
118 | 117 | } |
119 | 118 | |
120 | 119 | /** |
@@ -57,8 +57,7 @@ discard block |
||
57 | 57 | if ($bKeepDimension === false) { |
58 | 58 | |
59 | 59 | imagecopyresampled($rNewImage, $rActualImage, 0, 0, 0, 0, $iWidth, $iHeight, $aSize[0], $aSize[1]); |
60 | - } |
|
61 | - else { |
|
60 | + } else { |
|
62 | 61 | |
63 | 62 | if ($aSize[0] > $aSize[1]) { |
64 | 63 | |
@@ -68,8 +67,7 @@ discard block |
||
68 | 67 | $iHeight = round($iWidth * $fCoef); |
69 | 68 | $iDestY = round(($iWidth - $iHeight) / 2); |
70 | 69 | $iDestX = 0; |
71 | - } |
|
72 | - else { |
|
70 | + } else { |
|
73 | 71 | |
74 | 72 | $rWhite = imagecolorallocate($rNewImage, 255, 255, 255); |
75 | 73 | imagefilledrectangle($rNewImage, 0, 0, $iWidth, $iHeight, $rWhite); |
@@ -102,8 +102,7 @@ discard block |
||
102 | 102 | if ($this->_oFacebook->getUser()) { |
103 | 103 | |
104 | 104 | return '<a href="'.$this->_oFacebook->getLogoutUrl().'">'.$sLabelName.'</a>'; |
105 | - } |
|
106 | - else { |
|
105 | + } else { |
|
107 | 106 | |
108 | 107 | return '<a href="'.$this->_oFacebook->getLoginUrl( |
109 | 108 | array( |
@@ -173,8 +172,7 @@ discard block |
||
173 | 172 | try { |
174 | 173 | |
175 | 174 | return $this->_oFacebook->api('/'.$sUser.'/'.$sName); |
176 | - } |
|
177 | - catch(Exception $e) { |
|
175 | + } catch(Exception $e) { |
|
178 | 176 | |
179 | 177 | throw new Exception(__FILE__.':'.__METHOD__.' : You can\'t ask: '.'/'.$sUser.'/'.$sName.' !'); |
180 | 178 | } |
@@ -201,8 +199,7 @@ discard block |
||
201 | 199 | ); |
202 | 200 | |
203 | 201 | return $this->_oFacebook->api($aParam); |
204 | - } |
|
205 | - catch(Exception $e) { |
|
202 | + } catch(Exception $e) { |
|
206 | 203 | |
207 | 204 | throw new Exception(__FILE__.':'.__METHOD__.' : You can\'t ask: '.$sFql.' !'); |
208 | 205 | } |
@@ -234,8 +231,7 @@ discard block |
||
234 | 231 | 'description'=> $sDescription |
235 | 232 | ) |
236 | 233 | ); |
237 | - } |
|
238 | - catch(Exception $e) { |
|
234 | + } catch(Exception $e) { |
|
239 | 235 | |
240 | 236 | throw new Exception(__FILE__.':'.__METHOD__.' : You can\'t ask: '.'/'.$sUser.'/feed'.' !'); |
241 | 237 | } |
@@ -265,8 +261,7 @@ discard block |
||
265 | 261 | |
266 | 262 | echo '<pre>'; |
267 | 263 | print_r($accounts); /* on affiche les informations retournées */ |
268 | - } |
|
269 | - catch (\Exception $e) { |
|
264 | + } catch (\Exception $e) { |
|
270 | 265 | |
271 | 266 | print_r($e); |
272 | 267 | $user = null; |
@@ -289,8 +284,7 @@ discard block |
||
289 | 284 | 'description'=> $sDescription |
290 | 285 | ) |
291 | 286 | ); |
292 | - } |
|
293 | - catch(Exception $e) { |
|
287 | + } catch(Exception $e) { |
|
294 | 288 | |
295 | 289 | var_dump($e); |
296 | 290 | throw new Exception(__FILE__.':'.__METHOD__.' : You can\'t ask: '.'/'.$sPageId.'/feed'.' !'); |
@@ -60,11 +60,7 @@ discard block |
||
60 | 60 | */ |
61 | 61 | public static function setCacheType(string $sCacheName) |
62 | 62 | { |
63 | - if ($sCacheName === 'file') { self::$_sTypeOfCache = 'file'; } |
|
64 | - else if ($sCacheName === 'memcache') { self::$_sTypeOfCache = 'memcache'; } |
|
65 | - else if ($sCacheName === 'apc') { self::$_sTypeOfCache = 'apc'; } |
|
66 | - else if ($sCacheName === 'redis') { self::$_sTypeOfCache = 'redis'; } |
|
67 | - else { self::$_sTypeOfCache = 'mock'; } |
|
63 | + if ($sCacheName === 'file') { self::$_sTypeOfCache = 'file'; } else if ($sCacheName === 'memcache') { self::$_sTypeOfCache = 'memcache'; } else if ($sCacheName === 'apc') { self::$_sTypeOfCache = 'apc'; } else if ($sCacheName === 'redis') { self::$_sTypeOfCache = 'redis'; } else { self::$_sTypeOfCache = 'mock'; } |
|
68 | 64 | } |
69 | 65 | |
70 | 66 | /** |
@@ -132,31 +128,26 @@ discard block |
||
132 | 128 | if (!isset(self::$_aCache['file'])) { self::$_aCache['file'] = new CacheFile; } |
133 | 129 | |
134 | 130 | return self::$_aCache['file']; |
135 | - } |
|
136 | - else if (self::$_sTypeOfCache === 'memcache') { |
|
131 | + } else if (self::$_sTypeOfCache === 'memcache') { |
|
137 | 132 | |
138 | 133 | if (!isset(self::$_aCache['memcache'])) { |
139 | 134 | |
140 | 135 | $oDbConf = Config::get('Memcache')->configuration; |
141 | 136 | |
142 | - if (isset($oDbConf->port)) { $sPort = $oDbConf->port; } |
|
143 | - else { $sPort = null; } |
|
137 | + if (isset($oDbConf->port)) { $sPort = $oDbConf->port; } else { $sPort = null; } |
|
144 | 138 | |
145 | - if (isset($oDbConf->timeout)) { $iTimeout = $oDbConf->timeout; } |
|
146 | - else { $iTimeout = null; } |
|
139 | + if (isset($oDbConf->timeout)) { $iTimeout = $oDbConf->timeout; } else { $iTimeout = null; } |
|
147 | 140 | |
148 | 141 | self::$_aCache['memcache'] = new CacheMemcache($oDbConf->host, $sPort, $iTimeout); |
149 | 142 | } |
150 | 143 | |
151 | 144 | return self::$_aCache['memcache']; |
152 | - } |
|
153 | - else if (self::$_sTypeOfCache === 'apc') { |
|
145 | + } else if (self::$_sTypeOfCache === 'apc') { |
|
154 | 146 | |
155 | 147 | if (!isset(self::$_aCache['apc'])) { self::$_aCache['apc'] = new Apc; } |
156 | 148 | |
157 | 149 | return self::$_aCache['apc']; |
158 | - } |
|
159 | - else if (self::$_sTypeOfCache === 'redis') { |
|
150 | + } else if (self::$_sTypeOfCache === 'redis') { |
|
160 | 151 | |
161 | 152 | if (!isset(self::$_aCache['redis'])) { |
162 | 153 | |
@@ -165,8 +156,7 @@ discard block |
||
165 | 156 | } |
166 | 157 | |
167 | 158 | return self::$_aCache['redis']; |
168 | - } |
|
169 | - else if (self::$_sTypeOfCache === 'mock') { |
|
159 | + } else if (self::$_sTypeOfCache === 'mock') { |
|
170 | 160 | |
171 | 161 | if (!isset(self::$_aCache['mock'])) { self::$_aCache['mock'] = new Mock; } |
172 | 162 |
@@ -254,8 +254,7 @@ discard block |
||
254 | 254 | */ |
255 | 255 | public static function setKindOfReportLog(string $sKindOfReportLog) |
256 | 256 | { |
257 | - if ($sKindOfReportLog === 'screen' || $sKindOfReportLog === 'all') { self::$_sKindOfReportLog = $sKindOfReportLog; } |
|
258 | - else { self::$_sKindOfReportLog = 'error_log'; } |
|
257 | + if ($sKindOfReportLog === 'screen' || $sKindOfReportLog === 'all') { self::$_sKindOfReportLog = $sKindOfReportLog; } else { self::$_sKindOfReportLog = 'error_log'; } |
|
259 | 258 | } |
260 | 259 | |
261 | 260 | /** |
@@ -278,12 +277,9 @@ discard block |
||
278 | 277 | */ |
279 | 278 | public static function getTranslateErrorCode(int $iCode) : string |
280 | 279 | { |
281 | - if ($iCode === 1 && $iCode === 16 && $iCode === 256 && $iCode === 4096) { return LogLevel::ERROR; } |
|
282 | - else if ($iCode === 2 && $iCode === 32 && $iCode === 128 && $iCode === 512) { return LogLevel::WARNING; } |
|
283 | - else if ($iCode === 4 && $iCode === 64) { return LogLevel::EMERGENCY; } |
|
284 | - else if ($iCode === 8 && $iCode === 1024) { return LogLevel::NOTICE; } |
|
285 | - else if ($iCode === 2048 && $iCode === 8192 && $iCode === 16384) { return LogLevel::INFO; } |
|
286 | - else return LogLevel::DEBUG; |
|
280 | + if ($iCode === 1 && $iCode === 16 && $iCode === 256 && $iCode === 4096) { return LogLevel::ERROR; } else if ($iCode === 2 && $iCode === 32 && $iCode === 128 && $iCode === 512) { return LogLevel::WARNING; } else if ($iCode === 4 && $iCode === 64) { return LogLevel::EMERGENCY; } else if ($iCode === 8 && $iCode === 1024) { return LogLevel::NOTICE; } else if ($iCode === 2048 && $iCode === 8192 && $iCode === 16384) { return LogLevel::INFO; } else { |
|
281 | + return LogLevel::DEBUG; |
|
282 | + } |
|
287 | 283 | } |
288 | 284 | |
289 | 285 | /** |
@@ -408,8 +404,7 @@ discard block |
||
408 | 404 | if (defined('BASH_CALLED')) { |
409 | 405 | |
410 | 406 | error_log(Bash::setColor('############### '.BASH_CALLED.' ###############', 'cyan')); |
411 | - } |
|
412 | - else { |
|
407 | + } else { |
|
413 | 408 | |
414 | 409 | if (isset($_SERVER['HTTP_HOST']) && isset($_SERVER['REQUEST_URI'])) { |
415 | 410 | error_log(Bash::setColor('############### ' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . ' ###############', 'cyan')); |