lithium\core\Libraries::_transformPath PHP Method

_transformPath() protected static method

The transformation can either be a closure which receives two parameters (the class name as a string, and the library configuration as an array), or an array with two values (one being the pattern to match, the other being the replacement).
See also: lithium\core\Libraries::add()
See also: lithium\core\Libraries::path()
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()`.
return 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;
        }
    }