private function buildQueue(): array
    {
        $queue = [];

        // Where is our middleware located?
        $parentMiddleware = $this->config->paths->theme->parent->middleware;
        $childMiddleware = $this->config->paths->theme->child->middleware;

        // Loop through our middleware files
        foreach ($this->finder->createFinder()->files()->name('*.php')->in($parentMiddleware) as $file)
        {
            if ($this->kernel->childHasMiddleware())
            {
                // Only register one of our middleware files if the
                // child theme does not have the same middleware file.
                if (!file_exists(str_replace($parentMiddleware, $childMiddleware, $file)))
                {
                    $queue[] = $file;
                }
            }
            else
            {
                $queue[] = $file;
            }
        }

        // Now lets loop through the child theme middleware files.
        if ($this->kernel->childHasMiddleware())
        {
            foreach ($this->finder->createFinder()->files()->name('*.php')->in($childMiddleware) as $file)
            {
                $queue[] = $file;
            }
        }

        // Ensure the middleware queue is sorted.
        return Linq::from($queue)->orderBy('$v')->toArray();
    }