public function addSubdirectory($sitePath)
    {
        $paths = array_map(function ($subDir) use ($sitePath) {
            return "$sitePath/$subDir";
        }, $this->possibleSubdirectories());

        $foundPaths = array_filter($paths, function ($path) {
            return file_exists($path);
        });

        // If paths are found, return the first one.
        if (!empty($foundPaths)) {
            return array_shift($foundPaths);
        }

        // If there are no matches, return the original path.
        return $sitePath;
    }
public function addSubdirectory($sitePath)
    {
        $paths = array_map(function ($subDir) use ($sitePath) {
            return "$sitePath/$subDir";
        }, $this->possibleSubdirectories());

        $foundPaths = array_filter($paths, function ($path) {
            return file_exists($path);
        });

        // If paths are found, return the first one.
        if (!empty($foundPaths)) {
            return array_shift($foundPaths);
        }

        // If there are no matches, return the original path.
        return $sitePath;
    }
public function addSubdirectory ( $ sitePath ) { $ paths = array_map ( function ( $ subDir ) use ( $ sitePath ) { return "$sitePath/$subDir" ; } , $ this -> possibleSubdirectories ( ) ) ; $ foundPaths = array_filter ( $ paths , function ( $ path ) { return file_exists ( $ path ) ; } ) ; // If paths are found, return the first one. if ( ! empty ( $ foundPaths ) ) { return array_shift ( $ foundPaths ) ; } // If there are no matches, return the original path. return $ sitePath ; }
Add any matching subdirectory to the site path.
Add any matching subdirectory to the site path .