public function search(string $path, string $ext = 'php'): array
	{
		$path = $this->ensureExt($path, $ext);

		$foundPaths = [];

		foreach ($this->getNamespaces() as $namespace)
		{
			if (is_file($namespace['path'] . $path))
			{
				$foundPaths[] = $namespace['path'] . $path;
			}
		}

		// Remove any duplicates
		$foundPaths = array_unique($foundPaths);

		return $foundPaths;
	}
public function search(string $path, string $ext = 'php'): array
	{
		$path = $this->ensureExt($path, $ext);

		$foundPaths = [];

		foreach ($this->getNamespaces() as $namespace)
		{
			if (is_file($namespace['path'] . $path))
			{
				$foundPaths[] = $namespace['path'] . $path;
			}
		}

		// Remove any duplicates
		$foundPaths = array_unique($foundPaths);

		return $foundPaths;
	}
public function search ( string $ path , string $ ext = 'php' ) : array { $ path = $ this -> ensureExt ( $ path , $ ext ) ; $ foundPaths = [ ] ; foreach ( $ this -> getNamespaces ( ) as $ namespace ) { if ( is_file ( $ namespace [ 'path' ] . $ path ) ) { $ foundPaths [ ] = $ namespace [ 'path' ] . $ path ; } } // Remove any duplicates $ foundPaths = array_unique ( $ foundPaths ) ; return $ foundPaths ; }
Searches through all of the defined namespaces looking for a file.
Returns an array of all found locations for the defined file.

Example:

$locator->search('Config/Routes.php');
// Assuming PSR4 namespaces include foo and bar, might return:
[
'app/Modules/foo/Config/Routes.php',
'app/Modules/bar/Config/Routes.php',
]

@param string $path
@param string $ext

@return array
Searches through all of the defined namespaces looking for a file . Returns an array of all found locations for the defined file .