directories getter and setter

when dirs empty:
return all registerd directories

when dirs an array:
adds directories to the index and optional create a define.

@param array 			$paths
@param bool			$define
@return array|void
517536
public static function directories( $dirs = null, $define = true )
	{
		if ( is_null( $dirs ) )
		{
			return static::$directories;
		}
		
		foreach( $dirs as $key => $dir )
		{
			static::$directories[$key] = $dir;
			
			if ( $define === true )
			{
				define( 'CCDIR_'.strtoupper( $key ), $dir );
			}
		}
	}
1357369
function setfs( $paths ) {
		if ( ! is_array($paths) )
			$paths = explode( "\n", $paths );

		$paths = array_filter( array_map( 'trim', $paths ) );

		foreach ( $paths as $path ) {
			// Allow for comments
			if ( '#' == $path[0] )
				continue;

			// Directories
			if ( '/' == $path[ strlen($path) -1 ] )
				$this->mkdir( $path );
			else // Files (with dummy content for now)
				$this->put_contents( $path, 'This is a test file' );
		}

	}
1317189
public function commonDir($paths)
	{
		// $this->debug->groupCollapsed(__CLASS__.'->'.__FUNCTION__);
		$re_split = '#[\\\/]#';
		$count = 0;
		foreach ($paths as $k => $path) {
			if (empty($path)) {
				unset($paths[$k]);
				continue;
			}
			$ds = strpos($path, '/') !== false
				? '/'
				: $this->cfg['ds'];
			$levels = preg_split($re_split, $path);
			if (count($levels) > $count) {
				$count = count($levels);
			}
		}
		foreach ($paths as $path) {
			$parts = preg_split($re_split, $path);
			while ($count >= 0) {
				if (array_slice($levels, 0, $count) == array_slice($parts, 0, $count)) {
					$levels = array_slice($levels, 0, $count);
					continue 2;
				}
				$count--;
			}
		}
		$return = !empty($levels)
			? implode($ds, $levels)
			: '';
		// $this->debug->groupEnd();
		return $return;
	}
249629
public function setSearchPaths($paths)
    {

        // Merge in possible custom paths
        if (array_key_exists('additional_paths', self::$settings) &&
            is_array(self::$settings['additional_paths']) &&
            count(self::$settings['additional_paths']) > 0) {

            $paths = array_merge(self::$settings['additional_paths'], $paths);
        }

        // Make sure they all have a trailing slash
        foreach ($paths as $k => $v) {
            $paths[$k] .= substr($v, -1) == '/' ? '' : '/';
        }

        // Save them
        $this->searchPaths = $paths;
    }
608544
public function setConfig($paths = [], $value = null)
    {
        if (!is_array($paths)) {
            $paths = [$paths => $value];
        }

        foreach ($paths as $path=>$value) {
            $pos = &$this->_lookupConfigElement($path, true);

            if (is_array($pos) && !empty($pos) && is_array($value)) {
                // special treatment for arrays - merge them
                $pos = array_merge($pos, $value);
            } else {
                // otherwise just assign value
                $pos = $value;
            }
        }

        return $this;
    }
982151
public function setPaths($paths)
    {
        $this->paths = $paths;
        self::$pathsMap[$this->namespace] = $this->paths;
    }
508003
public function files($paths = false, $createMissing = false)
    {
        if ($paths === false) {
            return $this->find('*')->files();
        }

        $list = new Collection;
        foreach ($paths as $path) {
            $list->add($this->file($path, $createMissing));
        }
        return $list;
    }
1154379
public function setPaths($paths)
    {
        if ($paths instanceof SplStack) {
            $this->paths = $paths;
        } elseif (is_array($paths)) {
            $this->clearPaths();
            $this->addPaths($paths);
        } else {
            throw new Exception\InvalidArgumentException(
                "Invalid argument provided for \$paths, expecting either an array or SplStack object"
            );
        }

        return $this;
    }
1285713
public static function mergePreflightDir(array $paths): array
    {
        if (defined('PREFLIGHT_DIR')) {
            $dir = constant('PREFLIGHT_DIR');
            $path = trailingslashit($dir) . 'preflight.toml';

            $paths[] = normalize_path($path);
        }

        return $paths;
    }
195278
public function getPhpFiles(array $paths): FileCollection
    {
        $this->files = new FileCollection;
        foreach ($paths as $path) {
            $this->getPhpFilesFromPath($path);
        }

        return $this->files;
    }
955031
public function addResourcePaths($domain, array $paths) {
        foreach ($paths as $path) {
            $this->_paths[$domain][] = $path;
        }

        return $this;
    }
1112365
public static function includePath($paths) {
        $current = array(get_include_path());

        if (is_array($paths)) {
            $current = array_merge($current, $paths);
        } else {
            $current[] = $paths;
        }

        $path = implode(static::DELIMITER, $current);

        set_include_path($path);

        return $path;
    }
950301
public function setIncludePath($paths)
	{
		if (is_array($paths) === false) {
			$paths = array($paths);
		}

		$this->includePath = $paths;
		$this->resolvedPath = null;
	}
877228
public function addLocations(array $paths): Finder
    {
        foreach ($paths as $path => $url) {
            $this->addLocation($path, $url);
        }

        return $this;
    }
69192
public function withPath($path = __DIR__)
    {
        $before = get_declared_classes();

        $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($path));
        foreach ($iterator as $item) {
            if (!$item->isDir() && substr($item->getPathname(), -4) == '.php') {
                require_once $item->getPathname();
            }
        }

        $after    = get_declared_classes();
        $commands = array_diff($after, $before);

        $this->withCommands($commands);

        return $this;
    }
486724
protected function loadComponents($paths)
    {
        $paths = array_unique(is_array($paths) ? $paths : (array) $paths);

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

        if (empty($paths)) {
            return;
        }

        $namespace = $this->app->getNamespace();

        foreach ((new Finder())->in($paths)->exclude('Observers')->files() as $file) {
            $class = trim($namespace, '\\') . '\\'
                . str_replace(
                    ['/', '.php'],
                    ['\\', ''],
                    Str::after(
                        realpath($file->getPathname()),
                        app_path() . DIRECTORY_SEPARATOR
                    )
                );

            if (is_subclass_of($class, Component::class)
                && ! (new \ReflectionClass($class))->isAbstract()
            ) {
                $this->registerComponent($class);
            }
        }
    }
397434
public function extend(/*...$paths*/)
    {
        $extended = clone $this;
        $extended->paths = array_merge($extended->paths, func_get_args());
        return $extended;
    }