Passed
Push — master ( ef2d88...898186 )
by Arthur
06:43
created
src/Foundation/Traits/Cacheable.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
         return static::$caching;
29 29
     }
30 30
 
31
-    public static function find($id, $columns = ['*'])
31
+    public static function find($id, $columns = [ '*' ])
32 32
     {
33 33
         if (static::cache()->enabled()) {
34 34
             $model = static::cache()->find($id) ?? static::recache($id);
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
         return $model;
46 46
     }
47 47
 
48
-    public static function findWithoutCache($id, $columns = ['*'])
48
+    public static function findWithoutCache($id, $columns = [ '*' ])
49 49
     {
50 50
         $model = new static();
51 51
         if (is_array($id) || $id instanceof Arrayable) {
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
         if ($model === null)
61 61
             return null;
62 62
 
63
-        if ($columns !== ['*']) {
63
+        if ($columns !== [ '*' ]) {
64 64
             return collect($model)->first($columns);
65 65
         }
66 66
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -23,8 +23,9 @@  discard block
 block discarded – undo
23 23
 
24 24
     public static function cache(): ModelCacheOOP
25 25
     {
26
-        if (!isset(static::$caching))
27
-            static::$caching = new ModelCacheOOP(static::class, get_class_property(static::class, 'secondaryCacheIndexes'), get_class_property(static::class, 'cacheTime'));
26
+        if (!isset(static::$caching)) {
27
+                    static::$caching = new ModelCacheOOP(static::class, get_class_property(static::class, 'secondaryCacheIndexes'), get_class_property(static::class, 'cacheTime'));
28
+        }
28 29
         return static::$caching;
29 30
     }
30 31
 
@@ -57,8 +58,9 @@  discard block
 block discarded – undo
57 58
 
58 59
     private static function filterFromColumns($model, $columns)
59 60
     {
60
-        if ($model === null)
61
-            return null;
61
+        if ($model === null) {
62
+                    return null;
63
+        }
62 64
 
63 65
         if ($columns !== ['*']) {
64 66
             return collect($model)->first($columns);
Please login to merge, or discard this patch.
src/Foundation/Traits/RefreshDatabase.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
         $this->artisan('cache:model:clear');
23 23
         $this->artisan('migrate:refresh');
24 24
         $this->artisan('db:seed');
25
-        $this->beforeApplicationDestroyed(function () {
25
+        $this->beforeApplicationDestroyed(function() {
26 26
             RefreshDatabaseState::$migrated = false;
27 27
         });
28 28
     }
Please login to merge, or discard this patch.
src/Foundation/Cache/ModelCacheOOP.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
     protected function eagerLoadRelations($model)
63 63
     {
64 64
         if ($model !== null)
65
-            return $model::eagerLoadRelations(array($model))[0];
65
+            return $model::eagerLoadRelations(array($model))[ 0 ];
66 66
         return null;
67 67
     }
68 68
 
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
      */
77 77
     public function getCacheName($id, string $index = 'id')
78 78
     {
79
-        return config('model.cache_prefix') . ':' . strtolower(get_short_class_name($this->model)) . ':' . $index . ':' . $id;
79
+        return config('model.cache_prefix').':'.strtolower(get_short_class_name($this->model)).':'.$index.':'.$id;
80 80
     }
81 81
 
82 82
     /**
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
     private static function deleteWithPrefix($prefix)
135 135
     {
136 136
         $redis = self::getCacheConnection();
137
-        $keyPattern = Cache::getPrefix() . $prefix . '*';
137
+        $keyPattern = Cache::getPrefix().$prefix.'*';
138 138
         $keys = $redis->keys($keyPattern);
139 139
         $redis->delete($keys);
140 140
     }
@@ -160,12 +160,12 @@  discard block
 block discarded – undo
160 160
      */
161 161
     public function clearModelCache()
162 162
     {
163
-        $pattern = config('model.cache_prefix') . ':' . strtolower(get_short_class_name($this->model));
163
+        $pattern = config('model.cache_prefix').':'.strtolower(get_short_class_name($this->model));
164 164
         self::deleteWithPrefix($pattern);
165 165
     }
166 166
 
167 167
     public function enabled(): bool
168 168
     {
169
-        return (bool)config('model.caching');
169
+        return (bool) config('model.caching');
170 170
     }
171 171
 }
Please login to merge, or discard this patch.
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -41,8 +41,9 @@  discard block
 block discarded – undo
41 41
     {
42 42
         $model = Cache::get(self::getCacheName($id));
43 43
 
44
-        if ($eagerLoad)
45
-            return $this->eagerLoadRelations($model);
44
+        if ($eagerLoad) {
45
+                    return $this->eagerLoadRelations($model);
46
+        }
46 47
 
47 48
         return $model;
48 49
     }
@@ -54,15 +55,17 @@  discard block
 block discarded – undo
54 55
         }
55 56
         $modelId = $this->findSecondaryIndex($index, $key);
56 57
 
57
-        if ($modelId === null)
58
-            return ($this->model)::where($index, $key)->first();
58
+        if ($modelId === null) {
59
+                    return ($this->model)::where($index, $key)->first();
60
+        }
59 61
         return $this->find($modelId, $eagerLoad);
60 62
     }
61 63
 
62 64
     protected function eagerLoadRelations($model)
63 65
     {
64
-        if ($model !== null)
65
-            return $model::eagerLoadRelations(array($model))[0];
66
+        if ($model !== null) {
67
+                    return $model::eagerLoadRelations(array($model))[0];
68
+        }
66 69
         return null;
67 70
     }
68 71
 
@@ -104,8 +107,9 @@  discard block
 block discarded – undo
104 107
     {
105 108
         foreach ($this->secondaryIndexes as $index) {
106 109
             $indexValue = $model->$index;
107
-            if ($indexValue !== null)
108
-                Cache::put($this->getCacheName($indexValue, $index), $model->getKey(), $this->getCacheTime());
110
+            if ($indexValue !== null) {
111
+                            Cache::put($this->getCacheName($indexValue, $index), $model->getKey(), $this->getCacheTime());
112
+            }
109 113
         }
110 114
     }
111 115
 
Please login to merge, or discard this patch.
src/Foundation/Providers/AppServiceProvider.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
         $this->app->register(\Foundation\Providers\TelescopeServiceProvider::class);
39 39
     }
40 40
 
41
-    private function registerNonTestingPackages(){
41
+    private function registerNonTestingPackages() {
42 42
         $this->app->register(\Laravel\Horizon\HorizonServiceProvider::class);
43 43
     }
44 44
 }
Please login to merge, or discard this patch.
src/Foundation/Providers/TelescopeServiceProvider.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
     public function register()
19 19
     {
20 20
         $this->app->register(\Laravel\Telescope\TelescopeServiceProvider::class);
21
-         //Telescope::night();
21
+            //Telescope::night();
22 22
 
23 23
         Telescope::filter(function (IncomingEntry $entry) {
24 24
 
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -20,11 +20,11 @@  discard block
 block discarded – undo
20 20
         $this->app->register(\Laravel\Telescope\TelescopeServiceProvider::class);
21 21
          //Telescope::night();
22 22
 
23
-        Telescope::filter(function (IncomingEntry $entry) {
23
+        Telescope::filter(function(IncomingEntry $entry) {
24 24
 
25 25
             if ($entry->type === EntryType::REQUEST
26
-                && isset($entry->content['uri'])
27
-                && str_contains($entry->content['uri'], 'horizon')) {
26
+                && isset($entry->content[ 'uri' ])
27
+                && str_contains($entry->content[ 'uri' ], 'horizon')) {
28 28
                 return false;
29 29
             }
30 30
 
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
      */
49 49
     protected function gate()
50 50
     {
51
-        Gate::define('viewTelescope', function ($user) {
51
+        Gate::define('viewTelescope', function($user) {
52 52
             return in_array($user->email, [
53 53
                 //
54 54
             ]);
Please login to merge, or discard this patch.
src/Foundation/Abstracts/Transformers/TransformerCollection.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,6 +15,6 @@
 block discarded – undo
15 15
 {
16 16
     public function serialize()
17 17
     {
18
-        return json_decode(json_encode($this->jsonSerialize()),true);
18
+        return json_decode(json_encode($this->jsonSerialize()), true);
19 19
     }
20 20
 }
Please login to merge, or discard this patch.
src/Foundation/Abstracts/Transformers/Transformer.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -26,22 +26,22 @@
 block discarded – undo
26 26
      */
27 27
     public function resolve($request = null)
28 28
     {
29
-        return array_merge(parent::resolve($request),$this->filter($this->includeRelations()));
29
+        return array_merge(parent::resolve($request), $this->filter($this->includeRelations()));
30 30
     }
31 31
 
32 32
     protected function includeRelations()
33 33
     {
34
-        $relations = [];
34
+        $relations = [ ];
35 35
         foreach ($this->relations as $relation) {
36
-            if (is_string($relation) && method_exists(static::class, 'transform' . ucfirst(strtolower($relation)))) {
37
-                $method = 'transform' . ucfirst(strtolower($relation));
36
+            if (is_string($relation) && method_exists(static::class, 'transform'.ucfirst(strtolower($relation)))) {
37
+                $method = 'transform'.ucfirst(strtolower($relation));
38 38
                 $data = $this->$method($this->resource);
39 39
                 if ($data instanceof JsonResource) {
40 40
                     $data->jsonSerialize();
41 41
                 }
42
-                $relations[strtolower($relation)] = $data;
42
+                $relations[ strtolower($relation) ] = $data;
43 43
             } else {
44
-                throw new \Exception("invalid relation or not relation_transform_method given in " . get_short_class_name(static::class));
44
+                throw new \Exception("invalid relation or not relation_transform_method given in ".get_short_class_name(static::class));
45 45
             }
46 46
 
47 47
         }
Please login to merge, or discard this patch.
src/Modules/User/Entities/User.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -40,16 +40,16 @@
 block discarded – undo
40 40
      */
41 41
     protected $table = 'users';
42 42
 
43
-    protected $with = ['roles', 'permissions'];
43
+    protected $with = [ 'roles', 'permissions' ];
44 44
 
45 45
     public $cacheTime = 60;
46 46
 
47
-    public $secondaryCacheIndexes = ['identity_id'];
47
+    public $secondaryCacheIndexes = [ 'identity_id' ];
48 48
 
49 49
     /**
50 50
      * @var array
51 51
      */
52
-    protected $guarded = [];
52
+    protected $guarded = [ ];
53 53
 
54 54
     protected $casts = [
55 55
         'email_verified' => 'bool'
Please login to merge, or discard this patch.