Extends
lithium\core\StaticObject
Returns the prefix (scheme + hostname) for a URL based on the passed `$options` and the
`$context`.
Parameters
- string $path The URL to be prefixed.
- object $context The request context.
- array $options Options for generating the proper prefix. Currently accepted values are: `'absolute' => true|false`, `'host' => string` and `'scheme' => string`.
Returns
string The prefixed URL, depending on the passed options.Source
protected static function _prefix($path, $context = null, array $options = array()) {
$defaults = array('scheme' => null, 'host' => null, 'absolute' => false);
if ($context) {
$defaults['host'] = $context->env('HTTP_HOST');
$defaults['scheme'] = $context->env('HTTPS') ? 'https://' : 'http://';
}
$options += $defaults;
return ($options['absolute']) ? "{$options['scheme']}{$options['host']}{$path}" : $path;
}