@@ -3,5 +3,5 @@ |
||
3 | 3 | return [ |
4 | 4 | 'default' => 'bcrypt', |
5 | 5 | |
6 | - 'bcrypt' => [] |
|
6 | + 'bcrypt' => [ ] |
|
7 | 7 | ]; |
@@ -79,7 +79,9 @@ |
||
79 | 79 | function getStringBetween($string, $start, $end) { |
80 | 80 | $string = ' ' . $string; |
81 | 81 | $ini = strpos($string, $start); |
82 | - if ($ini == 0) return ''; |
|
82 | + if ($ini == 0) { |
|
83 | + return ''; |
|
84 | + } |
|
83 | 85 | $ini += strlen($start); |
84 | 86 | $len = strpos($string, $end, $ini) - $ini; |
85 | 87 | return substr($string, $ini, $len); |
@@ -1,15 +1,15 @@ discard block |
||
1 | 1 | <?php |
2 | -if(! function_exists("dd")) { |
|
2 | +if (!function_exists("dd")) { |
|
3 | 3 | /** |
4 | 4 | * Little helper called dump and die |
5 | 5 | * @param $val |
6 | 6 | */ |
7 | 7 | function dd($val) { |
8 | - \app\framework\Component\VarDumper\VarDumper::dump($val);die; |
|
8 | + \app\framework\Component\VarDumper\VarDumper::dump($val); die; |
|
9 | 9 | } |
10 | 10 | } |
11 | 11 | |
12 | -if(! function_exists("pathTo")) { |
|
12 | +if (!function_exists("pathTo")) { |
|
13 | 13 | /** |
14 | 14 | * Easy function to get the path to the project + if you want an directory in it. |
15 | 15 | * |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | } |
22 | 22 | } |
23 | 23 | |
24 | -if(! function_exists("view")) { |
|
24 | +if (!function_exists("view")) { |
|
25 | 25 | /** |
26 | 26 | * Get the evaluated view contents for the given view. |
27 | 27 | * |
@@ -29,14 +29,14 @@ discard block |
||
29 | 29 | * @param array $data Data to set values in template file |
30 | 30 | * @return \app\framework\Component\View\View|string |
31 | 31 | */ |
32 | - function view($view = null, $data = []) { |
|
33 | - $data['auth'] = new \app\framework\Component\Auth\Auth; |
|
32 | + function view($view = null, $data = [ ]) { |
|
33 | + $data[ 'auth' ] = new \app\framework\Component\Auth\Auth; |
|
34 | 34 | $View = new \app\framework\Component\View\View($view, $data); |
35 | 35 | return $View->render(); |
36 | 36 | } |
37 | 37 | } |
38 | 38 | |
39 | -if(! function_exists("app")) { |
|
39 | +if (!function_exists("app")) { |
|
40 | 40 | /** |
41 | 41 | * Used to easily call Methods from classes without manually set |
42 | 42 | * locally Instances of them. |
@@ -45,12 +45,12 @@ discard block |
||
45 | 45 | * @param array $param To declare what parameter shall be passed to the method |
46 | 46 | * @return mixed |
47 | 47 | */ |
48 | - function app($classMethod, $param = []) { |
|
49 | - return $GLOBALS["App"]->call($classMethod, $param); |
|
48 | + function app($classMethod, $param = [ ]) { |
|
49 | + return $GLOBALS[ "App" ]->call($classMethod, $param); |
|
50 | 50 | } |
51 | 51 | } |
52 | 52 | |
53 | -if(! function_exists("url")) { |
|
53 | +if (!function_exists("url")) { |
|
54 | 54 | /** |
55 | 55 | * Basically completes just the the url |
56 | 56 | * e.g. /test to yourexample.site/test |
@@ -62,11 +62,11 @@ discard block |
||
62 | 62 | * @return string |
63 | 63 | */ |
64 | 64 | function url($path) { |
65 | - return $_SERVER['HTTP_HOST'].$path; |
|
65 | + return $_SERVER[ 'HTTP_HOST' ].$path; |
|
66 | 66 | } |
67 | 67 | } |
68 | 68 | |
69 | -if(! function_exists("getStringBetween")) { |
|
69 | +if (!function_exists("getStringBetween")) { |
|
70 | 70 | /** |
71 | 71 | * This is a handy little function to strip out a string between |
72 | 72 | * two specified pieces of text. This could be used to parse |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | * @return bool|string |
79 | 79 | */ |
80 | 80 | function getStringBetween($string, $start, $end) { |
81 | - $string = ' ' . $string; |
|
81 | + $string = ' '.$string; |
|
82 | 82 | $ini = strpos($string, $start); |
83 | 83 | if ($ini == 0) return ''; |
84 | 84 | $ini += strlen($start); |
@@ -87,13 +87,13 @@ discard block |
||
87 | 87 | } |
88 | 88 | } |
89 | 89 | |
90 | -if(! function_exists("handle")) { |
|
91 | - function handle( $e) { |
|
90 | +if (!function_exists("handle")) { |
|
91 | + function handle($e) { |
|
92 | 92 | \app\framework\Component\Exception\Handler::getInstance()->handler($e); |
93 | 93 | } |
94 | 94 | } |
95 | 95 | |
96 | -if(! function_exists("arr")) { |
|
96 | +if (!function_exists("arr")) { |
|
97 | 97 | /** |
98 | 98 | * Create an ArrayObject from array |
99 | 99 | * @param array $arr |
@@ -104,13 +104,13 @@ discard block |
||
104 | 104 | } |
105 | 105 | } |
106 | 106 | |
107 | -if(! function_exists("str")) { |
|
107 | +if (!function_exists("str")) { |
|
108 | 108 | function str($str) { |
109 | 109 | return new \app\framework\Component\StdLib\StdObject\StringObject\StringObject($str); |
110 | 110 | } |
111 | 111 | } |
112 | 112 | |
113 | -if(! function_exists("encrypt")) { |
|
113 | +if (!function_exists("encrypt")) { |
|
114 | 114 | /** |
115 | 115 | * Encrypt the given value. |
116 | 116 | * |
@@ -124,11 +124,11 @@ discard block |
||
124 | 124 | \app\framework\Component\Config\Config::getInstance()->get("CrypKey") |
125 | 125 | ); |
126 | 126 | |
127 | - return $Encryptor->encrypt($value, $serialize ); |
|
127 | + return $Encryptor->encrypt($value, $serialize); |
|
128 | 128 | } |
129 | 129 | } |
130 | 130 | |
131 | -if(! function_exists("decrypt")) { |
|
131 | +if (!function_exists("decrypt")) { |
|
132 | 132 | /** |
133 | 133 | * Decrypt the given value. |
134 | 134 | * |
@@ -142,11 +142,11 @@ discard block |
||
142 | 142 | \app\framework\Component\Config\Config::getInstance()->get("CrypKey") |
143 | 143 | ); |
144 | 144 | |
145 | - return $Encryptor->decrypt($value, $unserialize ); |
|
145 | + return $Encryptor->decrypt($value, $unserialize); |
|
146 | 146 | } |
147 | 147 | } |
148 | 148 | |
149 | -if(! function_exists("version")) { |
|
149 | +if (!function_exists("version")) { |
|
150 | 150 | /** |
151 | 151 | * @return string version as written in config/app.php |
152 | 152 | */ |
@@ -155,13 +155,13 @@ discard block |
||
155 | 155 | } |
156 | 156 | } |
157 | 157 | |
158 | -if(! function_exists("isDebug")) { |
|
158 | +if (!function_exists("isDebug")) { |
|
159 | 159 | function isDebug() { |
160 | 160 | return \app\framework\Component\Config\Config::getInstance()->get("debug", "app"); |
161 | 161 | } |
162 | 162 | } |
163 | 163 | |
164 | -if(! function_exists("class_basename")) { |
|
164 | +if (!function_exists("class_basename")) { |
|
165 | 165 | /** |
166 | 166 | * Get the class "basename" of the given object / class. |
167 | 167 | * |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | } |
176 | 176 | } |
177 | 177 | |
178 | -if (! function_exists("get_connection_log")) |
|
178 | +if (!function_exists("get_connection_log")) |
|
179 | 179 | { |
180 | 180 | /** |
181 | 181 | * returns query log from Connection as array |
@@ -20,6 +20,6 @@ |
||
20 | 20 | |
21 | 21 | include("helper.php"); |
22 | 22 | |
23 | -if(isDebug()) { |
|
23 | +if (isDebug()) { |
|
24 | 24 | set_exception_handler("handle"); |
25 | 25 | } |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | */ |
19 | 19 | class Config |
20 | 20 | { |
21 | - use StdLibTrait,SingletonTrait; |
|
21 | + use StdLibTrait, SingletonTrait; |
|
22 | 22 | |
23 | 23 | private $data; |
24 | 24 | |
@@ -26,14 +26,14 @@ discard block |
||
26 | 26 | { |
27 | 27 | $this->getAllData(); |
28 | 28 | //var_dump($this->data->val()); |
29 | - if(!$this->isNull($file)){ |
|
29 | + if (!$this->isNull($file)) { |
|
30 | 30 | $file = $this->arr($this->data->key($file)); |
31 | 31 | |
32 | 32 | return $file->key($config); |
33 | 33 | } else { |
34 | - foreach($this->data->val() as $confCont){ |
|
34 | + foreach ($this->data->val() as $confCont) { |
|
35 | 35 | $confCont = $this->arr($confCont); |
36 | - if($confCont->keyExists($config)){ |
|
36 | + if ($confCont->keyExists($config)) { |
|
37 | 37 | return $confCont->key($config); |
38 | 38 | } |
39 | 39 | } |
@@ -47,8 +47,8 @@ discard block |
||
47 | 47 | $files = $this->arr(scandir(ROOT_PATH.DIRECTORY_SEPARATOR."config".DIRECTORY_SEPARATOR)); |
48 | 48 | $files->removeFirst()->removeFirst(); |
49 | 49 | |
50 | - foreach($files->val() as $file){ |
|
51 | - $temp[explode(".", $file)[0]] = include( |
|
50 | + foreach ($files->val() as $file) { |
|
51 | + $temp[ explode(".", $file)[ 0 ] ] = include( |
|
52 | 52 | ROOT_PATH.DIRECTORY_SEPARATOR."config".DIRECTORY_SEPARATOR.$file |
53 | 53 | ); |
54 | 54 | } |
@@ -33,5 +33,5 @@ |
||
33 | 33 | * @return boolean|string |
34 | 34 | * @throws ValidationException |
35 | 35 | */ |
36 | - public function validate($value, $params = [], $throw = true); |
|
36 | + public function validate($value, $params = [ ], $throw = true); |
|
37 | 37 | } |
@@ -39,12 +39,12 @@ |
||
39 | 39 | private $validators = []; |
40 | 40 | |
41 | 41 | /** |
42 | - * @param mixed $data |
|
43 | - * @param string|array $validators |
|
44 | - * @param bool|true $throw |
|
45 | - * |
|
46 | - * @return bool |
|
47 | - */ |
|
42 | + * @param mixed $data |
|
43 | + * @param string|array $validators |
|
44 | + * @param bool|true $throw |
|
45 | + * |
|
46 | + * @return bool |
|
47 | + */ |
|
48 | 48 | public function validate($data, $validators, $throw = true) |
49 | 49 | { |
50 | 50 | $validators = $this->getValidators($validators); |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | { |
37 | 37 | use SingletonTrait; |
38 | 38 | |
39 | - private $validators = []; |
|
39 | + private $validators = [ ]; |
|
40 | 40 | |
41 | 41 | /** |
42 | 42 | * @param mixed $data |
@@ -57,10 +57,10 @@ discard block |
||
57 | 57 | $throw |
58 | 58 | ]; |
59 | 59 | |
60 | - if (!array_key_exists($validator[0], $this->validators)) { |
|
61 | - handle(new ValidationException('Validator %s does not exist!', $validator[0])); |
|
60 | + if (!array_key_exists($validator[ 0 ], $this->validators)) { |
|
61 | + handle(new ValidationException('Validator %s does not exist!', $validator[ 0 ])); |
|
62 | 62 | } |
63 | - $res = $this->validators[$validator[0]]->validate(...$functionParams); |
|
63 | + $res = $this->validators[ $validator[ 0 ] ]->validate(...$functionParams); |
|
64 | 64 | |
65 | 65 | // If validation failed and we are not throwing, return error message string |
66 | 66 | if ($res !== true && !$throw) { |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | */ |
81 | 81 | public function addValidator(ValidatorInterface $validator) |
82 | 82 | { |
83 | - $this->validators[$validator->getName()] = $validator; |
|
83 | + $this->validators[ $validator->getName() ] = $validator; |
|
84 | 84 | |
85 | 85 | return $this; |
86 | 86 | } |
@@ -108,8 +108,8 @@ discard block |
||
108 | 108 | ]; |
109 | 109 | |
110 | 110 | /* @var $v ValidatorInterface */ |
111 | - foreach($buildInValidators as $v){ |
|
112 | - $this->validators[$v->getName()] = $v; |
|
111 | + foreach ($buildInValidators as $v) { |
|
112 | + $this->validators[ $v->getName() ] = $v; |
|
113 | 113 | } |
114 | 114 | } |
115 | 115 | |
@@ -123,6 +123,6 @@ discard block |
||
123 | 123 | return explode(',', $validators); |
124 | 124 | } |
125 | 125 | |
126 | - return []; |
|
126 | + return [ ]; |
|
127 | 127 | } |
128 | 128 | } |
@@ -32,7 +32,7 @@ |
||
32 | 32 | * |
33 | 33 | * @return boolean|string |
34 | 34 | */ |
35 | - public function validate($value, $params = [], $throw = true) |
|
35 | + public function validate($value, $params = [ ], $throw = true) |
|
36 | 36 | { |
37 | 37 | if (filter_var($value, FILTER_VALIDATE_IP)) { |
38 | 38 | return true; |
@@ -32,7 +32,7 @@ |
||
32 | 32 | * |
33 | 33 | * @return boolean|string |
34 | 34 | */ |
35 | - public function validate($value, $params = [], $throw = true) |
|
35 | + public function validate($value, $params = [ ], $throw = true) |
|
36 | 36 | { |
37 | 37 | if (filter_var($value, FILTER_VALIDATE_MAC)) { |
38 | 38 | return true; |
@@ -32,17 +32,17 @@ |
||
32 | 32 | * |
33 | 33 | * @return boolean|string |
34 | 34 | */ |
35 | - public function validate($value, $params = [], $throw = true) |
|
35 | + public function validate($value, $params = [ ], $throw = true) |
|
36 | 36 | { |
37 | - $limit = $params[0]; |
|
37 | + $limit = $params[ 0 ]; |
|
38 | 38 | $length = is_string($value) ? strlen($value) : count($value); |
39 | 39 | |
40 | - if($length >= $limit){ |
|
40 | + if ($length >= $limit) { |
|
41 | 41 | return true; |
42 | 42 | } |
43 | 43 | |
44 | 44 | $message = "Value must be contain %s character at least"; |
45 | - if($throw){ |
|
45 | + if ($throw) { |
|
46 | 46 | throw (new ValidationException($message, $limit)); |
47 | 47 | } |
48 | 48 |