Completed
Branch feature-direct_component_acces... (d14e40)
by Timo
03:34
created
src/Models/DataComponents/Paginator.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -96,12 +96,12 @@
 block discarded – undo
96 96
         }
97 97
 
98 98
         return '<ul class="pagination">' .
99
-               $this->_renderListItem($this->_currentPage - 1, $this->_getFirstPageUrl(), $this->_firstPageSymbol) .
100
-               $this->_renderListItem($this->_currentPage - 1, $this->_getPreviousPageUrl(), $this->_previousPageSymbol) .
101
-               $this->_renderPageList() .
102
-               $this->_renderListItem($this->_currentPage + 1, $this->_getNextPageUrl(), $this->_nextPageSymbol) .
103
-               $this->_renderListItem($this->_currentPage + 1, $this->_getLastPageUrl(), $this->_lastPageSymbol) .
104
-               '</ul>';
99
+                $this->_renderListItem($this->_currentPage - 1, $this->_getFirstPageUrl(), $this->_firstPageSymbol) .
100
+                $this->_renderListItem($this->_currentPage - 1, $this->_getPreviousPageUrl(), $this->_previousPageSymbol) .
101
+                $this->_renderPageList() .
102
+                $this->_renderListItem($this->_currentPage + 1, $this->_getNextPageUrl(), $this->_nextPageSymbol) .
103
+                $this->_renderListItem($this->_currentPage + 1, $this->_getLastPageUrl(), $this->_lastPageSymbol) .
104
+                '</ul>';
105 105
     }
106 106
 
107 107
     /**
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
         $end = $this->_getEndPage();
180 180
 
181 181
         $pageList = '';
182
-        for ($i = $this->_getStartPage(); $i <= $end; $i ++)
182
+        for ($i = $this->_getStartPage(); $i <= $end; $i++)
183 183
         {
184 184
             $pageList .= $this->_renderListItem($i, $this->_buildPageUrl($i));
185 185
         }
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
      * @return null|string
232 232
      * @throws \RuntimeException
233 233
      */
