Skip to content

Commit 88f2991

Browse files
committed
phpcbf src/ tests/
$ ./vendor/bin/phpcbf src/ tests/ PHPCBF RESULT SUMMARY ----------------------------------------------------------------------------------------------------------------------------------- FILE FIXED REMAINING ----------------------------------------------------------------------------------------------------------------------------------- cakephp-api-pagination/src/Controller/Component/ApiPaginationComponent.php 2 9 cakephp-api-pagination/tests/TestCase/Controller/Component/ApiPaginationComponentTest.php 8 21 cakephp-api-pagination/tests/bootstrap.php 1 2 ----------------------------------------------------------------------------------------------------------------------------------- A TOTAL OF 11 ERRORS WERE FIXED IN 3 FILES ----------------------------------------------------------------------------------------------------------------------------------- Time: 372ms; Memory: 10MB
1 parent 11604d3 commit 88f2991

File tree

3 files changed

+20
-12
lines changed

3 files changed

+20
-12
lines changed

src/Controller/Component/ApiPaginationComponent.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class ApiPaginationComponent extends Component
3333
* Injects the pagination info into the response if the current request is a
3434
* JSON or XML request with pagination.
3535
*
36-
* @param \Cake\Event\Event $event The Controller.beforeRender event.
36+
* @param \Cake\Event\Event $event The Controller.beforeRender event.
3737
* @return void
3838
*/
3939
public function beforeRender(Event $event)
@@ -98,8 +98,8 @@ protected function setVisibility()
9898
*/
9999
protected function isPaginatedApiRequest()
100100
{
101-
if ($this->getController()->getRequest()->getAttribute('paging') &&
102-
$this->getController()->getRequest()->is(['json', 'xml'])
101+
if ($this->getController()->getRequest()->getAttribute('paging')
102+
&& $this->getController()->getRequest()->is(['json', 'xml'])
103103
) {
104104
return true;
105105
}

tests/TestCase/Controller/Component/ApiPaginationComponentTest.php

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ public function testVisibilitySettings()
107107
$this->controller->getRequest()->withEnv('HTTP_ACCEPT', 'application/json')
108108
);
109109
$this->controller->set('data', $this->controller->paginate($this->Articles));
110-
$apiPaginationComponent = new ApiPaginationComponent($this->controller->components(), [
110+
$apiPaginationComponent = new ApiPaginationComponent(
111+
$this->controller->components(), [
111112
'visible' => [
112113
'page',
113114
'current',
@@ -116,7 +117,8 @@ public function testVisibilitySettings()
116117
'nextPage',
117118
'pageCount'
118119
]
119-
]);
120+
]
121+
);
120122
$event = new Event('Controller.beforeRender', $this->controller);
121123
$apiPaginationComponent->beforeRender($event);
122124

@@ -144,13 +146,15 @@ public function testAliasSettings()
144146
$this->controller->getRequest()->withEnv('HTTP_ACCEPT', 'application/json')
145147
);
146148
$this->controller->set('data', $this->controller->paginate($this->Articles));
147-
$apiPaginationComponent = new ApiPaginationComponent($this->controller->components(), [
149+
$apiPaginationComponent = new ApiPaginationComponent(
150+
$this->controller->components(), [
148151
'aliases' => [
149152
'page' => 'curPage',
150153
'current' => 'currentCount',
151154
'count' => 'totalCount',
152155
]
153-
]);
156+
]
157+
);
154158
$event = new Event('Controller.beforeRender', $this->controller);
155159
$apiPaginationComponent->beforeRender($event);
156160

@@ -190,9 +194,11 @@ public function testKeySetting()
190194
$this->controller->getRequest()->withEnv('HTTP_ACCEPT', 'application/json')
191195
);
192196
$this->controller->set('data', $this->controller->paginate($this->Articles));
193-
$apiPaginationComponent = new ApiPaginationComponent($this->controller->components(), [
197+
$apiPaginationComponent = new ApiPaginationComponent(
198+
$this->controller->components(), [
194199
'key' => 'paging'
195-
]);
200+
]
201+
);
196202
$event = new Event('Controller.beforeRender', $this->controller);
197203
$apiPaginationComponent->beforeRender($event);
198204

@@ -232,7 +238,8 @@ public function testAllSettings()
232238
$this->controller->getRequest()->withEnv('HTTP_ACCEPT', 'application/json')
233239
);
234240
$this->controller->set('data', $this->controller->paginate($this->Articles));
235-
$apiPaginationComponent = new ApiPaginationComponent($this->controller->components(), [
241+
$apiPaginationComponent = new ApiPaginationComponent(
242+
$this->controller->components(), [
236243
'key' => 'fun',
237244
'aliases' => [
238245
'page' => 'currentPage',
@@ -246,7 +253,8 @@ public function testAllSettings()
246253
'prevPage',
247254
'nextPage'
248255
]
249-
]);
256+
]
257+
);
250258
$event = new Event('Controller.beforeRender', $this->controller);
251259
$apiPaginationComponent->beforeRender($event);
252260

tests/bootstrap.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
unset($findRoot);
1414
chdir($root);
1515
if (file_exists($root . '/config/bootstrap.php')) {
16-
require $root . '/config/bootstrap.php';
16+
include $root . '/config/bootstrap.php';
1717
return;
1818
}
1919
require $root . '/vendor/cakephp/cakephp/tests/bootstrap.php';

0 commit comments

Comments
 (0)