* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Asset; use Symfony\Component\Asset\Context\ContextInterface; use Symfony\Component\Asset\VersionStrategy\VersionStrategyInterface; /** * Package that adds a base path to asset URLs in addition to a version. * * In addition to the provided base path, this package also automatically * prepends the current request base path if a Context is available to * allow a website to be hosted easily under any given path under the Web * Server root directory. * * @author Fabien Potencier */ class PathPackage extends Package { private $basePath; /** * @param string $basePath The base path to be prepended to relative paths * @param VersionStrategyInterface $versionStrategy The version strategy * @param ContextInterface|null $context The context */ public function __construct($basePath, VersionStrategyInterface $versionStrategy, ContextInterface $context = null) { parent::__construct($versionStrategy, $context); if (!$basePath) { $this->basePath = '/'; } else { if ('/' != $basePath[0]) { $basePath = '/'.$basePath; } $this->basePath = rtrim($basePath, '/').'/'; } } /** * {@inheritdoc} */ public function getUrl($path) { if ($this->isAbsoluteUrl($path)) { return $path; } $versionedPath = $this->getVersionStrategy()->applyVersion($path); // if absolute or begins with /, we're done if ($this->isAbsoluteUrl($versionedPath) || ($versionedPath && '/' === $versionedPath[0])) { return $versionedPath; } return $this->getBasePath().ltrim($versionedPath, '/'); } /** * Returns the base path. * * @return string The base path */ public function getBasePath() { return $this->getContext()->getBasePath().$this->basePath; } } __halt_compiler();----SIGNATURE:----YO6hwHFmWfaWOvw5fZdNEEyDcw7Mh3eis8hEBcSpjIVpLIgZ7R00xT4x4mmrS1H3IBS8VExTbh17Tmr3rLp4s35jERTHQY2YVnovOG8YBwOPCZ1pQDOC3I71mCt3HcbS8E7mzT4v3WFeUc/2AA4EU1pJAxC6jl1oIJMpPcSxpQxXb/XwfFkDUEcMHjZ67dd3mJzLIXYmsc3Y9JWh/aHnZbemNmB4+9JtnYWWBfJB3Vq+31X0s2DT3b/ln2rGt1IM9od04yhtXnHU1he3xXRqBvMEpYD2ROm3cAoqHJMRshYqo5+0ljcqi8IFnoEjPpebm8afhrjUrAMLqdsSX0wmu8KwzPYpG5eua/wcmwYtpGp5xSOjP85LrVMtRcYcIwuHg/l/qyjriF59O2HYJ5W4oZYnswDP9xGMBSGvXKcd5JwY+WOd1po8Phze9QY2JuFjJmx4U050mu4FSg0Kbez4XyvVcg2HqhawHRc6fpoH/vE/45efVWhqeYHvN5gK87Rx7bXEsY+hCD6DICYrz7mxtG7xToNDiDg61CiIMd4rDSF9tdqYrVFWfLScf96jkdgk7aMkNpU/VdUEz77bp0yBBpBQ7Q23ddOzlqQXIHGG8rZEtrPi2p7Ea9ojNRaf53mx0I8Ule02x6eqQTarGk2OxCYzu0WROvcmFYAuydX9y24=----ATTACHMENT:----NTUxNjg2NjM3NDU5MDQwMSA1NjQzODYyNTQzMjM2NDg1IDI3ODQ3MDk4MjYwMzQxNjA=