Failed Conditions
Branch master (436403)
by Sherif
31s
created
src/Modules/Core/BaseClasses/Contracts/BaseRepositoryInterface.php 1 patch
Indentation   +109 added lines, -109 removed lines patch added patch discarded remove patch
@@ -8,138 +8,138 @@
 block discarded – undo
8 8
 
9 9
 interface BaseRepositoryInterface
10 10
 {
11
-  /**
12
-   * Fetch all records with relations from the storage.
13
-   *
14
-   * @param  array  $relations
15
-   * @param  string $sortBy
16
-   * @param  bool   $desc
17
-   * @param  array  $columns
18
-   * @return collection
19
-   */
11
+    /**
12
+     * Fetch all records with relations from the storage.
13
+     *
14
+     * @param  array  $relations
15
+     * @param  string $sortBy
16
+     * @param  bool   $desc
17
+     * @param  array  $columns
18
+     * @return collection
19
+     */
20 20
     public function all(array $relations = [], string $sortBy = 'created_at', bool $desc = true, array $columns = ['*']): Collection;
21 21
 
22
-  /**
23
-   * Fetch all records with relations from storage in pages.
24
-   *
25
-   * @param  int    $perPage
26
-   * @param  array  $relations
27
-   * @param  string $sortBy
28
-   * @param  bool   $desc
29
-   * @param  array  $columns
30
-   * @return LengthAwarePaginator
31
-   */
22
+    /**
23
+     * Fetch all records with relations from storage in pages.
24
+     *
25
+     * @param  int    $perPage
26
+     * @param  array  $relations
27
+     * @param  string $sortBy
28
+     * @param  bool   $desc
29
+     * @param  array  $columns
30
+     * @return LengthAwarePaginator
31
+     */
32 32
     public function paginate(int $perPage = 15, array $relations = [], string $sortBy = 'created_at', bool $desc = true, array $columns = ['*']): LengthAwarePaginator;
33 33
 
34
-  /**
35
-   * Fetch all records with relations based on
36
-   * the given condition from storage in pages.
37
-   *
38
-   * @param  array   $conditions array of conditions
39
-   * @param  integer $perPage
40
-   * @param  array   $relations
41
-   * @param  array   $sortBy
42
-   * @param  array   $desc
43
-   * @param  array   $columns
44
-   * @return collection
45
-   */
34
+    /**
35
+     * Fetch all records with relations based on
36
+     * the given condition from storage in pages.
37
+     *
38
+     * @param  array   $conditions array of conditions
39
+     * @param  integer $perPage
40
+     * @param  array   $relations
41
+     * @param  array   $sortBy
42
+     * @param  array   $desc
43
+     * @param  array   $columns
44
+     * @return collection
45
+     */
46 46
     public function paginateBy(array $conditions, int $perPage = 15, array $relations = [], string $sortBy = 'created_at', bool $desc = true, array $columns = ['*']): LengthAwarePaginator;
47 47
 
48
-  /**
49
-   * Count all records based on the given condition from storage.
50
-   *
51
-   * @param  array $conditions array of conditions
52
-   * @return int
53
-   */
48
+    /**
49
+     * Count all records based on the given condition from storage.
50
+     *
51
+     * @param  array $conditions array of conditions
52
+     * @return int
53
+     */
54 54
     public function count(array $conditions = []): int;
55 55
 
56
-  /**
57
-   * Pluck column based on the given condition from storage.
58
-   *
59
-   * @param  array  $conditions array of conditions
60
-   * @param  string $column
61
-   * @return collection
62
-   */
56
+    /**
57
+     * Pluck column based on the given condition from storage.
58
+     *
59
+     * @param  array  $conditions array of conditions
60
+     * @param  string $column
61
+     * @return collection
62
+     */
63 63
     public function pluck(array $conditions, string $column): Collection;
64 64
 
65
-  /**
66
-   * Save the given model to the storage.
67
-   *
68
-   * @param  array $data
69
-   * @return Model
70
-   */
65
+    /**
66
+     * Save the given model to the storage.
67
+     *
68
+     * @param  array $data
69
+     * @return Model
70
+     */
71 71
     public function save(array $data): Model;
72 72
 
73
-  /**
74
-   * Insert the given model/models to the storage.
75
-   *
76
-   * @param  array $data
77
-   * @return bool
78
-   */
73
+    /**
74
+     * Insert the given model/models to the storage.
75
+     *
76
+     * @param  array $data
77
+     * @return bool
78
+     */
79 79
     public function insert(array $data): bool;
80 80
 
81
-  /**
82
-   * Delete record from the storage based on the given
83
-   * condition.
84
-   *
85
-   * @param  string $value condition value
86
-   * @param  string $attribute condition column name
87
-   * @return bool
88
-   */
81
+    /**
82
+     * Delete record from the storage based on the given
83
+     * condition.
84
+     *
85
+     * @param  string $value condition value
86
+     * @param  string $attribute condition column name
87
+     * @return bool
88
+     */
89 89
     public function delete(string $value, string $attribute = 'id'): bool;
90 90
 
91
-  /**
92
-   * Fetch records from the storage based on the given
93
-   * id.
94
-   *
95
-   * @param  int   $id
96
-   * @param  array $relations
97
-   * @param  array $columns
98
-   * @return Model
99
-   */
91
+    /**
92
+     * Fetch records from the storage based on the given
93
+     * id.
94
+     *
95
+     * @param  int   $id
96
+     * @param  array $relations
97
+     * @param  array $columns
98
+     * @return Model
99
+     */
100 100
     public function find(int $id, array $relations = [], array $columns = ['*']): Model;
101 101
 
102
-  /**
103
-   * Fetch records from the storage based on the given
104
-   * condition.
105
-   *
106
-   * @param  array   $conditions array of conditions
107
-   * @param  array   $relations
108
-   * @param  string  $sortBy
109
-   * @param  bool    $desc
110
-   * @param  array   $columns
111
-   * @return collection
112
-   */
102
+    /**
103
+     * Fetch records from the storage based on the given
104
+     * condition.
105
+     *
106
+     * @param  array   $conditions array of conditions
107
+     * @param  array   $relations
108
+     * @param  string  $sortBy
109
+     * @param  bool    $desc
110
+     * @param  array   $columns
111
+     * @return collection
112
+     */
113 113
     public function findBy(array $conditions, array $relations = [], string $sortBy = 'created_at', bool $desc = true, array $columns = ['*']): Collection;
114 114
 
115
-  /**
116
-   * Fetch the first record fro the storage based on the given
117
-   * condition.
118
-   *
119
-   * @param  array $conditions array of conditions
120
-   * @param  array $relations
121
-   * @param  array $columns
122
-   * @return Model
123
-   */
115
+    /**
116
+     * Fetch the first record fro the storage based on the given
117
+     * condition.
118
+     *
119
+     * @param  array $conditions array of conditions
120
+     * @param  array $relations
121
+     * @param  array $columns
122
+     * @return Model
123
+     */
124 124
     public function first(array $conditions, array $relations = [], array $columns = ['*']): Model;
125 125
 
126
-  /**
127
-   * Return the deleted models in pages based on the given conditions.
128
-   *
129
-   * @param  array  $conditions array of conditions
130
-   * @param  int    $perPage
131
-   * @param  string $sortBy
132
-   * @param  bool   $desc
133
-   * @param  array  $columns
134
-   * @return LengthAwarePaginator
135
-   */
126
+    /**
127
+     * Return the deleted models in pages based on the given conditions.
128
+     *
129
+     * @param  array  $conditions array of conditions
130
+     * @param  int    $perPage
131
+     * @param  string $sortBy
132
+     * @param  bool   $desc
133
+     * @param  array  $columns
134
+     * @return LengthAwarePaginator
135
+     */
136 136
     public function deleted(array $conditions, int $perPage = 15, string $sortBy = 'created_at', bool $desc = true, array $columns = ['*']): LengthAwarePaginator;
137 137
 
138
-  /**
139
-   * Restore the deleted model.
140
-   *
141
-   * @param  int $id
142
-   * @return bool
143
-   */
138
+    /**
139
+     * Restore the deleted model.
140
+     *
141
+     * @param  int $id
142
+     * @return bool
143
+     */
144 144
     public function restore(int $id): bool;
145 145
 }
