public function createRouter($debug = false)
    {
        if (null === $this->routesFile) {
            throw new LogicException('The derived class must define the string variable "routesFile"');
        }

        if (!is_string($this->routesFile)) {
            throw new LogicException('"routesFile" variable must be a string value');
        }

        $isProduction = $this->configurationHandler->isProduction();

        $cacheDir = null;
        if (!$debug && $isProduction) {
            $cacheDir = $this->configurationHandler->siteCacheDir() . '/routes';
        }

        $this->router = new Router(
            new YamlFileLoader($this->fileLocator),
            $this->routesFile,
            array('cache_dir' => $cacheDir)
        );

        return $this->router;
    }