Completed
Branch master (1438b4)
by Nils
07:06
created
src/OpenSkill/Datatable/Columns/ColumnOrder.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
     }
32 32
 
33 33
     /**
34
-     * @return bool
34
+     * @return string
35 35
      */
36 36
     public function isAscending()
37 37
     {
Please login to merge, or discard this patch.
src/OpenSkill/Datatable/Datatable.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,6 @@
 block discarded – undo
7 7
 use OpenSkill\Datatable\Providers\Provider;
8 8
 use OpenSkill\Datatable\Versions\VersionEngine;
9 9
 use OpenSkill\Datatable\Views\DatatableView;
10
-use Symfony\Component\VarDumper\Cloner\Data;
11 10
 
12 11
 /**
13 12
  * Class Datatable
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -55,6 +55,6 @@
 block discarded – undo
55 55
      * @return DatatableView the view to work with
56 56
      */
57 57
     public function view($view = null) {
58
-       return new DatatableView($view, $this->versionEngine->getVersion());
58
+        return new DatatableView($view, $this->versionEngine->getVersion());
59 59
     }
60 60
 }
61 61
\ No newline at end of file
Please login to merge, or discard this patch.
src/OpenSkill/Datatable/Queries/Parser/QueryParser.php 1 patch
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -2,11 +2,9 @@
 block discarded – undo
2 2
 
3 3
 namespace OpenSkill\Datatable\Queries\Parser;
4 4
 
5
-use Illuminate\Http\JsonResponse;
6 5
 use Illuminate\Http\Request;
7 6
 use OpenSkill\Datatable\Columns\ColumnConfiguration;
8 7
 use OpenSkill\Datatable\Queries\QueryConfiguration;
9
-use Symfony\Component\HttpFoundation\Response;
10 8
 
11 9
 /**
12 10
  * Interface DTQueryParser
Please login to merge, or discard this patch.
src/OpenSkill/Datatable/Responses/Datatable19ResponseCreator.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
      * @param ResponseData $data The processed data.
16 16
      * @param QueryConfiguration $queryConfiguration the query configuration for the current request.
17 17
      * @param array $columnConfiguration the column configurations for the current data table.
18
-     * @return Response the response that should be returned to the client.
18
+     * @return JsonResponse the response that should be returned to the client.
19 19
      */
20 20
     public function createResponse(ResponseData $data, QueryConfiguration $queryConfiguration, array $columnConfiguration)
21 21
     {
Please login to merge, or discard this patch.
src/OpenSkill/Datatable/Views/DatatableView.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
      * DatatableView constructor, will take a view as a string if a custom one should be used. will also take the
23 23
      * column configurations to provide out of the box headers for the view.
24 24
      * If no columns are given the user must provide them before building the view.
25
-     * @param array $columnConfiguration The columnConfiguration of the the server side if available
25
+     * @param string|null $columnConfiguration The columnConfiguration of the the server side if available
26 26
      * @param Version $version The version that supports the current request
27 27
      * @param string $view the name of the view that should be rendered
28 28
      */
Please login to merge, or discard this 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
      * Will render the table
44 44
      */
45 45
     public function table() {
46
-        if(empty($this->columnConfigurations)) {
46
+        if (empty($this->columnConfigurations)) {
47 47
             throw new \InvalidArgumentException("There are no columns defined");
48 48
         }
49 49
     }
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
      * Will render the javascript for the table
53 53
      */
54 54
     public function script() {
55
-        if(empty($this->columnConfigurations)) {
55
+        if (empty($this->columnConfigurations)) {
56 56
             throw new \InvalidArgumentException("There are no columns defined");
57 57
         }
58 58
     }
Please login to merge, or discard this patch.
src/OpenSkill/Datatable/DatatableServiceProvider.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@
 block discarded – undo
30 30
 
31 31
         $this->app->tag(['DT19Version', 'dt.default.version'], 'dt.query.versions');
32 32
 
33
-        $this->app->singleton("datatable", function (Application $app) {
33
+        $this->app->singleton("datatable", function(Application $app) {
34 34
             return new Datatable(
35 35
                 $app->make('request'),
36 36
                 new VersionEngine($app->tagged('dt.query.versions'))
Please login to merge, or discard this patch.
src/OpenSkill/Datatable/Providers/CollectionProvider.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
         $this->collection = $collection;
56 56
         $this->totalInitialDataCount = $collection->count();
57 57
         // define search functions
58
-        $this->globalSearchFunction = function ($data, $search) {
58
+        $this->globalSearchFunction = function($data, $search) {
59 59
             foreach ($data as $item) {
60 60
                 if (str_contains(mb_strtolower($item), mb_strtolower($search))) {
61 61
                     return true;
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
         // generate a custom search function for each column
83 83
         foreach ($this->columnConfiguration as $col) {
84 84
             if (!array_key_exists($col->getName(), $this->columnSearchFunction)) {
85
-                $this->columnSearchFunction[$col->getName()] = function ($data, ColumnSearch $search) use ($col) {
85
+                $this->columnSearchFunction[$col->getName()] = function($data, ColumnSearch $search) use ($col) {
86 86
                     if (str_contains(mb_strtolower($data[$col->getName()]), mb_strtolower($search->searchValue()))) {
87 87
                         return true;
88 88
                     }
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
             $searchFunc = $this->globalSearchFunction;
138 138
         }
139 139
 
140
-        $this->collection->transform(function ($data) use ($columnConfiguration, $searchFunc) {
140
+        $this->collection->transform(function($data) use ($columnConfiguration, $searchFunc) {
141 141
             $entry = [];
142 142
             // for each column call the callback
143 143
             foreach ($columnConfiguration as $i => $col) {
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
             return $entry;
162 162
         });
163 163
 
164
-        $this->collection = $this->collection->reject(function ($data) {
164
+        $this->collection = $this->collection->reject(function($data) {
165 165
             if (empty($data)) {
166 166
                 return true;
167 167
             } else {
@@ -203,10 +203,10 @@  discard block
 block discarded – undo
203 203
     {
204 204
         if ($this->queryConfiguration->hasOrderColumn()) {
205 205
             $order = $this->queryConfiguration->orderColumns()[0];
206
-            $this->collection->sort(function ($first, $second) use ($order) {
206
+            $this->collection->sort(function($first, $second) use ($order) {
207 207
                 return strnatcmp($first[$order->columnName()], $second[$order->columnName()]);
208 208
             });
209
-            if(!$order->isAscending()) {
209
+            if (!$order->isAscending()) {
210 210
                 $this->collection->reverse();
211 211
             }
212 212
         }
Please login to merge, or discard this patch.
src/OpenSkill/Datatable/Columns/ColumnConfigurationBuilder.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -143,7 +143,7 @@
 block discarded – undo
143 143
     {
144 144
         if (is_null($this->callable) || !is_callable($this->callable)) {
145 145
             $self = $this;
146
-            $this->callable = function ($data) use (&$self) {
146
+            $this->callable = function($data) use (&$self) {
147 147
                 $name = $self->name;
148 148
 
149 149
                 if (is_array($data) && array_key_exists($name, $data)) {
Please login to merge, or discard this patch.
src/OpenSkill/Datatable/Composers/ColumnComposer.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@
 block discarded – undo
96 96
         if (!is_null($callable)) {
97 97
             if (is_callable($callable)) {
98 98
                 $config->withCallable($callable);
99
-            } elseif (is_string($callable)){
99
+            } elseif (is_string($callable)) {
100 100
                 $config->withCallable(function($data) use ($callable) { return $callable; });
101 101
             }
102 102
         }
Please login to merge, or discard this patch.