Skip to content

Commit 1f2723e

Browse files
Consistent use of UF's NotFoundException
1 parent 73850f6 commit 1f2723e

5 files changed

Lines changed: 35 additions & 35 deletions

File tree

app/sprinkles/account/src/Controller/AccountController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
use Illuminate\Database\Capsule\Manager as Capsule;
1414
use Psr\Http\Message\ResponseInterface as Response;
1515
use Psr\Http\Message\ServerRequestInterface as Request;
16-
use Slim\Exception\NotFoundException as NotFoundException;
1716
use UserFrosting\Fortress\RequestDataTransformer;
1817
use UserFrosting\Fortress\RequestSchema;
1918
use UserFrosting\Fortress\ServerSideValidator;
@@ -28,6 +27,7 @@
2827
use UserFrosting\Sprinkle\Core\Util\Captcha;
2928
use UserFrosting\Support\Exception\BadRequestException;
3029
use UserFrosting\Support\Exception\ForbiddenException;
30+
use UserFrosting\Support\Exception\NotFoundException;
3131

3232
/**
3333
* Controller class for /account/* URLs. Handles account-related activities, including login, registration, password recovery, and account settings.
@@ -489,7 +489,7 @@ public function pageRegister(Request $request, Response $response, $args)
489489
$localePathBuilder = $this->ci->localePathBuilder;
490490

491491
if (!$config['site.registration.enabled']) {
492-
throw new NotFoundException($request, $response);
492+
throw new NotFoundException();
493493
}
494494

495495
/** @var \UserFrosting\Sprinkle\Account\Authenticate\Authenticator $authenticator */

app/sprinkles/admin/src/Controller/GroupController.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
use Illuminate\Database\Capsule\Manager as Capsule;
1313
use Psr\Http\Message\ResponseInterface as Response;
1414
use Psr\Http\Message\ServerRequestInterface as Request;
15-
use Slim\Exception\NotFoundException;
1615
use UserFrosting\Fortress\RequestDataTransformer;
1716
use UserFrosting\Fortress\RequestSchema;
1817
use UserFrosting\Fortress\ServerSideValidator;
@@ -21,6 +20,7 @@
2120
use UserFrosting\Sprinkle\Core\Controller\SimpleController;
2221
use UserFrosting\Support\Exception\BadRequestException;
2322
use UserFrosting\Support\Exception\ForbiddenException;
23+
use UserFrosting\Support\Exception\NotFoundException;
2424

2525
/**
2626
* Controller class for group-related requests, including listing groups, CRUD for groups, etc.
@@ -147,7 +147,7 @@ public function delete(Request $request, Response $response, $args)
147147

148148
// If the group doesn't exist, return 404
149149
if (!$group) {
150-
throw new NotFoundException($request, $response);
150+
throw new NotFoundException();
151151
}
152152

153153
/** @var \UserFrosting\Sprinkle\Account\Authorize\AuthorizationManager $authorizer */
@@ -243,7 +243,7 @@ public function getInfo(Request $request, Response $response, $args)
243243

244244
// If the group doesn't exist, return 404
245245
if (!$group) {
246-
throw new NotFoundException($request, $response);
246+
throw new NotFoundException();
247247
}
248248

