@@ -39,7 +39,6 @@ |
||
39 | 39 | */ |
40 | 40 | public function validate(string $sValue = null) : bool |
41 | 41 | { |
42 | - if (trim($sValue) != '') { return true; } |
|
43 | - else { return false; } |
|
42 | + if (trim($sValue) != '') { return true; } else { return false; } |
|
44 | 43 | } |
45 | 44 | } |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | } |
60 | 60 | else if (isset($this->_aDependencyInjectorContener[md5($sNameOfDi)])) { |
61 | 61 | |
62 | - return $this->_aDependencyInjectorContener[md5($sNameOfDi)]; |
|
62 | + return $this->_aDependencyInjectorContener[md5($sNameOfDi)]; |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | return false; |
@@ -76,8 +76,8 @@ discard block |
||
76 | 76 | */ |
77 | 77 | public function set(string $sNameOfDi, callable $cFunction, bool $bShared = false) : Di |
78 | 78 | { |
79 | - if ($bShared === true) { self::$_aSharedDependencyInjectorContener[md5($sNameOfDi)] = $cFunction; } |
|
80 | - else { $this->_aDependencyInjectorContener[md5($sNameOfDi)] = $cFunction; } |
|
79 | + if ($bShared === true) { self::$_aSharedDependencyInjectorContener[md5($sNameOfDi)] = $cFunction; } |
|
80 | + else { $this->_aDependencyInjectorContener[md5($sNameOfDi)] = $cFunction; } |
|
81 | 81 | return $this; |
82 | 82 | } |
83 | 83 | } |
@@ -56,8 +56,7 @@ discard block |
||
56 | 56 | if (isset(self::$_aSharedDependencyInjectorContener[md5($sNameOfDi)])) { |
57 | 57 | |
58 | 58 | return self::$_aSharedDependencyInjectorContener[md5($sNameOfDi)]; |
59 | - } |
|
60 | - else if (isset($this->_aDependencyInjectorContener[md5($sNameOfDi)])) { |
|
59 | + } else if (isset($this->_aDependencyInjectorContener[md5($sNameOfDi)])) { |
|
61 | 60 | |
62 | 61 | return $this->_aDependencyInjectorContener[md5($sNameOfDi)]; |
63 | 62 | } |
@@ -76,8 +75,7 @@ discard block |
||
76 | 75 | */ |
77 | 76 | public function set(string $sNameOfDi, callable $cFunction, bool $bShared = false) : Di |
78 | 77 | { |
79 | - if ($bShared === true) { self::$_aSharedDependencyInjectorContener[md5($sNameOfDi)] = $cFunction; } |
|
80 | - else { $this->_aDependencyInjectorContener[md5($sNameOfDi)] = $cFunction; } |
|
78 | + if ($bShared === true) { self::$_aSharedDependencyInjectorContener[md5($sNameOfDi)] = $cFunction; } else { $this->_aDependencyInjectorContener[md5($sNameOfDi)] = $cFunction; } |
|
81 | 79 | return $this; |
82 | 80 | } |
83 | 81 | } |
@@ -7,11 +7,11 @@ |
||
7 | 7 | */ |
8 | 8 | interface LoggerAwareInterface |
9 | 9 | { |
10 | - /** |
|
11 | - * Sets a logger instance on the object |
|
12 | - * |
|
13 | - * @param LoggerInterface $logger |
|
14 | - * @return null |
|
15 | - */ |
|
16 | - public function setLogger(LoggerInterface $logger); |
|
10 | + /** |
|
11 | + * Sets a logger instance on the object |
|
12 | + * |
|
13 | + * @param LoggerInterface $logger |
|
14 | + * @return null |
|
15 | + */ |
|
16 | + public function setLogger(LoggerInterface $logger); |
|
17 | 17 | } |
@@ -35,31 +35,31 @@ |
||
35 | 35 | abstract class AbstractLogger implements LoggerInterface |
36 | 36 | { |
37 | 37 | /** |
38 | - * Logs with an arbitrary level. |
|
39 | - * |
|
40 | - * @param mixed $level |
|
41 | - * @param string $message |
|
42 | - * @param array $context |
|
43 | - * @return void |
|
44 | - */ |
|
45 | - public function log($level, $message, array $context = array()) |
|
46 | - { |
|
47 | - if (!isset($context['file'])) { $context['file'] = __FILE__; } |
|
48 | - if (!isset($context['line'])) { $context['line'] = __LINE__; } |
|
49 | - if ($level === null) { $level = LogLevel::INFO; } |
|
38 | + * Logs with an arbitrary level. |
|
39 | + * |
|
40 | + * @param mixed $level |
|
41 | + * @param string $message |
|
42 | + * @param array $context |
|
43 | + * @return void |
|
44 | + */ |
|
45 | + public function log($level, $message, array $context = array()) |
|
46 | + { |
|
47 | + if (!isset($context['file'])) { $context['file'] = __FILE__; } |
|
48 | + if (!isset($context['line'])) { $context['line'] = __LINE__; } |
|
49 | + if ($level === null) { $level = LogLevel::INFO; } |
|
50 | 50 | |
51 | - if (Debug::isDebug() === true) { |
|
51 | + if (Debug::isDebug() === true) { |
|
52 | 52 | |
53 | - if (Debug::getKindOfReportLog() === 'error_log' || Debug::getKindOfReportLog() === 'all') { |
|
53 | + if (Debug::getKindOfReportLog() === 'error_log' || Debug::getKindOfReportLog() === 'all') { |
|
54 | 54 | |
55 | - error_log($context['file'].'> (l.'.$context['line'].') '.$message); |
|
56 | - } |
|
57 | - if (Debug::getKindOfReportLog() === 'screen' || Debug::getKindOfReportLog() === 'all') { |
|
55 | + error_log($context['file'].'> (l.'.$context['line'].') '.$message); |
|
56 | + } |
|
57 | + if (Debug::getKindOfReportLog() === 'screen' || Debug::getKindOfReportLog() === 'all') { |
|
58 | 58 | |
59 | - echo '<table width="100%" style="background:orange;border:solid red 15px;"><tr><td style="color:black;padding:10px;font-size:18px;">'; |
|
60 | - echo $context['file'].'> (l.'.$context['line'].') '.$message.'<br/>'."\n"; |
|
61 | - echo '</td></tr></table>'; |
|
62 | - } |
|
63 | - } |
|
59 | + echo '<table width="100%" style="background:orange;border:solid red 15px;"><tr><td style="color:black;padding:10px;font-size:18px;">'; |
|
60 | + echo $context['file'].'> (l.'.$context['line'].') '.$message.'<br/>'."\n"; |
|
61 | + echo '</td></tr></table>'; |
|
62 | + } |
|
63 | + } |
|
64 | 64 | } |
65 | 65 | } |
@@ -16,7 +16,7 @@ |
||
16 | 16 | namespace Venus\lib\Log; |
17 | 17 | |
18 | 18 | use \Venus\lib\Debug as Debug; |
19 | -use \Venus\lib\Log\LoggerInterface as LoggerInterface ; |
|
19 | +use \Venus\lib\Log\LoggerInterface as LoggerInterface; |
|
20 | 20 | use \Venus\lib\Log\LogLevel as LogLevel; |
21 | 21 | |
22 | 22 | /** |
@@ -30,10 +30,10 @@ discard block |
||
30 | 30 | */ |
31 | 31 | class Less |
32 | 32 | { |
33 | - /** |
|
34 | - * @var string |
|
35 | - */ |
|
36 | - const LESS_WINDOWS = LESS_WINDOWS; |
|
33 | + /** |
|
34 | + * @var string |
|
35 | + */ |
|
36 | + const LESS_WINDOWS = LESS_WINDOWS; |
|
37 | 37 | |
38 | 38 | /** |
39 | 39 | * translate the content |
@@ -44,18 +44,18 @@ discard block |
||
44 | 44 | */ |
45 | 45 | public static function toCss(string $sFile) |
46 | 46 | { |
47 | - if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { |
|
47 | + if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { |
|
48 | 48 | |
49 | - $sCmd = self::LESS_WINDOWS." ".$sFile." --watch"; |
|
50 | - $sContent = shell_exec($sCmd); |
|
51 | - } |
|
52 | - else { |
|
49 | + $sCmd = self::LESS_WINDOWS." ".$sFile." --watch"; |
|
50 | + $sContent = shell_exec($sCmd); |
|
51 | + } |
|
52 | + else { |
|
53 | 53 | |
54 | - $sCmd = "lessc ".$sFile." --no-color 2>&1"; |
|
55 | - $sContent = shell_exec($sCmd); |
|
56 | - } |
|
54 | + $sCmd = "lessc ".$sFile." --no-color 2>&1"; |
|
55 | + $sContent = shell_exec($sCmd); |
|
56 | + } |
|
57 | 57 | |
58 | - header("content-type:text/css"); |
|
59 | - echo $sContent; |
|
58 | + header("content-type:text/css"); |
|
59 | + echo $sContent; |
|
60 | 60 | } |
61 | 61 | } |
@@ -51,8 +51,7 @@ |
||
51 | 51 | |
52 | 52 | $sCmd = self::TYPESCRIPT_WINDOWS." ".$sFile." --outDir ".__DIR__.'../../'.CACHE_DIR.$sFolder.'/'; |
53 | 53 | $sContent = shell_exec($sCmd); |
54 | - } |
|
55 | - else { |
|
54 | + } else { |
|
56 | 55 | |
57 | 56 | $sCmd = "tsc ".$sFile." --outDir ".__DIR__.'../../'.CACHE_DIR.$sFolder.'/'; |
58 | 57 | $sContent = shell_exec($sCmd); |
@@ -39,29 +39,29 @@ |
||
39 | 39 | */ |
40 | 40 | public function replaceBy(array $aParams = array()) : string |
41 | 41 | { |
42 | - $aParams['template'] = trim(str_replace(["'", '"'], "", $aParams['template'])); |
|
42 | + $aParams['template'] = trim(str_replace(["'", '"'], "", $aParams['template'])); |
|
43 | 43 | |
44 | 44 | if (isset($aParams['template'])) { |
45 | 45 | |
46 | - $aTemplates = explode(';', $aParams['template']); |
|
47 | - $sGetUrl = 'getCss?'; |
|
46 | + $aTemplates = explode(';', $aParams['template']); |
|
47 | + $sGetUrl = 'getCss?'; |
|
48 | 48 | |
49 | - foreach ($aTemplates as $sTemplate) { |
|
49 | + foreach ($aTemplates as $sTemplate) { |
|
50 | 50 | |
51 | - if (strstr($sTemplate, 'css/')) { |
|
51 | + if (strstr($sTemplate, 'css/')) { |
|
52 | 52 | |
53 | - $sGetUrl .= $sTemplate.'&'; |
|
54 | - } |
|
55 | - else if (strstr($sTemplate, 'js/')) { |
|
53 | + $sGetUrl .= $sTemplate.'&'; |
|
54 | + } |
|
55 | + else if (strstr($sTemplate, 'js/')) { |
|
56 | 56 | |
57 | - $sGetUrl .= $sTemplate.'&'; |
|
58 | - } |
|
59 | - } |
|
57 | + $sGetUrl .= $sTemplate.'&'; |
|
58 | + } |
|
59 | + } |
|
60 | 60 | |
61 | - if (defined('ASSET_VERSION') && ASSET_VERSION !== false) { |
|
61 | + if (defined('ASSET_VERSION') && ASSET_VERSION !== false) { |
|
62 | 62 | |
63 | - $sGetUrl .= ASSET_VERSION; |
|
64 | - } |
|
63 | + $sGetUrl .= ASSET_VERSION; |
|
64 | + } |
|
65 | 65 | |
66 | 66 | return $sGetUrl; |
67 | 67 | } |
@@ -51,8 +51,7 @@ |
||
51 | 51 | if (strstr($sTemplate, 'css/')) { |
52 | 52 | |
53 | 53 | $sGetUrl .= $sTemplate.'&'; |
54 | - } |
|
55 | - else if (strstr($sTemplate, 'js/')) { |
|
54 | + } else if (strstr($sTemplate, 'js/')) { |
|
56 | 55 | |
57 | 56 | $sGetUrl .= $sTemplate.'&'; |
58 | 57 | } |
@@ -28,30 +28,30 @@ |
||
28 | 28 | */ |
29 | 29 | class Geocoding |
30 | 30 | { |
31 | - /** |
|
32 | - * get the URL with the signature for the Pro account of Google Map |
|
33 | - * |
|
34 | - * @access public |
|
35 | - * @param unknown $sUrlToSign |
|
36 | - * @param unknown $sClientId |
|
37 | - * @param unknown $sPrivateKey |
|
38 | - * @return string |
|
39 | - */ |
|
40 | - public static function signUrlForGoogle(string $sUrlToSign, string $sClientId, string $sPrivateKey) : string |
|
41 | - { |
|
42 | - $aUrl = parse_url($sUrlToSign); |
|
43 | - $aUrl['query'] .= '&client=' .$sClientId; |
|
31 | + /** |
|
32 | + * get the URL with the signature for the Pro account of Google Map |
|
33 | + * |
|
34 | + * @access public |
|
35 | + * @param unknown $sUrlToSign |
|
36 | + * @param unknown $sClientId |
|
37 | + * @param unknown $sPrivateKey |
|
38 | + * @return string |
|
39 | + */ |
|
40 | + public static function signUrlForGoogle(string $sUrlToSign, string $sClientId, string $sPrivateKey) : string |
|
41 | + { |
|
42 | + $aUrl = parse_url($sUrlToSign); |
|
43 | + $aUrl['query'] .= '&client=' .$sClientId; |
|
44 | 44 | |
45 | - $aUrlToSign = $aUrl['path']."?".$aUrl['query']; |
|
45 | + $aUrlToSign = $aUrl['path']."?".$aUrl['query']; |
|
46 | 46 | |
47 | - $decodedKey = base64_decode(str_replace(array('-', '_'), array('+', '/'), $sPrivateKey)); |
|
47 | + $decodedKey = base64_decode(str_replace(array('-', '_'), array('+', '/'), $sPrivateKey)); |
|
48 | 48 | |
49 | - $sSignature = hash_hmac("sha1", $aUrlToSign, $decodedKey, true); |
|
49 | + $sSignature = hash_hmac("sha1", $aUrlToSign, $decodedKey, true); |
|
50 | 50 | |
51 | - $sEncodedSignature = str_replace(array('+', '/'), array('-', '_'), base64_encode($sSignature)); |
|
51 | + $sEncodedSignature = str_replace(array('+', '/'), array('-', '_'), base64_encode($sSignature)); |
|
52 | 52 | |
53 | - $sOriginalUrl = $aUrl['scheme']."://".$aUrl['host'].$aUrl['path'] . "?".$aUrl['query']; |
|
53 | + $sOriginalUrl = $aUrl['scheme']."://".$aUrl['host'].$aUrl['path'] . "?".$aUrl['query']; |
|
54 | 54 | |
55 | - return $sOriginalUrl. '&signature='. $sEncodedSignature; |
|
56 | - } |
|
55 | + return $sOriginalUrl. '&signature='. $sEncodedSignature; |
|
56 | + } |
|
57 | 57 | } |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | public static function signUrlForGoogle(string $sUrlToSign, string $sClientId, string $sPrivateKey) : string |
41 | 41 | { |
42 | 42 | $aUrl = parse_url($sUrlToSign); |
43 | - $aUrl['query'] .= '&client=' .$sClientId; |
|
43 | + $aUrl['query'] .= '&client='.$sClientId; |
|
44 | 44 | |
45 | 45 | $aUrlToSign = $aUrl['path']."?".$aUrl['query']; |
46 | 46 | |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | |
51 | 51 | $sEncodedSignature = str_replace(array('+', '/'), array('-', '_'), base64_encode($sSignature)); |
52 | 52 | |
53 | - $sOriginalUrl = $aUrl['scheme']."://".$aUrl['host'].$aUrl['path'] . "?".$aUrl['query']; |
|
53 | + $sOriginalUrl = $aUrl['scheme']."://".$aUrl['host'].$aUrl['path']."?".$aUrl['query']; |
|
54 | 54 | |
55 | - return $sOriginalUrl. '&signature='. $sEncodedSignature; |
|
55 | + return $sOriginalUrl.'&signature='.$sEncodedSignature; |
|
56 | 56 | } |
57 | 57 | } |
@@ -30,10 +30,10 @@ discard block |
||
30 | 30 | */ |
31 | 31 | class Typescript |
32 | 32 | { |
33 | - /** |
|
34 | - * @var string |
|
35 | - */ |
|
36 | - const TYPESCRIPT_WINDOWS = TYPESCRIPT_WINDOWS; |
|
33 | + /** |
|
34 | + * @var string |
|
35 | + */ |
|
36 | + const TYPESCRIPT_WINDOWS = TYPESCRIPT_WINDOWS; |
|
37 | 37 | |
38 | 38 | /** |
39 | 39 | * translate the content |
@@ -44,21 +44,21 @@ discard block |
||
44 | 44 | */ |
45 | 45 | public static function toJs(string $sFile) : string |
46 | 46 | { |
47 | - $aFile = pathinfo($sFile); |
|
48 | - $sFolder = uniqid(); |
|
47 | + $aFile = pathinfo($sFile); |
|
48 | + $sFolder = uniqid(); |
|
49 | 49 | |
50 | - if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { |
|
50 | + if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { |
|
51 | 51 | |
52 | - $sCmd = self::TYPESCRIPT_WINDOWS." ".$sFile." --outDir ".__DIR__.'../../'.CACHE_DIR.$sFolder.'/'; |
|
53 | - $sContent = shell_exec($sCmd); |
|
54 | - } |
|
55 | - else { |
|
52 | + $sCmd = self::TYPESCRIPT_WINDOWS." ".$sFile." --outDir ".__DIR__.'../../'.CACHE_DIR.$sFolder.'/'; |
|
53 | + $sContent = shell_exec($sCmd); |
|
54 | + } |
|
55 | + else { |
|
56 | 56 | |
57 | - $sCmd = "tsc ".$sFile." --outDir ".__DIR__.'../../'.CACHE_DIR.$sFolder.'/'; |
|
58 | - $sContent = shell_exec($sCmd); |
|
59 | - } |
|
57 | + $sCmd = "tsc ".$sFile." --outDir ".__DIR__.'../../'.CACHE_DIR.$sFolder.'/'; |
|
58 | + $sContent = shell_exec($sCmd); |
|
59 | + } |
|
60 | 60 | |
61 | - header("content-type:text/javascript"); |
|
62 | - return file_get_contents(__DIR__.'../../'.CACHE_DIR.$sFolder.'/'.$aFile['filename'].'.js'); |
|
61 | + header("content-type:text/javascript"); |
|
62 | + return file_get_contents(__DIR__.'../../'.CACHE_DIR.$sFolder.'/'.$aFile['filename'].'.js'); |
|
63 | 63 | } |
64 | 64 | } |
@@ -51,8 +51,7 @@ |
||
51 | 51 | |
52 | 52 | $sCmd = self::TYPESCRIPT_WINDOWS." ".$sFile." --outDir ".__DIR__.'../../'.CACHE_DIR.$sFolder.'/'; |
53 | 53 | $sContent = shell_exec($sCmd); |
54 | - } |
|
55 | - else { |
|
54 | + } else { |
|
56 | 55 | |
57 | 56 | $sCmd = "tsc ".$sFile." --outDir ".__DIR__.'../../'.CACHE_DIR.$sFolder.'/'; |
58 | 57 | $sContent = shell_exec($sCmd); |
@@ -34,7 +34,7 @@ |
||
34 | 34 | public function set(string $name, string $value = null) : Headers |
35 | 35 | { |
36 | 36 | if ($value !== null) { |
37 | - header($name . ': ' . $value); |
|
37 | + header($name.': '.$value); |
|
38 | 38 | } |
39 | 39 | else { |
40 | 40 | header($name); |
@@ -9,35 +9,35 @@ |
||
9 | 9 | |
10 | 10 | class Headers implements RequestInterface |
11 | 11 | { |
12 | - /** |
|
13 | - * get parameter |
|
14 | - * @param string $name |
|
15 | - * @param string $default |
|
16 | - * @return string |
|
17 | - */ |
|
18 | - public function get(string $name, string $default = null) : string |
|
19 | - { |
|
20 | - if (isset(apache_request_headers()[$name]) && apache_request_headers()[$name] != '') { |
|
21 | - return apache_request_headers()[$name]; |
|
22 | - } else if ($default !== null) { |
|
23 | - return $default; |
|
24 | - } |
|
25 | - } |
|
12 | + /** |
|
13 | + * get parameter |
|
14 | + * @param string $name |
|
15 | + * @param string $default |
|
16 | + * @return string |
|
17 | + */ |
|
18 | + public function get(string $name, string $default = null) : string |
|
19 | + { |
|
20 | + if (isset(apache_request_headers()[$name]) && apache_request_headers()[$name] != '') { |
|
21 | + return apache_request_headers()[$name]; |
|
22 | + } else if ($default !== null) { |
|
23 | + return $default; |
|
24 | + } |
|
25 | + } |
|
26 | 26 | |
27 | - /** |
|
28 | - * set a new header |
|
29 | - * @param string $name |
|
30 | - * @param string $value |
|
31 | - * @return string|Headers |
|
32 | - */ |
|
33 | - public function set(string $name, string $value = null) : Headers |
|
34 | - { |
|
35 | - if ($value !== null) { |
|
36 | - header($name . ': ' . $value); |
|
37 | - } else { |
|
38 | - header($name); |
|
39 | - } |
|
27 | + /** |
|
28 | + * set a new header |
|
29 | + * @param string $name |
|
30 | + * @param string $value |
|
31 | + * @return string|Headers |
|
32 | + */ |
|
33 | + public function set(string $name, string $value = null) : Headers |
|
34 | + { |
|
35 | + if ($value !== null) { |
|
36 | + header($name . ': ' . $value); |
|
37 | + } else { |
|
38 | + header($name); |
|
39 | + } |
|
40 | 40 | |
41 | - return $this; |
|
42 | - } |
|
41 | + return $this; |
|
42 | + } |
|
43 | 43 | } |