Please login to merge, or discard this patch.
src/Modules/Core/BaseClasses/BaseEnum.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@
 block discarded – undo
55 55
     {
56 56
         $stringArr = [];
57 57
         collect(self::all())->each(function ($item, $key) use (&$stringArr) {
58
-            $stringArr[] = $key . ': ' . $item;
58
+            $stringArr[] = $key.': '.$item;
59 59
         });
60 60
 
61 61
         return implode(',', $stringArr);
Please login to merge, or discard this patch.
src/Modules/Core/BaseClasses/BaseRepository.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
         $model = $this->model->onlyTrashed()->find($id);
249 249
 
250 250
         if (!$model) {
251
-            Errors::notFound(class_basename($this->model) . ' with id : ' . $id);
251
+            Errors::notFound(class_basename($this->model).' with id : '.$id);
252 252
         }
253 253
 
254 254
         $model->restore();
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
         $model = Arr::has($data, 'id') ? $modelClass->lockForUpdate()->find($data['id']) : new $modelClass;
269 269
 
270 270
         if (!$model) {
271
-            Errors::notFound(class_basename($modelClass) . ' with id : ' . $data['id']);
271
+            Errors::notFound(class_basename($modelClass).' with id : '.$data['id']);
272 272
         }
273 273
 
274 274
         foreach ($data as $key => $value) {
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
         }
332 332
 
333 333
         if (!$relatedModel) {
334
-            Errors::notFound(class_basename($relationBaseModel) . ' with id : ' . $relatedModelData['id']);
334
+            Errors::notFound(class_basename($relationBaseModel).' with id : '.$relatedModelData['id']);
335 335
         }
336 336
 
337 337
         if (is_array($relatedModelData)) {
@@ -401,11 +401,11 @@  discard block
 block discarded – undo
401 401
 
402 402
             if ($key == 'and') {
403 403
                 $conditions       = $this->constructConditions($value, $model);
404
-                $conditionString .= str_replace('{op}', 'and', $conditions['conditionString']) . ' {op} ';
404
+                $conditionString .= str_replace('{op}', 'and', $conditions['conditionString']).' {op} ';
405 405
                 $conditionValues  = array_merge($conditionValues, $conditions['conditionValues']);
406 406
             } elseif ($key == 'or') {
407 407
                 $conditions       = $this->constructConditions($value, $model);
408
-                $conditionString .= str_replace('{op}', 'or', $conditions['conditionString']) . ' {op} ';
408
+                $conditionString .= str_replace('{op}', 'or', $conditions['conditionString']).' {op} ';
409 409
                 $conditionValues  = array_merge($conditionValues, $conditions['conditionValues']);
410 410
             } else {
411 411
                 if (is_array($value)) {
@@ -421,38 +421,38 @@  discard block
 block discarded – undo
421 421
                 }
422 422
 
423 423
                 if (strtolower($operator) == 'between') {
424
-                    $conditionString  .= $key . ' >= ? and ';
424
+                    $conditionString  .= $key.' >= ? and ';
425 425
                     $conditionValues[] = $value1;
426 426
 
427
-                    $conditionString  .= $key . ' <= ? {op} ';
427
+                    $conditionString  .= $key.' <= ? {op} ';
428 428
                     $conditionValues[] = $value2;
429 429
                 } elseif (strtolower($operator) == 'in') {
430 430
                     $conditionValues  = array_merge($conditionValues, $value);
431 431
                     $inBindingsString = rtrim(str_repeat('?,', count($value)), ',');
432
-                    $conditionString .= $key . ' in (' . rtrim($inBindingsString, ',') . ') {op} ';
432
+                    $conditionString .= $key.' in ('.rtrim($inBindingsString, ',').') {op} ';
433 433
                 } elseif (strtolower($operator) == 'null') {
434
-                    $conditionString .= $key . ' is null {op} ';
434
+                    $conditionString .= $key.' is null {op} ';
435 435
                 } elseif (strtolower($operator) == 'not null') {
436
-                    $conditionString .= $key . ' is not null {op} ';
436
+                    $conditionString .= $key.' is not null {op} ';
437 437
                 } elseif (strtolower($operator) == 'has') {
438 438
                     $sql              = $model->withTrashed()->withoutGlobalScopes()->has($key)->toSql();
439 439
                     $bindings         = $model->withTrashed()->withoutGlobalScopes()->has($key)->getBindings();
440 440
                     if ($value) {
441 441
                         $conditions       = $this->constructConditions($value, $model->$key()->getRelated());
442
-                        $conditionString .= substr(substr($sql, strpos($sql, 'exists')), 0, -1) . ' and ' . $conditions['conditionString'] . ') {op} ';
442
+                        $conditionString .= substr(substr($sql, strpos($sql, 'exists')), 0, -1).' and '.$conditions['conditionString'].') {op} ';
443 443
                         $conditionValues  = array_merge($conditionValues, $bindings);
444 444
                         $conditionValues  = array_merge($conditionValues, $conditions['conditionValues']);
445 445
                     } else {
446
-                        $conditionString .= substr(substr($sql, strpos($sql, 'exists')), 0, -1) . ') {op} ';
446
+                        $conditionString .= substr(substr($sql, strpos($sql, 'exists')), 0, -1).') {op} ';
447 447
                         $conditionValues  = array_merge($conditionValues, $bindings);
448 448
                     }
449 449
                 } else {
450
-                    $conditionString  .= $key . ' ' . $operator . ' ? {op} ';
450
+                    $conditionString  .= $key.' '.$operator.' ? {op} ';
451 451
                     $conditionValues[] = $value;
452 452
                 }
453 453
             }
454 454
         }
455
-        $conditionString = '(' . rtrim($conditionString, '{op} ') . ')';
455
+        $conditionString = '('.rtrim($conditionString, '{op} ').')';
456 456
         return ['conditionString' => $conditionString, 'conditionValues' => $conditionValues];
457 457
     }
