Test Failed
Push — develop ( 70abbc...8213ee )
by nguereza
02:59
created
src/Service/Provider/LangServiceProvider.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@
 block discarded – undo
68 68
      */
69 69
     public function register(): void
70 70
     {
71
-        $this->app->bind(Configuration::class, function (ContainerInterface $app) {
71
+        $this->app->bind(Configuration::class, function(ContainerInterface $app) {
72 72
             return new Configuration($app->get(Config::class)->get('lang', []));
73 73
         });
74 74
         $this->app->share(StorageInterface::class, MemoryStorage::class);
Please login to merge, or discard this patch.
Braces   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -61,14 +61,13 @@
 block discarded – undo
61 61
  * @class LangServiceProvider
62 62
  * @package Platine\Framework\Service\Provider
63 63
  */
64
-class LangServiceProvider extends ServiceProvider
65
-{
64
+class LangServiceProvider extends ServiceProvider {
66 65
     /**
67 66
      * {@inheritdoc}
68 67
      */
69 68
     public function register(): void
70 69
     {
71
-        $this->app->bind(Configuration::class, function (ContainerInterface $app) {
70
+        $this->app->bind(Configuration::class, function (ContainerInterface $app) {
72 71
             return new Configuration($app->get(Config::class)->get('lang', []));
73 72
         });
74 73
         $this->app->share(StorageInterface::class, MemoryStorage::class);
Please login to merge, or discard this patch.
src/Service/ServiceProvider.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -57,8 +57,7 @@  discard block
 block discarded – undo
57 57
  * @class ServiceProvider
58 58
  * @package Platine\Framework\Service
59 59
  */
60
-class ServiceProvider
61
-{
60
+class ServiceProvider {
62 61
     /**
63 62
      * The Application instance
64 63
      * @var Application
@@ -81,8 +80,7 @@  discard block
 block discarded – undo
81 80
      * Create new instance
82 81
      * @param Application $app
83 82
      */
84
-    public function __construct(Application $app)
85
-    {
83
+    public function __construct(Application $app) {
86 84
         $this->app = $app;
87 85
     }
88 86
 
Please login to merge, or discard this patch.
src/Config/AppDatabaseConfig.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -128,10 +128,10 @@
 block discarded – undo
128 128
         $name = $results['key'];
129 129
 
130 130
         $config = $this->loader->loadConfig([
131
-             'name' => $name,
132
-             'module' => $module,
133
-             'env' => $this->env
134
-         ]);
131
+                'name' => $name,
132
+                'module' => $module,
133
+                'env' => $this->env
134
+            ]);
135 135
 
136 136
         if ($config === null) {
137 137
             $this->loader->insertConfig([
Please login to merge, or discard this patch.
Braces   +13 added lines, -21 removed lines patch added patch discarded remove patch
@@ -57,8 +57,7 @@  discard block
 block discarded – undo
57 57
  * @template TDbConfigurationEntity as \Platine\Framework\Config\Model\Configuration
58 58
  * @implements ArrayAccess<string, mixed>
59 59
  */
60
-class AppDatabaseConfig implements ArrayAccess
61
-{
60
+class AppDatabaseConfig implements ArrayAccess {
62 61
     /**
63 62
      * The configuration loader to use
64 63
      * @var DatabaseConfigLoaderInterface<TDbConfigurationEntity>
@@ -82,8 +81,7 @@  discard block
 block discarded – undo
82 81
      * @param DatabaseConfigLoaderInterface<TDbConfigurationEntity> $loader the loader to use
83 82
      * @param string          $env    the name of the environment
84 83
      */
85
-    public function __construct(DatabaseConfigLoaderInterface $loader, string $env = '')
86
-    {
84
+    public function __construct(DatabaseConfigLoaderInterface $loader, string $env = '') {
87 85
         $this->loader = $loader;
88 86
         $this->env = $env;
89 87
     }
@@ -105,8 +103,7 @@  discard block
 block discarded – undo
105 103
      * not find the configuration item
106 104
      * @return mixed
107 105
      */
108
-    public function get(string $key, $default = null)
109
-    {
106
+    public function get(string $key, $default = null) {
110 107
         $results = $this->parseKey($key);
111 108
         $group = $results['group'];
112 109
 
@@ -133,7 +130,7 @@  discard block
 block discarded – undo
133 130
              'env' => $this->env
134 131
          ]);
135 132
 
136
-        if ($config === null) {
133
+        if ($config === null) {
137 134
             $this->loader->insertConfig([
138 135
                 'env' => $this->env,
139 136
                 'module' => $module,
@@ -142,7 +139,7 @@  discard block
 block discarded – undo
142 139
                 'value' => $this->getFormattedConfigValue($value),
143 140
                 'type' => gettype($value)
144 141
             ]);
145
-        } else {
142
+        } else {
146 143
             $config->value = $this->getFormattedConfigValue($value);
147 144
             $config->type = gettype($value);
148 145
 
@@ -215,16 +212,14 @@  discard block
 block discarded – undo
215 212
     /**
216 213
      * {@inheritdoc}
217 214
      */
218
-    public function offsetExists($key)
219
-    {
215
+    public function offsetExists($key) {
220 216
         return $this->has($key);
221 217
     }
222 218
 
223 219
     /**
224 220
      * {@inheritdoc}
225 221
      */
226
-    public function offsetGet($key)
227
-    {
222
+    public function offsetGet($key) {
228 223
         return $this->get($key);
229 224
     }
230 225
 
@@ -234,16 +229,14 @@  discard block
 block discarded – undo
234 229
      * @param mixed $value
235 230
      * @return void
236 231
      */
237
-    public function offsetSet($key, $value)
238
-    {
232
+    public function offsetSet($key, $value) {
239 233
         $this->set($key, $value);
240 234
     }
241 235
 
242 236
     /**
243 237
      * {@inheritdoc}
244 238
      */
245
-    public function offsetUnset($key)
246
-    {
239
+    public function offsetUnset($key) {
247 240
         $this->set($key, null);
248 241
     }
249 242
 
@@ -257,7 +250,7 @@  discard block
 block discarded – undo
257 250
         // If we've already loaded this collection, we will just bail out since we do
258 251
         // not want to load it again. Once items are loaded a first time they will
259 252
         // stay kept in memory within this class and not loaded from disk again.
260
-        if (isset($this->items[$group])) {
253
+        if (isset($this->items[$group])) {
261 254
             return;
262 255
         }
263 256
 
@@ -272,7 +265,7 @@  discard block
 block discarded – undo
272 265
      */
273 266
     protected function parseKey(string $key): array
274 267
     {
275
-        if (strpos($key, '.') === false) {
268
+        if (strpos($key, '.') === false) {
276 269
             throw new InvalidArgumentException(sprintf(
277 270
                 'Invalid configuration key [%s] must have format module.name',
278 271
                 $key
@@ -292,9 +285,8 @@  discard block
 block discarded – undo
292 285
      * @param mixed $value
293 286
      * @return mixed
294 287
      */
295
-    protected function getFormattedConfigValue($value)
296
-    {
297
-        if (is_array($value) || is_object($value)) {
288
+    protected function getFormattedConfigValue($value) {
289
+        if (is_array($value) || is_object($value)) {
298 290
             return serialize($value);
299 291
         }
300 292
 
Please login to merge, or discard this patch.
src/Config/DatabaseConfigLoader.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -128,7 +128,7 @@
 block discarded – undo
128 128
                                 ->query()
129 129
                                 ->where('module')->is($group)
130 130
                                 ->where('status')->is('Y')
131
-                                ->where(function (WhereStatement $where) use ($env) {
131
+                                ->where(function(WhereStatement $where) use ($env) {
132 132
                                     $where->where('env')->is($env)
133 133
                                     ->orWhere('env')->isNull();
134 134
                                 });
Please login to merge, or discard this patch.
Braces   +6 added lines, -9 removed lines patch added patch discarded remove patch
@@ -56,8 +56,7 @@  discard block
 block discarded – undo
56 56
  * @package Platine\Framework\Config
57 57
  * @implements DatabaseConfigLoaderInterface<Configuration>
58 58
  */
59
-class DatabaseConfigLoader implements DatabaseConfigLoaderInterface
60
-{
59
+class DatabaseConfigLoader implements DatabaseConfigLoaderInterface {
61 60
     /**
62 61
      * The Repository instance
63 62
      * @var ConfigurationRepositoryInterface<Configuration>
@@ -69,8 +68,7 @@  discard block
 block discarded – undo
69 68
      * Create new instance
70 69
      * @param ConfigurationRepositoryInterface<Configuration> $repository
71 70
      */
72
-    public function __construct(ConfigurationRepositoryInterface $repository)
73
-    {
71
+    public function __construct(ConfigurationRepositoryInterface $repository) {
74 72
         $this->repository = $repository;
75 73
     }
76 74
 
@@ -93,8 +91,7 @@  discard block
 block discarded – undo
93 91
     /**
94 92
      * {@inheritdoc}
95 93
      */
96
-    public function insertConfig(array $data)
97
-    {
94
+    public function insertConfig(array $data) {
98 95
         $entity = $this->repository->create($data);
99 96
         return $this->repository->insert($entity);
100 97
     }
@@ -128,7 +125,7 @@  discard block
 block discarded – undo
128 125
                                 ->query()
129 126
                                 ->where('module')->is($group)
130 127
                                 ->where('status')->is('Y')
131
-                                ->where(function (WhereStatement $where) use ($env) {
128
+                                ->where(function (WhereStatement $where) use ($env) {
132 129
                                     $where->where('env')->is($env)
133 130
                                     ->orWhere('env')->isNull();
134 131
                                 });
@@ -138,10 +135,10 @@  discard block
 block discarded – undo
138 135
         $results = $query->all();
139 136
 
140 137
         $items = [];
141
-        foreach ($results as $result) {
138
+        foreach ($results as $result) {
142 139
             /** @var string $name */
143 140
             $name = $result->name;
144
-            if (!empty($name)) {
141
+            if (!empty($name)) {
145 142
                 $items[$name] = ConfigUtil::convertToDataType(
146 143
                     $result->value,
147 144
                     (string) $result->type
Please login to merge, or discard this patch.
src/Config/Model/Configuration.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -71,19 +71,19 @@
 block discarded – undo
71 71
             'updated_at' => '?date',
72 72
         ]);
73 73
 
74
-        $mapper->filter('status', function (Query $q, $value) {
74
+        $mapper->filter('status', function(Query $q, $value) {
75 75
             $q->where('status')->is($value);
76 76
         });
77 77
 
78
-        $mapper->filter('env', function (Query $q, $value) {
78
+        $mapper->filter('env', function(Query $q, $value) {
79 79
             $q->where('env')->is($value);
80 80
         });
81 81
 
82
-        $mapper->filter('module', function (Query $q, $value) {
82
+        $mapper->filter('module', function(Query $q, $value) {
83 83
             $q->where('module')->is($value);
84 84
         });
85 85
 
86
-        $mapper->filter('type', function (Query $q, $value) {
86
+        $mapper->filter('type', function(Query $q, $value) {
87 87
             $q->where('type')->is($value);
88 88
         });
89 89
     }
Please login to merge, or discard this patch.
Braces   +5 added lines, -6 removed lines patch added patch discarded remove patch
@@ -56,8 +56,7 @@  discard block
 block discarded – undo
56 56
  * @package Platine\Framework\Config\Model
57 57
  * @extends Entity<Configuration>
58 58
  */
59
-class Configuration extends Entity
60
-{
59
+class Configuration extends Entity {
61 60
     /**
62 61
      *
63 62
      * @param EntityMapperInterface<Configuration> $mapper
@@ -71,19 +70,19 @@  discard block
 block discarded – undo
71 70
             'updated_at' => '?date',
72 71
         ]);
73 72
 
74
-        $mapper->filter('status', function (Query $q, $value) {
73
+        $mapper->filter('status', function (Query $q, $value) {
75 74
             $q->where('status')->is($value);
76 75
         });
77 76
 
78
-        $mapper->filter('env', function (Query $q, $value) {
77
+        $mapper->filter('env', function (Query $q, $value) {
79 78
             $q->where('env')->is($value);
80 79
         });
81 80
 
82
-        $mapper->filter('module', function (Query $q, $value) {
81
+        $mapper->filter('module', function (Query $q, $value) {
83 82
             $q->where('module')->is($value);
84 83
         });
85 84
 
86
-        $mapper->filter('type', function (Query $q, $value) {
85
+        $mapper->filter('type', function (Query $q, $value) {
87 86
             $q->where('type')->is($value);
88 87
         });
89 88
     }
Please login to merge, or discard this patch.
src/Config/Model/ConfigurationRepository.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -57,14 +57,12 @@
 block discarded – undo
57 57
  * @extends Repository<Configuration>
58 58
  * @implements ConfigurationRepositoryInterface<Configuration>
59 59
  */
60
-class ConfigurationRepository extends Repository implements ConfigurationRepositoryInterface
61
-{
60
+class ConfigurationRepository extends Repository implements ConfigurationRepositoryInterface {
62 61
     /**
63 62
      * Create new instance
64 63
      * @param EntityManager<Configuration> $manager
65 64
      */
66
-    public function __construct(EntityManager $manager)
67
-    {
65
+    public function __construct(EntityManager $manager) {
68 66
         parent::__construct($manager, Configuration::class);
69 67
     }
70 68
 }
Please login to merge, or discard this patch.
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.