Convert paths bag to array, and every path to string.

@param bool $reindex

@return  array  Raw paths.

@since  2.0
333662
public function toArray($reindex = false)
    {
        $array = [];

        foreach ($this as $key => $path) {
            if ($reindex) {
                $array[] = (string) clone $path;
            } else {
                $array[$key] = (string) clone $path;
            }
        }

        return $array;
    }
242035
private function normalizePaths(iterable $paths): array
    {
        $separator = DocumentInterface::PATH_SEPARATOR;

        // convert paths like a.b.c to paths that actually should be used a, a.b, a.b.c
        $normalizedPaths = [];
        foreach ($paths as $path) {
            $curPath = '';
            foreach (\explode($separator, $path) as $pathPart) {
                $curPath                   = empty($curPath) === true ? $pathPart : $curPath . $separator . $pathPart;
                $normalizedPaths[$curPath] = true;
            }
        }

        return $normalizedPaths;
    }
1084318
public static String relativizePath(String path, boolean withIndex)
   {

      if (path.startsWith("/"))
         path = path.substring(1);
      if (!withIndex && path.endsWith("]"))
      {
         int index = path.lastIndexOf('[');
         return index == -1 ? path : path.substring(0, index);
      }
      return path;
   }
318789
public function pathToString($path, $rewrite = false)
    {
        if (is_string($path)) {
            return $path;
        }
        $str = $this->basePath;
        if ($str == '/') {
            $str = '';
        }
        if (! ($this->rewrite or $rewrite)) {
            $str .= '/' . $this->scriptName;
        }
        $str .= '/' . implode('/', array_map('urlencode', $path));
        $str = rtrim($str, '/');
        if ($str == '') {
            return '/';
        }
        return $str;
    }
222143
protected function getFilesFromDirectory(string $mappingDirectory): array
    {
        $mappingPaths = [];

        $filePattern = \sprintf('/^.+\.(%s)$/i', \implode('|', $this->extensions));
        $recursiveIterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($mappingDirectory));
        $regexIterator = new \RegexIterator($recursiveIterator, $filePattern, \RecursiveRegexIterator::GET_MATCH);

        foreach ($regexIterator as $mappingFile) {
            $mappingPaths[] = $mappingFile[0];
        }

        \sort($mappingPaths);

        return $mappingPaths;
    }
491459
public function getPath($absolute = false)
	{
		if(!$absolute)
		    return $this->properties['path'];

		$routes = $this->getFullRoutes();

		$paths = array();

		foreach($routes as $route)
		{
			$path = $route->getProperty('path');

			if($path == '')
				continue;

			$paths[] = $path;
		}

		return trim(implode('/', $paths), '/');
	}
1112309
protected function normalize($path, $returnString = false)
    {
        // Clean the Directory separator
        $path = $this->clean($path);

        // Extract to array
        $path = $this->extract($path);

        // Remove dots from path
        $path = $this->removeDots($path);

        // If set to return string, compact it.
        if ($returnString == true) {
            $path = $this->compact($path);
        }

        return $path;
    }
414058
public function getDirectories(string $path, bool $isRecursive = false) : array
    {
        if (!$this->isDirectory($path)) {
            return [];
        }

        $directories = [];
        $iter = new RecursiveIteratorIterator(
            new RecursiveDirectoryIterator($path, RecursiveDirectoryIterator::SKIP_DOTS),
            RecursiveIteratorIterator::SELF_FIRST,
            RecursiveIteratorIterator::CATCH_GET_CHILD
        );

        if (!$isRecursive) {
            $iter->setMaxDepth(0);
        }

        foreach ($iter as $path => $item) {
            if ($item->isDir()) {
                $directories[] = $path;
            }
        }

        return $directories;
    }
250160
protected static function convertPathToTree(array &$paths, $index, $path)
    {
        if (strpos($path, DIRECTORY_SEPARATOR) !== false) {
            $chunks = explode(DIRECTORY_SEPARATOR, $path);
            $paths = static::branch($paths, $chunks);
            unset($paths[$index]);
        }
    }
189460
public static function parse_dir( $path, $extension, $prefix = '' ) {
		$extension = ltrim( $extension, '.' );
		$regexp = '#/([^._][^/]*)\.' . $extension . '$#u';
		if ( ! is_dir( $path ) ) {
			return [];
		}
		$files = [];
		$finder = new Finder();
		foreach ( $finder->in( $path )->name( "*.{$extension}" )->files() as $file ) {
			$file_path = $file->getPathname();
			if ( ! preg_match( $regexp, $file_path, $match ) ) {
				continue;
			}
			$handle = $prefix . $match[1];
			$deps = self::grab_deps( $file_path );
			$url = str_replace( ABSPATH, home_url( '/' ), $file_path );
			$files[ $handle ] = [
				'path' => $file_path,
				'deps' => $deps,
				'url'  => $url,
			];
		}
		return $files;
	}
559220
public function reindex()
    {
        $category = \Core::make('Concrete\Core\Attribute\Category\FileCategory');
        $indexer = $category->getSearchIndexer();
        $values = $category->getAttributeValues($this);
        foreach ($values as $value) {
            $indexer->indexEntry($category, $value, $this);
        }
    }
1232097
def _reindex(self):
        
        self.index = []
        for path in self.paths:
            target_path = os.path.normpath(os.path.join(BASE_PATH,
                                                        path))
            for root, subdirs, files in os.walk(target_path):
                for f in files:
                    self.index.append(
                        (os.path.join(root, f).lower(),
                         os.path.join(root, f)))
991587
public function getRing($index)
    {
        if (-1 == $index) {
            $index = count($this->rings) - 1;
        }

        $lineStringClass = $this->getNamespace() . '\LineString';

        return new $lineStringClass($this->rings[$index], $this->srid);
    }
860769
public function getPaths($extension = null)
	{
		if (isset($extension))
		{
			if (isset($this->paths[$extension]))
			{
				return $this->paths[$extension];
			}

			return;
		}

		return $this->paths;
	}
1302272
public function realpath($path)
    {
        $path = str_replace('\\', '/', rtrim($path, '/'));
        if ($path[0] != '/' && (strlen($path) < 2 || $path[1] != ':')) {
            $path = getcwd() . '/' . $path;
        }
        $parts = explode('/', $path);
        $path = [];
        foreach ($parts as $part) {
            if ($part == '..') {
                array_pop($path);
            } else if ($part != '.') {
                array_push($path, $part);
            }
        }
        return implode('/', $path);
    }
1299857
function _reindexFiles($value, $key)
    {
        if (!is_array($value)) {
            return array($key => $value);
        } else {
            $ret = array();
            foreach ($value as $k => $v) {
                $ret[$k] = $this->_reindexFiles($v, $key);
            }
            return $ret;
        }
    }
379126
public static function glob_recursive( $path ) {
		$files = [];
		if ( preg_match( '/\\' . DIRECTORY_SEPARATOR . 'vendor$/', $path ) ) {
			return $files;
		}

		foreach ( glob( $path . '/*' ) as $file ) {
			if ( is_dir( $file ) ) {
				$files = array_merge( $files, static::glob_recursive( $file ) );
			} elseif ( preg_match( '/\.php$/', $file ) ) {
				$files[] = $file;
			}
		}

		return $files;
	}