458 458
 
@@ -469,9 +469,9 @@  discard block
 block discarded – undo
469 469
         $path       = explode('->', $value);
470 470
         $field      = array_shift($path);
471 471
         $result     = sprintf('%s->\'$.%s\'', $field, collect($path)->map(function ($part) {
472
-            return '"' . $part . '"';
472
+            return '"'.$part.'"';
473 473
         })->implode('.'));
474 474
 
475
-        return $removeLast === false ? $result : $result . ')';
475
+        return $removeLast === false ? $result : $result.')';
476 476
     }
477 477
 }
Please login to merge, or discard this patch.
src/Modules/Users/Proxy/LoginProxy.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@
 block discarded – undo
51 51
 
52 52
         $response = \ApiConsumer::post('/oauth/token', $data);
53 53
 
54
-        if (! $response->isSuccessful()) {
54
+        if (!$response->isSuccessful()) {
55 55
             if ($grantType == 'refresh_token') {
56 56
                 \Errors::invalidRefreshToken();
57 57
             }
Please login to merge, or discard this patch.
src/Modules/Users/Repositories/UserRepository.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
      */
27 27
     public function detachRoles(mixed $user): bool
28 28
     {
29
-        $user = ! filter_var($user, FILTER_VALIDATE_INT) ? $user : $this->find($user);
29
+        $user = !filter_var($user, FILTER_VALIDATE_INT) ? $user : $this->find($user);
30 30
         $user->roles()->detach();
31 31
 
32 32
         return true;
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
      */
42 42
     public function attachRoles(mixed $user, array $roleIds): bool
43 43
     {
44
-        $user = ! filter_var($user, FILTER_VALIDATE_INT) ? $user : $this->find($user);
44
+        $user = !filter_var($user, FILTER_VALIDATE_INT) ? $user : $this->find($user);
45 45
         $user->roles()->attach($roleIds);
46 46
 
47 47
         return true;
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
      */
57 57
     public function countRoles(mixed $user, array $roles): int
58 58
     {
59
-        $user = ! filter_var($user, FILTER_VALIDATE_INT) ? $user : $this->find($user);
59
+        $user = !filter_var($user, FILTER_VALIDATE_INT) ? $user : $this->find($user);
60 60
         return $user->roles()->whereIn('name', $roles)->count();
61 61
     }
62 62
 }
Please login to merge, or discard this patch.
src/Modules/Reporting/Http/Resources/Report.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
      */
16 16
     public function toArray($request)
17 17
     {
18
-        if (! $this->resource) {
18
+        if (!$this->resource) {
19 19
             return [];
20 20
         }
21 21
 
Please login to merge, or discard this patch.
src/Modules/OauthClients/Http/Resources/OauthClient.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
      */
16 16
     public function toArray($request)
17 17
     {
18
-        if (! $this->resource) {
18
+        if (!$this->resource) {
19 19
             return [];
20 20
         }
21 21
 
Please login to merge, or discard this patch.
src/Modules/Notifications/Http/Resources/Notification.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
      */
16 16
     public function toArray($request)
17 17
     {
18
-        if (! $this->resource) {
18
+        if (!$this->resource) {
19 19
             return [];
20 20
         }
21 21
 
Please login to merge, or discard this patch.
src/Modules/Users/Http/Resources/AclUser.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
      */
16 16
     public function toArray($request)
17 17
     {
18
-        if (! $this->resource) {
18
+        if (!$this->resource) {
19 19
             return [];
20 20
         }
21 21
 
Please login to merge, or discard this patch.