lithium\core\Libraries::_locateAll()

protected static method

Locates all possible classes for given set of parameters.

Parameters

  • array $params
  • array $options

Returns

array

Source

	protected static function _locateAll(array $params, array $options = []) {
		$defaults = ['libraries' => null, 'recursive' => true, 'namespaces' => false];
		$options += $defaults;

		$paths = (array) static::$_paths[$params['type']];
		$libraries = $options['library'] ? $options['library'] : $options['libraries'];
		$libraries = static::get((array) $libraries);
		$flags = ['escape' => '/'];
		$classes = [];

		foreach ($libraries as $library => $config) {
			if (!$config) {
				continue;
			}
			$params['library'] = $config['path'];

			foreach (static::_searchPaths($paths, $library) as $tpl) {
				$options['path'] = str_replace('\\', '/', Text::insert($tpl, $params, $flags));
				$options['path'] = str_replace('*/', '', $options['path']);
				$classes = array_merge($classes, static::_search($config, $options));
			}
		}
		return array_unique($classes);
	}