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();
    }
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();
    }
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 ( ) ; }
Creates an array of file paths that contain middleware.

The middleware files are hierarchical, allowing the child theme to
override any middleware that we provide by default. The array is also
sorted by filename. So the child theme can "insert" it's middleware
in the desired order.

@return string[]
Creates an array of file paths that contain middleware .