@@ -30,13 +30,13 @@ discard block |
||
30 | 30 | */ |
31 | 31 | class Vendor |
32 | 32 | { |
33 | - /** |
|
34 | - * cache of the vendor available |
|
35 | - * |
|
36 | - * @access private |
|
37 | - * @var array |
|
38 | - */ |
|
39 | - private static $_aCache = null; |
|
33 | + /** |
|
34 | + * cache of the vendor available |
|
35 | + * |
|
36 | + * @access private |
|
37 | + * @var array |
|
38 | + */ |
|
39 | + private static $_aCache = null; |
|
40 | 40 | |
41 | 41 | /** |
42 | 42 | * constructor - factory |
@@ -54,31 +54,31 @@ discard block |
||
54 | 54 | |
55 | 55 | public static function getVendor(string $sVendorName, $mParam = null, $mParam2 = null) |
56 | 56 | { |
57 | - if ($sVendorName === 'Apollina\Template') { |
|
57 | + if ($sVendorName === 'Apollina\Template') { |
|
58 | 58 | |
59 | - $oApollina = new $sVendorName($mParam, str_replace('lib', '', __DIR__), |
|
60 | - str_replace('bundles'.DIRECTORY_SEPARATOR.'lib', CACHE_DIR, __DIR__), $mParam2); |
|
59 | + $oApollina = new $sVendorName($mParam, str_replace('lib', '', __DIR__), |
|
60 | + str_replace('bundles'.DIRECTORY_SEPARATOR.'lib', CACHE_DIR, __DIR__), $mParam2); |
|
61 | 61 | |
62 | - return $oApollina->addFunctionPath(__DIR__.DIRECTORY_SEPARATOR.'Functions', '\Venus\lib\Functions\\'); |
|
63 | - } |
|
64 | - else if ($sVendorName === 'Attila\Orm') { |
|
62 | + return $oApollina->addFunctionPath(__DIR__.DIRECTORY_SEPARATOR.'Functions', '\Venus\lib\Functions\\'); |
|
63 | + } |
|
64 | + else if ($sVendorName === 'Attila\Orm') { |
|
65 | 65 | |
66 | - $oDbConfig = Config::get('Db')->configuration; |
|
66 | + $oDbConfig = Config::get('Db')->configuration; |
|
67 | 67 | |
68 | - return new $sVendorName($oDbConfig->db, $oDbConfig->type, $oDbConfig->host, $oDbConfig->user, $oDbConfig->password, |
|
69 | - $oDbConfig->db); |
|
70 | - } |
|
71 | - else if (isset($mParam) && isset($mParam2)) { |
|
68 | + return new $sVendorName($oDbConfig->db, $oDbConfig->type, $oDbConfig->host, $oDbConfig->user, $oDbConfig->password, |
|
69 | + $oDbConfig->db); |
|
70 | + } |
|
71 | + else if (isset($mParam) && isset($mParam2)) { |
|
72 | 72 | |
73 | - return new $sVendorName($mParam, $mParam2); |
|
74 | - } |
|
75 | - else if (isset($mParam)) { |
|
73 | + return new $sVendorName($mParam, $mParam2); |
|
74 | + } |
|
75 | + else if (isset($mParam)) { |
|
76 | 76 | |
77 | - return new $sVendorName($mParam); |
|
78 | - } |
|
79 | - else { |
|
77 | + return new $sVendorName($mParam); |
|
78 | + } |
|
79 | + else { |
|
80 | 80 | |
81 | - return new $sVendorName; |
|
82 | - } |
|
81 | + return new $sVendorName; |
|
82 | + } |
|
83 | 83 | } |
84 | 84 | } |
@@ -60,23 +60,19 @@ |
||
60 | 60 | str_replace('bundles'.DIRECTORY_SEPARATOR.'lib', CACHE_DIR, __DIR__), $mParam2); |
61 | 61 | |
62 | 62 | return $oApollina->addFunctionPath(__DIR__.DIRECTORY_SEPARATOR.'Functions', '\Venus\lib\Functions\\'); |
63 | - } |
|
64 | - else if ($sVendorName === 'Attila\Orm') { |
|
63 | + } else if ($sVendorName === 'Attila\Orm') { |
|
65 | 64 | |
66 | 65 | $oDbConfig = Config::get('Db')->configuration; |
67 | 66 | |
68 | 67 | return new $sVendorName($oDbConfig->db, $oDbConfig->type, $oDbConfig->host, $oDbConfig->user, $oDbConfig->password, |
69 | 68 | $oDbConfig->db); |
70 | - } |
|
71 | - else if (isset($mParam) && isset($mParam2)) { |
|
69 | + } else if (isset($mParam) && isset($mParam2)) { |
|
72 | 70 | |
73 | 71 | return new $sVendorName($mParam, $mParam2); |
74 | - } |
|
75 | - else if (isset($mParam)) { |
|
72 | + } else if (isset($mParam)) { |
|
76 | 73 | |
77 | 74 | return new $sVendorName($mParam); |
78 | - } |
|
79 | - else { |
|
75 | + } else { |
|
80 | 76 | |
81 | 77 | return new $sVendorName; |
82 | 78 | } |
@@ -30,41 +30,41 @@ |
||
30 | 30 | */ |
31 | 31 | class Type extends Common |
32 | 32 | { |
33 | - /** |
|
34 | - * type |
|
35 | - * @var type |
|
36 | - */ |
|
37 | - private $_sType = ''; |
|
33 | + /** |
|
34 | + * type |
|
35 | + * @var type |
|
36 | + */ |
|
37 | + private $_sType = ''; |
|
38 | 38 | |
39 | - /** |
|
40 | - * constructor |
|
41 | - * |
|
42 | - * @access public |
|
43 | - * @param string $sType type |
|
44 | - * @return Type |
|
45 | - */ |
|
46 | - public function __construct(string $sType) |
|
47 | - { |
|
48 | - $this->_sType = $sType; |
|
49 | - } |
|
39 | + /** |
|
40 | + * constructor |
|
41 | + * |
|
42 | + * @access public |
|
43 | + * @param string $sType type |
|
44 | + * @return Type |
|
45 | + */ |
|
46 | + public function __construct(string $sType) |
|
47 | + { |
|
48 | + $this->_sType = $sType; |
|
49 | + } |
|
50 | 50 | |
51 | - /** |
|
52 | - * validate the Type |
|
53 | - * |
|
54 | - * @access public |
|
55 | - * @param string $sValue |
|
56 | - * @return bool |
|
57 | - */ |
|
58 | - public function validate(string $sValue = null) : bool |
|
59 | - { |
|
60 | - if ($this->_sType == 'DateTime') { |
|
51 | + /** |
|
52 | + * validate the Type |
|
53 | + * |
|
54 | + * @access public |
|
55 | + * @param string $sValue |
|
56 | + * @return bool |
|
57 | + */ |
|
58 | + public function validate(string $sValue = null) : bool |
|
59 | + { |
|
60 | + if ($this->_sType == 'DateTime') { |
|
61 | 61 | |
62 | - if (preg_match('#^[0-9]{4}/[0-9]{2}/[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}#', $sValue)) { |
|
62 | + if (preg_match('#^[0-9]{4}/[0-9]{2}/[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}#', $sValue)) { |
|
63 | 63 | |
64 | - return true; |
|
65 | - } |
|
66 | - } |
|
64 | + return true; |
|
65 | + } |
|
66 | + } |
|
67 | 67 | |
68 | - return false; |
|
69 | - } |
|
68 | + return false; |
|
69 | + } |
|
70 | 70 | } |
@@ -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 | } |
@@ -37,7 +37,7 @@ |
||
37 | 37 | { |
38 | 38 | if ( is_object($mObject)) { |
39 | 39 | |
40 | - $mObject = (array) $mObject; |
|
40 | + $mObject = (array) $mObject; |
|
41 | 41 | } |
42 | 42 | |
43 | 43 |
@@ -35,9 +35,9 @@ discard block |
||
35 | 35 | */ |
36 | 36 | public static function object_to_array($mObject) : array |
37 | 37 | { |
38 | - if ( is_object($mObject)) { |
|
38 | + if (is_object($mObject)) { |
|
39 | 39 | |
40 | - $mObject = (array) $mObject; |
|
40 | + $mObject = (array)$mObject; |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | |
46 | 46 | $aNew = array(); |
47 | 47 | |
48 | - foreach($mObject as $sKey => $mValues) { |
|
48 | + foreach ($mObject as $sKey => $mValues) { |
|
49 | 49 | |
50 | 50 | $sKey = preg_replace("/^\\0(.*)\\0/", "", $sKey); |
51 | 51 | $aNew[$sKey] = self::object_to_array($mValues); |
@@ -50,8 +50,7 @@ |
||
50 | 50 | $sKey = preg_replace("/^\\0(.*)\\0/", "", $sKey); |
51 | 51 | $aNew[$sKey] = self::object_to_array($mValues); |
52 | 52 | } |
53 | - } |
|
54 | - else { |
|
53 | + } else { |
|
55 | 54 | |
56 | 55 | $aNew = $mObject; |
57 | 56 | } |
@@ -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 | /** |
@@ -19,96 +19,96 @@ |
||
19 | 19 | */ |
20 | 20 | interface LoggerInterface |
21 | 21 | { |
22 | - /** |
|
23 | - * System is unusable. |
|
24 | - * |
|
25 | - * @param string $message |
|
26 | - * @param array $context |
|
27 | - * @return null |
|
28 | - */ |
|
29 | - public function emergency($message, array $context = array()); |
|
22 | + /** |
|
23 | + * System is unusable. |
|
24 | + * |
|
25 | + * @param string $message |
|
26 | + * @param array $context |
|
27 | + * @return null |
|
28 | + */ |
|
29 | + public function emergency($message, array $context = array()); |
|
30 | 30 | |
31 | - /** |
|
32 | - * Action must be taken immediately. |
|
33 | - * |
|
34 | - * Example: Entire website down, database unavailable, etc. This should |
|
35 | - * trigger the SMS alerts and wake you up. |
|
36 | - * |
|
37 | - * @param string $message |
|
38 | - * @param array $context |
|
39 | - * @return null |
|
40 | - */ |
|
41 | - public function alert($message, array $context = array()); |
|
31 | + /** |
|
32 | + * Action must be taken immediately. |
|
33 | + * |
|
34 | + * Example: Entire website down, database unavailable, etc. This should |
|
35 | + * trigger the SMS alerts and wake you up. |
|
36 | + * |
|
37 | + * @param string $message |
|
38 | + * @param array $context |
|
39 | + * @return null |
|
40 | + */ |
|
41 | + public function alert($message, array $context = array()); |
|
42 | 42 | |
43 | - /** |
|
44 | - * Critical conditions. |
|
45 | - * |
|
46 | - * Example: Application component unavailable, unexpected exception. |
|
47 | - * |
|
48 | - * @param string $message |
|
49 | - * @param array $context |
|
50 | - * @return null |
|
51 | - */ |
|
52 | - public function critical($message, array $context = array()); |
|
43 | + /** |
|
44 | + * Critical conditions. |
|
45 | + * |
|
46 | + * Example: Application component unavailable, unexpected exception. |
|
47 | + * |
|
48 | + * @param string $message |
|
49 | + * @param array $context |
|
50 | + * @return null |
|
51 | + */ |
|
52 | + public function critical($message, array $context = array()); |
|
53 | 53 | |
54 | - /** |
|
55 | - * Runtime errors that do not require immediate action but should typically |
|
56 | - * be logged and monitored. |
|
57 | - * |
|
58 | - * @param string $message |
|
59 | - * @param array $context |
|
60 | - * @return null |
|
61 | - */ |
|
62 | - public function error($message, array $context = array()); |
|
54 | + /** |
|
55 | + * Runtime errors that do not require immediate action but should typically |
|
56 | + * be logged and monitored. |
|
57 | + * |
|
58 | + * @param string $message |
|
59 | + * @param array $context |
|
60 | + * @return null |
|
61 | + */ |
|
62 | + public function error($message, array $context = array()); |
|
63 | 63 | |
64 | - /** |
|
65 | - * Exceptional occurrences that are not errors. |
|
66 | - * |
|
67 | - * Example: Use of deprecated APIs, poor use of an API, undesirable things |
|
68 | - * that are not necessarily wrong. |
|
69 | - * |
|
70 | - * @param string $message |
|
71 | - * @param array $context |
|
72 | - * @return null |
|
73 | - */ |
|
74 | - public function warning($message, array $context = array()); |
|
64 | + /** |
|
65 | + * Exceptional occurrences that are not errors. |
|
66 | + * |
|
67 | + * Example: Use of deprecated APIs, poor use of an API, undesirable things |
|
68 | + * that are not necessarily wrong. |
|
69 | + * |
|
70 | + * @param string $message |
|
71 | + * @param array $context |
|
72 | + * @return null |
|
73 | + */ |
|
74 | + public function warning($message, array $context = array()); |
|
75 | 75 | |
76 | - /** |
|
77 | - * Normal but significant events. |
|
78 | - * |
|
79 | - * @param string $message |
|
80 | - * @param array $context |
|
81 | - * @return null |
|
82 | - */ |
|
83 | - public function notice($message, array $context = array()); |
|
76 | + /** |
|
77 | + * Normal but significant events. |
|
78 | + * |
|
79 | + * @param string $message |
|
80 | + * @param array $context |
|
81 | + * @return null |
|
82 | + */ |
|
83 | + public function notice($message, array $context = array()); |
|
84 | 84 | |
85 | - /** |
|
86 | - * Interesting events. |
|
87 | - * |
|
88 | - * Example: User logs in, SQL logs. |
|
89 | - * |
|
90 | - * @param string $message |
|
91 | - * @param array $context |
|
92 | - * @return null |
|
93 | - */ |
|
94 | - public function info($message, array $context = array()); |
|
85 | + /** |
|
86 | + * Interesting events. |
|
87 | + * |
|
88 | + * Example: User logs in, SQL logs. |
|
89 | + * |
|
90 | + * @param string $message |
|
91 | + * @param array $context |
|
92 | + * @return null |
|
93 | + */ |
|
94 | + public function info($message, array $context = array()); |
|
95 | 95 | |
96 | - /** |
|
97 | - * Detailed debug information. |
|
98 | - * |
|
99 | - * @param string $message |
|
100 | - * @param array $context |
|
101 | - * @return null |
|
102 | - */ |
|
103 | - public function debug($message, array $context = array()); |
|
96 | + /** |
|
97 | + * Detailed debug information. |
|
98 | + * |
|
99 | + * @param string $message |
|
100 | + * @param array $context |
|
101 | + * @return null |
|
102 | + */ |
|
103 | + public function debug($message, array $context = array()); |
|
104 | 104 | |
105 | - /** |
|
106 | - * Logs with an arbitrary level. |
|
107 | - * |
|
108 | - * @param mixed $level |
|
109 | - * @param string $message |
|
110 | - * @param array $context |
|
111 | - * @return null |
|
112 | - */ |
|
113 | - public function log($level, $message, array $context = array()); |
|
105 | + /** |
|
106 | + * Logs with an arbitrary level. |
|
107 | + * |
|
108 | + * @param mixed $level |
|
109 | + * @param string $message |
|
110 | + * @param array $context |
|
111 | + * @return null |
|
112 | + */ |
|
113 | + public function log($level, $message, array $context = array()); |
|
114 | 114 | } |
115 | 115 | \ No newline at end of file |
@@ -7,12 +7,12 @@ |
||
7 | 7 | */ |
8 | 8 | class LogLevel |
9 | 9 | { |
10 | - const EMERGENCY = 'emergency'; |
|
11 | - const ALERT = 'alert'; |
|
12 | - const CRITICAL = 'critical'; |
|
13 | - const ERROR = 'error'; |
|
14 | - const WARNING = 'warning'; |
|
15 | - const NOTICE = 'notice'; |
|
16 | - const INFO = 'info'; |
|
17 | - const DEBUG = 'debug'; |
|
10 | + const EMERGENCY = 'emergency'; |
|
11 | + const ALERT = 'alert'; |
|
12 | + const CRITICAL = 'critical'; |
|
13 | + const ERROR = 'error'; |
|
14 | + const WARNING = 'warning'; |
|
15 | + const NOTICE = 'notice'; |
|
16 | + const INFO = 'info'; |
|
17 | + const DEBUG = 'debug'; |
|
18 | 18 | } |
19 | 19 | \ No newline at end of file |