Объявления классов не могут быть вложены

Я делаю свой сайт и имею файл Router.php. Когда я запускаю сайт то возникает вот эта ошибка: Fatal error: Class declarations may not be nested in D:\OpenServer\OpenServer\domains\Internetstor\components\Router.php on line 61 У меня уже нет идей как пофиксить эту ошибку. Поэтому прошу помощи . И да 61 строчка это: class SiteControlle{ Вот код:

<?php

class Router
{

    private $routes;

    public function __construct()
    {
        $routesPath = ROOT . '/config/routes.php';
        $this->routes = include($routesPath);
    }


    /**
     * Returns request string
     */
    private function getURI()
    {
        if (!empty($_SERVER['REQUEST_URI'])) {
            return trim($_SERVER['REQUEST_URI'], '/');
        }
    }

    public function run()
    {
        // Получить строку запроса
        $uri = $this->getURI();

        // Проверить наличие такого запроса в routes.php
        foreach ($this->routes as $uriPattern => $path) {

            // Сравниваем $uriPattern и $uri
            if (preg_match("~$uriPattern~", $uri)) {

                // Получаем внутренний путь из внешнего согласно правилу.
                $internalRoute = preg_replace("~$uriPattern~", $path, $uri);

                // Определить контроллер, action, параметры

                $segments = explode('/', $internalRoute);

                $controllerName = array_shift($segments) . 'Controller';
                $controllerName = ucfirst($controllerName);

                $actionName = 'action' . ucfirst(array_shift($segments));

                $parameters = $segments;

                // Подключить файл класса-контроллера
                $controllerFile = ROOT . '/controllers/' .
                        $controllerName . '.php';

                if (file_exists($controllerFile)) {
                    include_once($controllerFile);
                }
                // Создать объект, вызвать метод (т.е. action)
                $controllerObject = new $controllerName;


                class SiteControlle{
                   public function actionIndex(){


                if ($result != null) {
                    break;
                }
            }
        }
    }
}
    }   
      }

Ответы (0 шт):