249249
// Get group
@@ -311,7 +311,7 @@ public function getModalConfirmDelete(Request $request, Response $response, $arg
311311

312312
// If the group no longer exists, forward to main group listing page
313313
if (!$group) {
314-
throw new NotFoundException($request, $response);
314+
throw new NotFoundException();
315315
}
316316

317317
/** @var \UserFrosting\Sprinkle\Account\Authorize\AuthorizationManager $authorizer */
@@ -431,7 +431,7 @@ public function getModalEdit(Request $request, Response $response, $args)
431431

432432
// If the group doesn't exist, return 404
433433
if (!$group) {
434-
throw new NotFoundException($request, $response);
434+
throw new NotFoundException();
435435
}
436436

437437
/** @var \UserFrosting\Sprinkle\Core\Util\ClassMapper $classMapper */
@@ -494,7 +494,7 @@ public function getUsers(Request $request, Response $response, $args)
494494

495495
// If the group no longer exists, forward to main group listing page
496496
if (!$group) {
497-
throw new NotFoundException($request, $response);
497+
throw new NotFoundException();
498498
}
499499

500500
// GET parameters
@@ -659,7 +659,7 @@ public function updateInfo(Request $request, Response $response, $args)
659659
$group = $this->getGroupFromParams($args);
660660

661661
if (!$group) {
662-
throw new NotFoundException($request, $response);
662+
throw new NotFoundException();
663663
}
664664

665665
/** @var \UserFrosting\Support\Repository\Repository $config */

app/sprinkles/admin/src/Controller/PermissionController.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111

1212
use Psr\Http\Message\ResponseInterface as Response;
1313
use Psr\Http\Message\ServerRequestInterface as Request;
14-
use Slim\Exception\NotFoundException;
1514
use UserFrosting\Sprinkle\Core\Controller\SimpleController;
1615
use UserFrosting\Support\Exception\ForbiddenException;
16+
use UserFrosting\Support\Exception\NotFoundException;
1717

1818
/**
1919
* Controller class for permission-related requests, including listing permissions, CRUD for permissions, etc.
@@ -56,7 +56,7 @@ public function getInfo(Request $request, Response $response, $args)
5656

5757
// If the permission doesn't exist, return 404
5858
if (!$permission) {
59-
throw new NotFoundException($request, $response);
59+
throw new NotFoundException();
6060
}
6161

6262
// Get permission
@@ -182,7 +182,7 @@ public function pageInfo(Request $request, Response $response, $args)
182182

183183
// If the permission doesn't exist, return 404
184184
if (!$permission) {
185-
throw new NotFoundException($request, $response);
185+
throw new NotFoundException();
186186
}
187187

188188
return $this->ci->view->render($response, 'pages/permission.html.twig', [

app/sprinkles/admin/src/Controller/RoleController.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
use Illuminate\Database\Capsule\Manager as Capsule;
1313
use Psr\Http\Message\ResponseInterface as Response;
1414
use Psr\Http\Message\ServerRequestInterface as Request;
15-
use Slim\Exception\NotFoundException;
1615
use UserFrosting\Fortress\RequestDataTransformer;
1716
use UserFrosting\Fortress\RequestSchema;
1817
use UserFrosting\Fortress\ServerSideValidator;
@@ -21,6 +20,7 @@
2120
use UserFrosting\Sprinkle\Core\Controller\SimpleController;
2221
use UserFrosting\Support\Exception\BadRequestException;
2322
use UserFrosting\Support\Exception\ForbiddenException;
23+
use UserFrosting\Support\Exception\NotFoundException;
2424

2525
/**
2626
* Controller class for role-related requests, including listing roles, CRUD for roles, etc.
@@ -147,7 +147,7 @@ public function delete(Request $request, Response $response, $args)
147147

148148
// If the role doesn't exist, return 404
149149
if (!$role) {
150-
throw new NotFoundException($request, $response);
150+
throw new NotFoundException();
151151
}
152152

153153
/** @var \UserFrosting\Sprinkle\Account\Authorize\AuthorizationManager $authorizer */
@@ -242,7 +242,7 @@ public function getInfo(Request $request, Response $response, $args)
242242

243243
// If the role doesn't exist, return 404
244244
if (!$role) {
245-
throw new NotFoundException($request, $response);
245+
throw new NotFoundException();
246246
}
247247

248248
// Get role
@@ -310,7 +310,7 @@ public function getModalConfirmDelete(Request $request, Response $response, $arg
310310

311311
// If the role no longer exists, forward to main role listing page
312312
if (!$role) {
313-
throw new NotFoundException($request, $response);
313+
throw new NotFoundException();
314314
}
315315

316316
/** @var \UserFrosting\Sprinkle\Account\Authorize\AuthorizationManager $authorizer */
@@ -438,7 +438,7 @@ public function getModalEdit(Request $request, Response $response, $args)
438438

439439
// If the role doesn't exist, return 404
440440
if (!$role) {
441-
throw new NotFoundException($request, $response);
441+
throw new NotFoundException();
442442
}
443443

444444
/** @var \UserFrosting\Sprinkle\Core\Util\ClassMapper $classMapper */
@@ -508,7 +508,7 @@ public function getModalEditPermissions(Request $request, Response $response, $a
508508

509509
// If the role doesn't exist, return 404
510510
if (!$role) {
511-
throw new NotFoundException($request, $response);
511+
throw new NotFoundException();
512512
}
513513

514514
/** @var \UserFrosting\Sprinkle\Account\Authorize\AuthorizationManager $authorizer */
@@ -549,7 +549,7 @@ public function getPermissions(Request $request, Response $response, $args)
549549

550550
// If the role no longer exists, forward to main role listing page
551551
if (!$role) {
552-
throw new NotFoundException($request, $response);
552+
throw new NotFoundException();
553553
}
554554

555555
// GET parameters
@@ -600,7 +600,7 @@ public function getUsers(Request $request, Response $response, $args)
600600

601601
// If the role doesn't exist, return 404
602602
if (!$role) {
603-
throw new NotFoundException($request, $response);
603+
throw new NotFoundException();
604604
}
605605

606606
/** @var \UserFrosting\Sprinkle\Core\Util\ClassMapper $classMapper */
@@ -765,7 +765,7 @@ public function updateInfo(Request $request, Response $response, $args)
765765
$role = $this->getRoleFromParams($args);
766766

767767
if (!$role) {
768-
throw new NotFoundException($request, $response);
768+
throw new NotFoundException();
769769
}
770770

771771
/** @var \UserFrosting\Support\Repository\Repository $config */
@@ -886,7 +886,7 @@ public function updateField(Request $request, Response $response, $args)
886886
$role = $this->getRoleFromParams($args);
887887

888888
if (!$role) {
889-
throw new NotFoundException($request, $response);
889+
throw new NotFoundException();
890890
}
891891

892892
// Get key->value pair from URL and request body

app/sprinkles/admin/src/Controller/UserController.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
use Illuminate\Database\Capsule\Manager as Capsule;
1414
use Psr\Http\Message\ResponseInterface as Response;
1515
use Psr\Http\Message\ServerRequestInterface as Request;
16-
use Slim\Exception\NotFoundException;
1716
use UserFrosting\Fortress\RequestDataTransformer;
1817
use UserFrosting\Fortress\RequestSchema;
1918
use UserFrosting\Fortress\ServerSideValidator;
@@ -25,6 +24,7 @@
2524
use UserFrosting\Sprinkle\Core\Mail\TwigMailMessage;
2625
use UserFrosting\Support\Exception\BadRequestException;
2726
use UserFrosting\Support\Exception\ForbiddenException;
27+
use UserFrosting\Support\Exception\NotFoundException;
2828

2929
/**
3030
* Controller class for user-related requests, including listing users, CRUD for users, etc.
@@ -192,7 +192,7 @@ public function createPasswordReset(Request $request, Response $response, $args)
192192
$user = $this->getUserFromParams($args);
193193

194194
if (!$user) {
195-
throw new NotFoundException($request, $response);
195+
throw new NotFoundException();
196196
}
197197

198198
/** @var \UserFrosting\Sprinkle\Account\Authorize\AuthorizationManager $authorizer */
@@ -265,7 +265,7 @@ public function delete(Request $request, Response $response, $args)
265265

266266
// If the user doesn't exist, return 404
267267
if (!$user) {
268-
throw new NotFoundException($request, $response);
268+
throw new NotFoundException();
269269
}
270270

271271
/** @var \UserFrosting\Sprinkle\Account\Authorize\AuthorizationManager $authorizer */
@@ -333,7 +333,7 @@ public function getActivities(Request $request, Response $response, $args)
333333

334334
// If the user doesn't exist, return 404
335335
if (!$user) {
336-
throw new NotFoundException($request, $response);
336+
throw new NotFoundException();
337337
}
338338

339339
/** @var \UserFrosting\Sprinkle\Core\Util\ClassMapper $classMapper */
@@ -384,7 +384,7 @@ public function getInfo(Request $request, Response $response, $args)
384384

385385
// If the user doesn't exist, return 404
386386
if (!$user) {
387-
throw new NotFoundException($request, $response);
387+
throw new NotFoundException();
388388
}
389389

390390
/** @var \UserFrosting\Sprinkle\Core\Util\ClassMapper $classMapper */
@@ -476,7 +476,7 @@ public function getModalConfirmDelete(Request $request, Response $response, $arg
476476

477477
// If the user doesn't exist, return 404
478478
if (!$user) {
479-
throw new NotFoundException($request, $response);
479+
throw new NotFoundException();
480480
}
481481

482482
/** @var \UserFrosting\Sprinkle\Account\Authorize\AuthorizationManager $authorizer */
@@ -624,7 +624,7 @@ public function getModalEdit(Request $request, Response $response, $args)
624624

625625
// If the user doesn't exist, return 404
626626
if (!$user) {
627-
throw new NotFoundException($request, $response);
627+
throw new NotFoundException();
628628
}
629629

630630
/** @var \UserFrosting\Sprinkle\Core\Util\ClassMapper $classMapper */
@@ -717,7 +717,7 @@ public function getModalEditPassword(Request $request, Response $response, $args
717717

718718
// If the user doesn't exist, return 404
719719
if (!$user) {
720-
throw new NotFoundException($request, $response);
720+
throw new NotFoundException();
721721
}
722722

723723
/** @var \UserFrosting\Sprinkle\Account\Authorize\AuthorizationManager $authorizer */
@@ -768,7 +768,7 @@ public function getModalEditRoles(Request $request, Response $response, $args)
768768

769769
// If the user doesn't exist, return 404
770770
if (!$user) {
771-
throw new NotFoundException($request, $response);
771+
throw new NotFoundException();
772772
}
773773

774774
/** @var \UserFrosting\Sprinkle\Account\Authorize\AuthorizationManager $authorizer */
@@ -808,7 +808,7 @@ public function getPermissions(Request $request, Response $response, $args)
808808

809809
// If the user doesn't exist, return 404
810810
if (!$user) {
811-
throw new NotFoundException($request, $response);
811+
throw new NotFoundException();
812812
}
813813

814814
// GET parameters
@@ -856,7 +856,7 @@ public function getRoles(Request $request, Response $response, $args)
856856

857857
// If the user doesn't exist, return 404
858858
if (!$user) {
859-
throw new NotFoundException($request, $response);
859+
throw new NotFoundException();
860860
}
861861

862862
/** @var \UserFrosting\Sprinkle\Core\Util\ClassMapper $classMapper */
@@ -1077,7 +1077,7 @@ public function updateInfo(Request $request, Response $response, $args)
10771077
$user = $this->getUserFromParams($args);
10781078

10791079
if (!$user) {
1080-
throw new NotFoundException($request, $response);
1080+
throw new NotFoundException();
10811081
}
10821082

10831083
/** @var \UserFrosting\Support\Repository\Repository $config */
@@ -1205,7 +1205,7 @@ public function updateField(Request $request, Response $response, $args)
12051205
$user = $this->getUserFromParams($args);
12061206

12071207
if (!$user) {
1208-
throw new NotFoundException($request, $response);
1208+
throw new NotFoundException();
12091209
}
12101210

12111211
// Get key->value pair from URL and request body

0 commit comments

Comments
 (0)