Add additional subdirectories within the module directory that should be searched for Module.php

@param array $directories
@return self
496176
public function addSubdirectories(array $directories)
    {
        foreach ($directories as $dir) {
            $this->subdirs[$dir] = $dir;
        }

        return $this;
    }
448968
public function watchDir($dirs): self
    {
        $this->watchDirs = array_merge($this->watchDirs, (array)$dirs);

        return $this;
    }
72939
protected function _getManifests( array $directories )
	{
		$manifests = array();

		foreach ( $directories as $directory )
		{
			if ( ( $manifest = $this->_getManifestFile( $directory ) ) !== false )
			{
				$manifests[ $directory ] = $manifest;
				continue;
			}

			$dir = new DirectoryIterator( $directory );

			foreach ( $dir as $dirinfo )
			{
				if ( $dirinfo->isDot() === false )
				{
					if ( ( $manifest = $this->_getManifestFile( $dirinfo->getPathName() ) ) !== false ) {
						$manifests[$dirinfo->getPathName()] = $manifest;
					}
				}
			}
		}

		return $manifests;
	}
641234
public function set(array $files)
    {
        if (!empty($files)) {
            foreach ($files as $_file) {
                $this->add($_file);
            }
        }
        return $this;
    }
734032
public function dirs(array $dirs)
    {
        foreach ($dirs as $k => $v) {
            if (is_numeric($v)) {
                $this->dir($k, $v);
                continue;
            }
            $this->dir($v);
        }

        return $this;
    }
1250536
public function setFiles($files = array())
    {
        if (count($files) === 0) {
            $this->_files = $_FILES;
        } else {
            $this->_files = $files;
        }
        return $this;
    }
542644
protected function makeDir($paths = '')
    {
        foreach ((array) $paths as $path) {
            $path = $this->extensionPath($path);

            $this->filesystem->makeDirectory($path, 0755, true, true);
        }
    }
1115682
public function addPaths($paths)
    {
        $paths = is_array($paths) ? $paths : [$paths];

        foreach ($paths as $key => $path) {
            $key = is_int($key) ? null : $key;

            $this->addPath($path, $key);
        }

        return $this;
    }
690826
public function addDirectory($directory)
    {
        $directories = $this->getDirectory(true);

        if (is_string($directory)) {
            $directory = explode(',', $directory);
        } else if (!is_array($directory)) {
            require_once 'Zend/Validate/Exception.php';
            throw new Zend_Validate_Exception ('Invalid options to validator provided');
        }

        foreach ($directory as $content) {
            if (empty($content) || !is_string($content)) {
                continue;
            }

            $directories[] = trim($content);
        }
        $directories = array_unique($directories);

        // Sanity check to ensure no empty values
        foreach ($directories as $key => $dir) {
            if (empty($dir)) {
                unset($directories[$key]);
            }
        }

        $this->_directory = implode(',', $directories);

        return $this;
    }
679984
public function in($dirs)
    {
        $resolvedDirs = [];

        foreach ((array) $dirs as $dir) {
            if (is_dir($dir)) {
                $resolvedDirs[] = $this->normalizeDir($dir);
            } elseif ($glob = glob($dir, (\defined('GLOB_BRACE') ? GLOB_BRACE : 0) | GLOB_ONLYDIR)) {
                $resolvedDirs = array_merge($resolvedDirs, array_map([$this, 'normalizeDir'], $glob));
            } else {
                throw new DirectoryNotFoundException(sprintf('The "%s" directory does not exist.', $dir));
            }
        }

        $this->dirs = array_merge($this->dirs, $resolvedDirs);

        return $this;
    }
488828
public function compileManifest(array $directories)
    {
        $manifest = [];

        foreach ($directories as $directory) {
            // Find the root file of each plugin.
            // As we load the plugins from the mu-plugins directory
            // we do not need to get their header. Only the file
            // that defines them.
            if ($payload = $this->getPlugin($directory)) {
                $manifest[$directory] = $payload;
            }
        }

        return $this->writeManifest($manifest);
    }
648690
public function generateDirectoryStructure($destDir, array $dirs = [ ])
    {
        foreach ($dirs as $dirPath) {
            $dirPath = Path::join($destDir, $dirPath);
            if (! $this->files->exists($dirPath)) {
                $this->files->makeDirectory($dirPath, 0755, true);
            }
        }
        return $this;
    }
587846
def add_directories(names):
    """"""
    res = list(names)
    seen = set(names)
    for name in names:
        while True:
            name = os.path.dirname(name)
            if not name or name in seen:
                break
            res.append(name)
            seen.add(name)
    return sorted(res)
62810
public function setModules(array $modules)
    {
        $this->modules = array();

        foreach ($modules as $module) {
            $this->addModule($module);
        }

        return $this;
    }
790812
private function publish_directories($directories)
    {
        $root = \get_template_directory();

        if (\is_child_theme()) {
            $root = \get_stylesheet_directory();
        }

        if (isset($this->root)) {
            $root = $this->root;
        }

        foreach ($directories as $source => $target) {
            $target_path = \trailingslashit($root) . \ltrim($target, '/\\');

            // Check if source exists.
            if (! \is_dir($source)) {
                $this->output->writeln("<error>The package source [$source] could not be found or is not readable. Skipping.</error>");
                continue;
            }

            // Check if target exists yet, create if not.
            if (! \is_dir($target_path)) {
                $this->mkdir($target_path);
            }

            // Now we know it exists, check we can write to it.
            if (! \is_writable($target_path)) {
                $this->output->writeln("<error>[$target_path] is not writable. Please check directory permissions.</error>");
                continue;
            }
            
            $this->deep_copy($source, $target_path);
        }
    }
569031
public function addDirectory($path)
    {
        $finder = new Finder();
        $finder->files()
            ->ignoreVCS(true)
            ->name('*.php')
            ->in($path);

        foreach ($finder as $file) {
            $this->addFile($file);
        }

        return $this;
    }
45790
public function addDirs($dirs) {
        if(!is_array($dirs)) {
            $dirs = array($dirs);
        }

        $this->dirs = array_merge($this->dirs, $dirs);
    }