234
-    private function _getNextPageUrl() : ?string
234
+    private function _getNextPageUrl() : ? string
235 235
     {
236 236
         if ($this->_currentPage >= $this->pageCount())
237 237
         {
Please login to merge, or discard this patch.
src/Models/DataComponent.php 1 patch
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,6 @@
 block discarded – undo
4 4
 
5 5
 use hamburgscleanest\DataTables\Facades\SessionHelper;
6 6
 use Illuminate\Database\Eloquent\Builder;
7
-use Illuminate\Http\Request;
8 7
 
9 8
 /**
10 9
  * Class DataComponent
Please login to merge, or discard this patch.
src/Models/HeaderFormatters/SortableHeader.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -112,7 +112,7 @@
 block discarded – undo
112 112
         if ($this->_showSortLink($headerAttributeName))
113 113
         {
114 114
             $header->key = '<a class="sortable-header" href="' . (\request()->url() . '?' . $this->_buildSortQuery($headerAttributeName, $direction)) . '">' .
115
-                           $header->key . ' <span class="sort-symbol">' . ($this->_sortingSymbols[$direction] ?? '') . '</span></a>';
115
+                            $header->key . ' <span class="sort-symbol">' . ($this->_sortingSymbols[$direction] ?? '') . '</span></a>';
116 116
         }
117 117
     }
118 118
 
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
      * @return string
167 167
      * @throws \RuntimeException
168 168
      */
169
-    private function _buildSortQuery(string $columnName, string &$oldDirection) : string
169
+    private function _buildSortQuery(string $columnName, string & $oldDirection) : string
170 170
     {
171 171
         $parameters = UrlHelper::queryParameters();
172 172
         if (!isset($parameters['sort']))
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
      * @param string $queryString
190 190
      * @return null|string
191 191
      */
192
-    private function _getDirectionFromQuery(string $columnName, string $queryString) : ?string
192
+    private function _getDirectionFromQuery(string $columnName, string $queryString) : ? string
193 193
     {
194 194
         $column = $columnName . self::SORTING_SEPARATOR;
195 195
         $columnPos = \mb_strpos($queryString, $column);
Please login to merge, or discard this patch.
src/Models/DataComponents/DataScout.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -120,9 +120,9 @@
 block discarded – undo
120 120
     public function render() : string
121 121
     {
122 122
         return '<form method="get" action="' . $this->_buildSearchUrl() .
123
-               '"><div class="row"><div class="col-md-10"><input name="search" class="form-control data-scout-input" placeholder="' .
124
-               $this->_placeholder . '"/></div><div class="col-md-2"><button type="submit" class="btn btn-primary">' .
125
-               $this->_buttonText . '</button></div></div></form>';
123
+                '"><div class="row"><div class="col-md-10"><input name="search" class="form-control data-scout-input" placeholder="' .
124
+                $this->_placeholder . '"/></div><div class="col-md-2"><button type="submit" class="btn btn-primary">' .
125
+                $this->_buttonText . '</button></div></div></form>';
126 126
     }
127 127
 
128 128
     /**
Please login to merge, or discard this patch.
src/DataTablesServiceProvider.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -44,35 +44,35 @@
 block discarded – undo
44 44
 
45 45
     private function _registerDataTable(): void
46 46
     {
47
-        $this->app->bind('datatable', function () {
47
+        $this->app->bind('datatable', function() {
48 48
             return new DataTable();
49 49
         });
50 50
     }
51 51
 
52 52
     private function _registerSessionHelper(): void
53 53
     {
54
-        $this->app->singleton('session_helper', function () {
54
+        $this->app->singleton('session_helper', function() {
55 55
             return new SessionHelper();
56 56
         });
57 57
     }
58 58
 
59 59
     private function _registerUrlHelper(): void
60 60
     {
61
-        $this->app->singleton('url_helper', function () {
61
+        $this->app->singleton('url_helper', function() {
62 62
             return new UrlHelper();
63 63
         });
64 64
     }
65 65
 
66 66
     private function _registerTableRenderer(): void
67 67
     {
68
-        $this->app->singleton('table_renderer', function () {
68
+        $this->app->singleton('table_renderer', function() {
69 69
             return new TableRenderer();
70 70
         });
71 71
     }
72 72
 
73 73
     private function _setDataTableAlias(): void
74 74
     {
75
-        $this->app->booting(function () {
75
+        $this->app->booting(function() {
76 76
             AliasLoader::getInstance()->alias('DataTable', DataTableFacade::class);
77 77
         });
78 78
     }
Please login to merge, or discard this patch.
src/Models/DataTable.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
      * @param string|null $name
124 124
      * @return $this|DataTable
125 125
      */
126
-    public function addComponent(DataComponent $component, ?string $name = null): DataTable
126
+    public function addComponent(DataComponent $component, ? string $name = null) : DataTable
127 127
     {
128 128
         $component->init($this->_queryBuilder, $this->_columns);
129 129
         $componentName = \str_replace(' ', '', Str::lower($name ?? \class_basename($component)));
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
         /** @var Column $column */
169 169
         $column = \array_first(
170 170
             $this->_columns,
171
-            function ($index, $column) use ($columnName) {
171
+            function($index, $column) use ($columnName) {
172 172
                 /** @var Column $column */
173 173
                 return $column->getName() === $columnName;
174 174
             }
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
     private function _fetchHeaders(): array
300 300
     {
301 301
         return \array_map(
302
-            function ($column) {
302
+            function($column) {
303 303
                 /** @var Column $column */
304 304
                 return new Header($column->getKey());
305 305
             },
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -127,7 +127,9 @@  discard block
 block discarded – undo
127 127
     {
128 128
         $component->init($this->_queryBuilder, $this->_columns);
129 129
         $componentName = \str_replace(' ', '', Str::lower($name ?? \class_basename($component)));
130
-        if ($this->componentExists($componentName)) throw new MultipleComponentAssertionException();
130
+        if ($this->componentExists($componentName)) {
131
+            throw new MultipleComponentAssertionException();
132
+        }
131 133
         $this->_components[$componentName] = $component;
132 134
 
133 135
         return $this;
@@ -309,7 +311,9 @@  discard block
 block discarded – undo
309 311
 
310 312
     public function __get($name)
311 313
     {
312
-        if (\array_key_exists($name, $this->_components)) return $this->_components[$name];
314
+        if (\array_key_exists($name, $this->_components)) {
315
+            return $this->_components[$name];
316
+        }
313 317
 
314 318
         return $this->$name;
315 319
     }
Please login to merge, or discard this patch.