protected static _locateDeferred ( boolean | null $defer, array $paths, array $params, array $options = [] ) : string | ||
$defer | boolean | null | A boolean flag indicating which libraries to search, either the ones with the `'defer'` flag set, or the ones without. Providing `null` will cause the method to ignore the `'defer'` flag set on any library and perform a complete lookup. |
$paths | array | List of paths to be searched for the given service (class). These are defined in `lithium\core\Libraries::$_paths`, and are organized by class type. |
$params | array | The list of insert parameters to be injected into each path format string when searching for classes. |
$options | array | |
return | string | Returns a class path as a string if a given class is found, or null if no class in any path matching any of the parameters is located. |
protected static function _locateDeferred($defer, $paths, $params, array $options = array())
{
$libraries = static::$_configurations;
if (isset($options['library'])) {
$libraries = static::get((array) $options['library']);
}
foreach ($libraries as $library => $config) {
if ($config['defer'] !== $defer && $defer !== null) {
continue;
}
foreach (static::_searchPaths($paths, $library) as $tpl) {
$params['library'] = rtrim($config['prefix'], '\\');
$class = str_replace('\\*', '', String::insert($tpl, $params));
if (file_exists($file = Libraries::path($class, $options))) {
return $options['type'] === 'file' ? $file : $class;
}
}
}
}