protected static _transformPath ( mixed $transform, string $class, array $options = [] ) : string | ||
$transform | mixed | Either a closure or an array containing a regular expression match and replacement. If the closure returns an empty value, or the regular expression fails to match, will return `null`. |
$class | string | The class name which is attempting to be mapped to a file. |
$options | array | The configuration of the library as passed to `Libraries::add()`, along with any options specified in the call to `Libraries::path()`. |
리턴 | string | Returns transformed path of a class to a file, or `null` if the transformation did not match. |
protected static function _transformPath($transform, $class, array $options = array())
{
if (is_callable($transform) && ($file = $transform($class, $options))) {
return $file;
}
if (is_array($transform)) {
list($match, $replace) = $transform;
return preg_replace($match, $replace, $class) ?: null;
}
}