Browse Source

Fixing minor issues

Herton 4 years ago
parent
commit
2243235223
2 changed files with 8 additions and 3 deletions
  1. 1 1
      Controllers/PostsController.php
  2. 7 2
      Route.php

+ 1 - 1
Controllers/PostsController.php

@@ -4,7 +4,7 @@ namespace Goodquestiondev\Controllers;
 
 use Symfony\Component\HttpFoundation\Request;
 
-class PostController extends Controller
+class PostsController extends Controller
 {
     /**
      * Display the index.

+ 7 - 2
Route.php

@@ -96,11 +96,16 @@ class Route
     {
         $route = self::getInstance();
         $uriInfo = $route->getUriInfo($request->getPathInfo());
+        $resourceExists = false;
         foreach ($route->resources as $resource) {
             if (in_array($uriInfo['uri'], $resource->uriList)) {
                 $route->callController($resource, $request, $uriInfo);
+                $resourceExists = true;
             }
-        };
+        }
+        if (! $resourceExists) {
+            throw new \Exception('Error getting the Resource: ' . __FUNCTION__);
+        }
     }
 
 
@@ -111,7 +116,7 @@ class Route
      *
      * @param string $path The request path
      *
-     * @return arrray
+     * @return array
      */
     public function getUriInfo($path)
     {