Completed
Push — master ( 274f99...dca8df )
by Yaro
01:38
created
src/Jarboe/Http/Controllers/AbstractTableController.php 2 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -104,9 +104,6 @@  discard block
 block discarded – undo
104 104
      * Handle relation search action.
105 105
      * Currently used for SelectField with type `select2` and `ajax = true`.
106 106
      *
107
-     * @param string $field
108
-     * @param string $page
109
-     * @param string $term
110 107
      * @return \Illuminate\Http\JsonResponse
111 108
      */
112 109
     public function searchRelation(Request $request)
@@ -712,6 +709,9 @@  discard block
 block discarded – undo
712 709
         }
713 710
     }
714 711
 
712
+    /**
713
+     * @param string $title
714
+     */
715 715
     protected function addTab($title, array $fields)
716 716
     {
717 717
         foreach ($fields as $field) {
@@ -807,7 +807,7 @@  discard block
 block discarded – undo
807 807
     /**
808 808
      * Check if user has permission for the action.
809 809
      *
810
-     * @param $action
810
+     * @param string $action
811 811
      * @return bool
812 812
      */
813 813
     protected function can($action): bool
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 
120 120
         $query = $request->get('term');
121 121
         $fieldName = $request->get('field');
122
-        $page = (int) $request->get('page');
122
+        $page = (int)$request->get('page');
123 123
 
124 124
         /** @var Select $field */
125 125
         $field = $this->crud()->getFieldByName($fieldName);
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
                 $options = $field->getOptions($page, $perPage, $query, $total, $index);
135 135
                 array_walk($options, function(&$item, $key) use($group) {
136 136
                     $item = [
137
-                        'id'   => crc32($group['group']) .'~~~'. $key,
137
+                        'id'   => crc32($group['group']).'~~~'.$key,
138 138
                         'text' => $item,
139 139
                     ];
140 140
                 });
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
             $formRequest = new $formRequestClass();
283 283
             if (method_exists($formRequest, 'rules')) {
284 284
                 foreach ($formRequest->rules() as $param => $paramRules) {
285
-                    if (preg_match('~^'. preg_quote($name) .'(\.\*)?$~', $param)) {
285
+                    if (preg_match('~^'.preg_quote($name).'(\.\*)?$~', $param)) {
286 286
                         return [
287 287
                             $paramRules,
288 288
                             $formRequest->messages(),
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
         $this->init();
381 381
         $this->bound();
382 382
 
383
-        $this->crud()->setPerPageParam((int) $perPage);
383
+        $this->crud()->setPerPageParam((int)$perPage);
384 384
 
385 385
         return redirect($this->crud()->listUrl());
386 386
     }
@@ -882,11 +882,11 @@  discard block
 block discarded – undo
882 882
                     return $this->handleInline($request);
883 883
 
884 884
                 default:
885
-                    throw new \RuntimeException('Invalid method ' . $name);
885
+                    throw new \RuntimeException('Invalid method '.$name);
886 886
             }
887 887
         } catch (ValidationException $e) {
888 888
             throw $e;
889
-        } catch(UnauthorizedException $e) {
889
+        } catch (UnauthorizedException $e) {
890 890
             return $this->createUnauthorizedResponse($request, $e);
891 891
         } catch (\Exception $e) {
892 892
             return redirect()
@@ -962,7 +962,7 @@  discard block
 block discarded – undo
962 962
      */
963 963
     protected function notify(string $title, string $content = null, int $timeout = 4000, string $color = null, string $icon = null, string $type = 'small')
964 964
     {
965
-        $ident = 'jarboe_notifications.'. $type;
965
+        $ident = 'jarboe_notifications.'.$type;
966 966
 
967 967
         $messages = session()->get($ident, []);
968 968
         $messages[] = [
Please login to merge, or discard this patch.
src/Jarboe/Table/CRUD.php 2 patches
Doc Comments   +9 added lines patch added patch discarded remove patch
@@ -273,6 +273,9 @@  discard block
 block discarded – undo
273 273
         return sprintf('%s%s%s/force-delete', $this->baseUrl(), self::BASE_URL_DELIMITER, $id);
274 274
     }
275 275
 
276
+    /**
277
+     * @param string $identifier
278
+     */
276 279
     public function toolbarUrl($identifier)
277 280
     {
278 281
         return sprintf('%s%stoolbar/%s', $this->baseUrl(), self::BASE_URL_DELIMITER, $identifier);
@@ -325,6 +328,9 @@  discard block
 block discarded – undo
325 328
         return rtrim($chunks[0], '/');
326 329
     }
327 330
 
331
+    /**
332
+     * @param integer $ident
333
+     */
328 334
     public function tableIdentifier($ident = null)
329 335
     {
330 336
         if (is_null($ident)) {
@@ -369,6 +375,9 @@  discard block
 block discarded – undo
369 375
         $this->preferences()->saveCurrentLocale($this->tableIdentifier(), $locale);
370 376
     }
371 377
 
378
+    /**
379
+     * @return \Illuminate\Http\Request
380
+     */
372 381
     public function getTool($ident)
373 382
     {
374 383
         if (array_key_exists($ident, $this->toolbar)) {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -493,7 +493,7 @@
 block discarded – undo
493 493
 
494 494
     public function isSortableByWeight()
495 495
     {
496
-        return (bool) $this->getSortableWeightFieldName();
496
+        return (bool)$this->getSortableWeightFieldName();
497 497
     }
498 498
 
499 499
     public function isSortableByWeightActive()
Please login to merge, or discard this patch.
src/Jarboe/Table/Fields/AbstractField.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -40,6 +40,9 @@
 block discarded – undo
40 40
         return $field;
41 41
     }
42 42
 
43
+    /**
44
+     * @param string $model
45
+     */
43 46
     public function setModel($model)
44 47
     {
45 48
         $this->model = $model;
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
     {
167 167
         $name = $this->name();
168 168
         if ($locale) {
169
-            $name .= '.'. $locale;
169
+            $name .= '.'.$locale;
170 170
         }
171 171
 
172 172
         if ($this->hasOld($name)) {
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
     {
181 181
         $name = $this->name();
182 182
         if ($locale) {
183
-            $name .= '.'. $locale;
183
+            $name .= '.'.$locale;
184 184
         }
185 185
 
186 186
         if ($this->hasOld($name)) {
Please login to merge, or discard this patch.
src/Jarboe/Table/Fields/Traits/Storage.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -52,6 +52,9 @@
 block discarded – undo
52 52
         return $this;
53 53
     }
54 54
 
55
+    /**
56
+     * @return string
57
+     */
55 58
     public function getPath()
56 59
     {
57 60
         return $this->path;
Please login to merge, or discard this patch.
src/Jarboe/Table/Toolbar/MassDeleteTool.php 1 patch
Braces   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -5,18 +5,18 @@  discard block
 block discarded – undo
5 5
 use Illuminate\Http\Request;
6 6
 use Yaro\Jarboe\Table\CRUD;
7 7
 
8
-class MassDeleteTool extends AbstractTool
9
-{
8
+class MassDeleteTool extends AbstractTool
9
+{
10 10
     /**
11 11
      * Set CRUD object.
12 12
      *
13 13
      * @param CRUD $crud
14 14
      */
15
-    public function setCrud(CRUD $crud)
16
-    {
15
+    public function setCrud(CRUD $crud)
16
+    {
17 17
         parent::setCrud($crud);
18 18
 
19
-        if ($this->check()) {
19
+        if ($this->check()) {
20 20
             $this->crud()->enableBatchCheckboxes(true);
21 21
         }
22 22
     }
@@ -24,8 +24,8 @@  discard block
 block discarded – undo
24 24
     /**
25 25
      * Position where should tool be placed.
26 26
      */
27
-    public function position()
28
-    {
27
+    public function position()
28
+    {
29 29
         return self::POSITION_BODY_TOP;
30 30
     }
31 31
 
@@ -40,8 +40,8 @@  discard block
 block discarded – undo
40 40
     /**
41 41
      * Tool's view.
42 42
      */
43
-    public function render()
44
-    {
43
+    public function render()
44
+    {
45 45
         return view('jarboe::crud.toolbar.mass_delete', [
46 46
             'tool' => $this,
47 47
             'crud' => $this->crud(),
@@ -55,24 +55,24 @@  discard block
 block discarded – undo
55 55
      *
56 56
      * @return \Illuminate\Http\JsonResponse
57 57
      */
58
-    public function handle(Request $request)
59
-    {
58
+    public function handle(Request $request)
59
+    {
60 60
         $errors = [];
61 61
         $hidden = [];
62 62
         $removed = [];
63
-        foreach ($request->get('ids') as $id) {
64
-            try {
65
-                if (!$this->crud()->repo()->delete($id)) {
63
+        foreach ($request->get('ids') as $id) {
64
+            try {
65
+                if (!$this->crud()->repo()->delete($id)) {
66 66
                     throw new \Exception(__('jarboe::toolbar.mass_delete.delete_event_failed'));
67 67
                 }
68 68
 
69
-                try {
69
+                try {
70 70
                     $this->crud()->repo()->find($id);
71 71
                     $hidden[] = $id;
72
-                } catch (\Exception $e) {
72
+                } catch (\Exception $e) {
73 73
                     $removed[] = $id;
74 74
                 }
75
-            } catch (\Exception $e) {
75
+            } catch (\Exception $e) {
76 76
                 $errors[$id] = $e->getMessage();
77 77
             }
78 78
         }
Please login to merge, or discard this patch.
src/Jarboe/Table/Filters/TextFilter.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
                 $query->where(
43 43
                     $this->field()->getRelationTitleField(),
44 44
                     $sign,
45
-                    $leftPart . $value . $rightPart
45
+                    $leftPart.$value.$rightPart
46 46
                 );
47 47
             });
48 48
             return;
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
         $query->where(
52 52
             $this->field->name(),
53 53
             $sign,
54
-            $leftPart . $value . $rightPart
54
+            $leftPart.$value.$rightPart
55 55
         );
56 56
     }
57 57
 }
Please login to merge, or discard this patch.
src/Jarboe/Table/Filters/DateFilter.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
             $view .= '_range';
26 26
         }
27 27
 
28
-        return view('jarboe::crud.filters.'. $view, [
28
+        return view('jarboe::crud.filters.'.$view, [
29 29
             'filter' => $this,
30 30
         ])->render();
31 31
     }
@@ -38,10 +38,10 @@  discard block
 block discarded – undo
38 38
         }
39 39
 
40 40
         if ($this->isRange()) {
41
-            $model->when($value['from'] ?? null, function ($query, $value) {
41
+            $model->when($value['from'] ?? null, function($query, $value) {
42 42
                 return $query->whereDate($this->field()->name(), '>=', $value);
43 43
             });
44
-            $model->when($value['to'] ?? null, function ($query, $value) {
44
+            $model->when($value['to'] ?? null, function($query, $value) {
45 45
                 return $query->whereDate($this->field()->name(), '<=', $value);
46 46
             });
47 47
             return;
Please login to merge, or discard this patch.
src/Jarboe/Table/Filters/NumberFilter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@
 block discarded – undo
40 40
         $model->where(
41 41
             $this->field()->name(),
42 42
             $sign,
43
-            $leftPart . $this->value() . $rightPart
43
+            $leftPart.$this->value().$rightPart
44 44
         );
45 45
     }
46 46
 }
47 47
\ No newline at end of file
Please login to merge, or discard this patch.
src/Jarboe/Table/Filters/TextareaFilter.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
                 $query->where(
44 44
                     $this->field()->getRelationTitleField(),
45 45
                     $sign,
46
-                    $leftPart . $value . $rightPart
46
+                    $leftPart.$value.$rightPart
47 47
                 );
48 48
             });
49 49
             return;
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
         $query->where(
53 53
             $this->field()->name(),
54 54
             $sign,
55
-            $leftPart . $value . $rightPart
55
+            $leftPart.$value.$rightPart
56 56
         );
57 57
     }
58 58
 }
59 59
\ No newline at end of file
Please login to merge, or discard this patch.