Test Failed
Push — develop ( a061b1...df8064 )
by nguereza
02:52
created
src/Config/ConfigUtil.php 1 patch
Braces   +6 added lines, -8 removed lines patch added patch discarded remove patch
@@ -51,17 +51,15 @@  discard block
 block discarded – undo
51 51
  * @class ConfigUtil
52 52
  * @package Platine\Framework\Config
53 53
  */
54
-class ConfigUtil
55
-{
54
+class ConfigUtil {
56 55
     /**
57 56
      * Convert the returned configuration to given type
58 57
      * @param mixed $value
59 58
      * @param string $type
60 59
      * @return mixed
61 60
      */
62
-    public static function convertToDataType($value, string $type)
63
-    {
64
-        switch ($type) {
61
+    public static function convertToDataType($value, string $type) {
62
+        switch ($type) {
65 63
             case 'integer':
66 64
                 $value = intval($value);
67 65
                 break;
@@ -91,15 +89,15 @@  discard block
 block discarded – undo
91 89
      */
92 90
     public static function isValueValideForDataType($value, string $type): bool
93 91
     {
94
-        if ($type === 'float' || $type === 'double') {
92
+        if ($type === 'float' || $type === 'double') {
95 93
             return (bool) filter_var($value, FILTER_VALIDATE_FLOAT);
96 94
         }
97 95
 
98
-        if ($type === 'integer') {
96
+        if ($type === 'integer') {
99 97
             return (bool) filter_var($value, FILTER_VALIDATE_INT);
100 98
         }
101 99
 
102
-        if ($type === 'boolean') {
100
+        if ($type === 'boolean') {
103 101
             return (bool) filter_var($value, FILTER_VALIDATE_BOOLEAN);
104 102
         }
105 103
 
Please login to merge, or discard this patch.
src/Config/ConfigurationRepositoryInterface.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -55,6 +55,5 @@
 block discarded – undo
55 55
  * @template TDbConfigurationEntity as \Platine\Orm\Entity
56 56
  * @extends RepositoryInterface<TDbConfigurationEntity>
57 57
  */
58
-interface ConfigurationRepositoryInterface extends RepositoryInterface
59
-{
58
+interface ConfigurationRepositoryInterface extends RepositoryInterface {
60 59
 }
Please login to merge, or discard this patch.
src/Config/DatabaseConfigLoaderInterface.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -55,8 +55,7 @@
 block discarded – undo
55 55
  * @package Platine\Framework\Config
56 56
  * @template TDbConfigurationEntity as Entity
57 57
  */
58
-interface DatabaseConfigLoaderInterface extends LoaderInterface
59
-{
58
+interface DatabaseConfigLoaderInterface extends LoaderInterface {
60 59
     /**
61 60
      * Load the configuration from database
62 61
      * @param array<string, mixed> $where
Please login to merge, or discard this patch.
src/Helper/functions.php 1 patch
Braces   +4 added lines, -5 removed lines patch added patch discarded remove patch
@@ -48,15 +48,14 @@  discard block
 block discarded – undo
48 48
 use Platine\Framework\Env\Env;
49 49
 
50 50
 
51
-if (!function_exists('app')) {
51
+if (!function_exists('app')) {
52 52
     /**
53 53
      * Return the container resolved instance
54 54
      * @param string|null $identifier the container identifier, if null the
55 55
      *  application instance will be returned
56 56
      * @return mixed
57 57
      */
58
-    function app(?string $identifier = null)
59
-    {
58
+    function app(?string $identifier = null) {
60 59
         $app = Application::getInstance();
61 60
 
62 61
         return $identifier ? $app->get($identifier) : $app;
@@ -64,7 +63,7 @@  discard block
 block discarded – undo
64 63
 }
65 64
 
66 65
 
67
-if (!function_exists('env')) {
66
+if (!function_exists('env')) {
68 67
     /**
69 68
      * Return the environment value. This is the alias to Env::get
70 69
      * @param string $key
@@ -78,7 +77,7 @@  discard block
 block discarded – undo
78 77
         $default = null,
79 78
         ?string $filter = null,
80 79
         $options = 0
81
-    ) {
80
+    ) {
82 81
         return Env::get($key, $default, $filter, $options);
83 82
     }
84 83
 }
Please login to merge, or discard this patch.
src/Helper/CsvReader.php 1 patch
Braces   +9 added lines, -10 removed lines patch added patch discarded remove patch
@@ -53,8 +53,7 @@  discard block
 block discarded – undo
53 53
  * @class CsvReader
54 54
  * @package Platine\Framework\Helper
55 55
  */
56
-class CsvReader
57
-{
56
+class CsvReader {
58 57
     /**
59 58
      * The valid delimiters list
60 59
      * @var array<string>
@@ -168,7 +167,7 @@  discard block
 block discarded – undo
168 167
      */
169 168
     public function setDelimiter(string $delimiter): self
170 169
     {
171
-        if (!in_array($delimiter, $this->validDelimiters)) {
170
+        if (!in_array($delimiter, $this->validDelimiters)) {
172 171
             throw new InvalidArgumentException(sprintf(
173 172
                 'Invalid delimiter [%s], must be one of [%s]',
174 173
                 $delimiter,
@@ -187,7 +186,7 @@  discard block
 block discarded – undo
187 186
     public function parse(): self
188 187
     {
189 188
         $fp = fopen($this->file, 'r');
190
-        if ($fp === false) {
189
+        if ($fp === false) {
191 190
             throw new InvalidArgumentException(sprintf(
192 191
                 'The file [%s] does not exist or readable',
193 192
                 $this->file
@@ -195,14 +194,14 @@  discard block
 block discarded – undo
195 194
         }
196 195
 
197 196
         $i = 0;
198
-        while (($data = fgetcsv($fp, $this->limit, $this->delimiter)) !== false) {
197
+        while (($data = fgetcsv($fp, $this->limit, $this->delimiter)) !== false) {
199 198
             // skip all empty lines
200
-            if ($data[0] !== null) {
201
-                if ($i === 0) {
199
+            if ($data[0] !== null) {
200
+                if ($i === 0) {
202 201
                     $this->headers = array_map([$this, 'sanitize'], $data);
203
-                } else {
202
+                } else {
204 203
                     $result = array_combine($this->headers, $data);
205
-                    if ($result !== false) {
204
+                    if ($result !== false) {
206 205
                         $this->data[] = $result;
207 206
                     }
208 207
                 }
@@ -223,7 +222,7 @@  discard block
 block discarded – undo
223 222
      */
224 223
     protected function checkFile(string $file): void
225 224
     {
226
-        if (file_exists($file) === false) {
225
+        if (file_exists($file) === false) {
227 226
             throw new InvalidArgumentException(sprintf(
228 227
                 'The file [%s] does not exist',
229 228
                 $file
Please login to merge, or discard this patch.
src/Helper/Timer/Timer.php 1 patch
Braces   +9 added lines, -11 removed lines patch added patch discarded remove patch
@@ -54,8 +54,7 @@  discard block
 block discarded – undo
54 54
  * @class Timer
55 55
  * @package Platine\Framework\Helper\Timer
56 56
  */
57
-class Timer
58
-{
57
+class Timer {
59 58
     public const NOT_STARTED = 0;
60 59
     public const STARTED = 1;
61 60
     public const PAUSED = 2;
@@ -89,8 +88,7 @@  discard block
 block discarded – undo
89 88
      * Create new timer instance
90 89
      * @param string $name
91 90
      */
92
-    public function __construct(string $name)
93
-    {
91
+    public function __construct(string $name) {
94 92
         $this->name = $name;
95 93
     }
96 94
 
@@ -101,7 +99,7 @@  discard block
 block discarded – undo
101 99
     public function getTime(): float
102 100
     {
103 101
         $currentRuntime = 0;
104
-        if ($this->state === self::STARTED) {
102
+        if ($this->state === self::STARTED) {
105 103
             $time = microtime(true);
106 104
             $currentRuntime = $time - $this->startTime;
107 105
         }
@@ -115,11 +113,11 @@  discard block
 block discarded – undo
115 113
      */
116 114
     public function stop(): bool
117 115
     {
118
-        if ($this->state === self::STARTED) {
116
+        if ($this->state === self::STARTED) {
119 117
             $this->pause();
120 118
         }
121 119
 
122
-        if ($this->state === self::PAUSED) {
120
+        if ($this->state === self::PAUSED) {
123 121
             $this->state = self::STOPPED;
124 122
 
125 123
             return true;
@@ -134,7 +132,7 @@  discard block
 block discarded – undo
134 132
      */
135 133
     public function pause(): bool
136 134
     {
137
-        if ($this->state !== self::STARTED) {
135
+        if ($this->state !== self::STARTED) {
138 136
             return false;
139 137
         }
140 138
         $time = microtime(true);
@@ -153,7 +151,7 @@  discard block
 block discarded – undo
153 151
      */
154 152
     public function start(): bool
155 153
     {
156
-        if ($this->canStart() === false) {
154
+        if ($this->canStart() === false) {
157 155
             return false;
158 156
         }
159 157
 
@@ -174,7 +172,7 @@  discard block
 block discarded – undo
174 172
      */
175 173
     public function canStart(): bool
176 174
     {
177
-        if (in_array($this->state, [self::NOT_STARTED, self::PAUSED])) {
175
+        if (in_array($this->state, [self::NOT_STARTED, self::PAUSED])) {
178 176
             return true;
179 177
         }
180 178
 
@@ -207,7 +205,7 @@  discard block
 block discarded – undo
207 205
      */
208 206
     protected function setState(int $state): self
209 207
     {
210
-        if ($state < 0 || $state > 3) {
208
+        if ($state < 0 || $state > 3) {
211 209
             throw new InvalidArgumentException(sprintf(
212 210
                 'Invalid state [%d] must be between [0-3]',
213 211
                 $state
Please login to merge, or discard this patch.
src/Helper/Timer/Watch.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -142,10 +142,10 @@
 block discarded – undo
142 142
     }
143 143
 
144 144
     /**
145
-    * Get watch
146
-    * @param string $name
147
-    * @return Timer
148
-    */
145
+     * Get watch
146
+     * @param string $name
147
+     * @return Timer
148
+     */
149 149
     public function getWatch(string $name): Timer
150 150
     {
151 151
         if (array_key_exists($name, $this->timers) === false) {
Please login to merge, or discard this patch.
Braces   +7 added lines, -8 removed lines patch added patch discarded remove patch
@@ -54,8 +54,7 @@  discard block
 block discarded – undo
54 54
  * @class Watch
55 55
  * @package Platine\Framework\Helper\Timer
56 56
  */
57
-class Watch
58
-{
57
+class Watch {
59 58
     /**
60 59
      * The default name to use if none is provided
61 60
      */
@@ -86,7 +85,7 @@  discard block
 block discarded – undo
86 85
      */
87 86
     public function pause(string $name = self::WATCH_DEFAULT_NAME): bool
88 87
     {
89
-        if ($this->exists($name) === false) {
88
+        if ($this->exists($name) === false) {
90 89
             return false;
91 90
         }
92 91
 
@@ -100,7 +99,7 @@  discard block
 block discarded – undo
100 99
      */
101 100
     public function stop(string $name = self::WATCH_DEFAULT_NAME): bool
102 101
     {
103
-        if ($this->exists($name) === false) {
102
+        if ($this->exists($name) === false) {
104 103
             return false;
105 104
         }
106 105
 
@@ -114,7 +113,7 @@  discard block
 block discarded – undo
114 113
      */
115 114
     public function getTime(string $name = self::WATCH_DEFAULT_NAME): float
116 115
     {
117
-        if ($this->exists($name) === false) {
116
+        if ($this->exists($name) === false) {
118 117
             return -1;
119 118
         }
120 119
 
@@ -128,7 +127,7 @@  discard block
 block discarded – undo
128 127
      */
129 128
     public function addWatch(string $name): self
130 129
     {
131
-        if (array_key_exists($name, $this->timers)) {
130
+        if (array_key_exists($name, $this->timers)) {
132 131
             throw new InvalidArgumentException(sprintf(
133 132
                 'Watch with the name [%s] already exist',
134 133
                 $name
@@ -148,7 +147,7 @@  discard block
 block discarded – undo
148 147
     */
149 148
     public function getWatch(string $name): Timer
150 149
     {
151
-        if (array_key_exists($name, $this->timers) === false) {
150
+        if (array_key_exists($name, $this->timers) === false) {
152 151
             throw new InvalidArgumentException(sprintf(
153 152
                 'Watch with the name [%s] does not exist',
154 153
                 $name
@@ -185,7 +184,7 @@  discard block
 block discarded – undo
185 184
     public function info(int $decimal = 6): array
186 185
     {
187 186
         $result = [];
188
-        foreach ($this->timers as $name => /** @var Timer $timer */ $timer) {
187
+        foreach ($this->timers as $name => /** @var Timer $timer */ $timer) {
189 188
             $result[$name] = number_format($timer->getTime(), $decimal);
190 189
         }
191 190
         return $result;
Please login to merge, or discard this patch.
src/Helper/Flash.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -53,8 +53,7 @@  discard block
 block discarded – undo
53 53
  * @class Flash
54 54
  * @package Platine\Framework\Helper
55 55
  */
56
-class Flash
57
-{
56
+class Flash {
58 57
     /**
59 58
      * The session instance
60 59
      * @var Session
@@ -65,8 +64,7 @@  discard block
 block discarded – undo
65 64
      * Create new instance
66 65
      * @param Session $session
67 66
      */
68
-    public function __construct(Session $session)
69
-    {
67
+    public function __construct(Session $session) {
70 68
         $this->session = $session;
71 69
     }
72 70
 
Please login to merge, or discard this patch.
src/Auth/IdentityInterface.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -51,8 +51,7 @@
 block discarded – undo
51 51
  * @class IdentityInterface
52 52
  * @package Platine\Framework\Auth
53 53
  */
54
-interface IdentityInterface
55
-{
54
+interface IdentityInterface {
56 55
     /**
57 56
      * Return the id of the current user
58 57
      * @return mixed
Please login to merge, or discard this patch.