mirror of
https://github.com/Combodo/iTop.git
synced 2026-03-01 15:14:11 +01:00
44 lines
1.1 KiB
PHP
44 lines
1.1 KiB
PHP
<?php
|
|
|
|
/*
|
|
* This file is part of the Symfony package.
|
|
*
|
|
* (c) Fabien Potencier <fabien@symfony.com>
|
|
*
|
|
* For the full copyright and license information, please view the LICENSE
|
|
* file that was distributed with this source code.
|
|
*/
|
|
|
|
namespace Symfony\Bundle\FrameworkBundle\Tests\Templating\Helper\Fixtures;
|
|
|
|
use Symfony\Component\Templating\TemplateNameParserInterface;
|
|
use Symfony\Component\Templating\TemplateReference;
|
|
|
|
class StubTemplateNameParser implements TemplateNameParserInterface
|
|
{
|
|
private $root;
|
|
|
|
private $rootTheme;
|
|
|
|
public function __construct($root, $rootTheme)
|
|
{
|
|
$this->root = $root;
|
|
$this->rootTheme = $rootTheme;
|
|
}
|
|
|
|
public function parse($name)
|
|
{
|
|
list($bundle, $controller, $template) = explode(':', $name, 3);
|
|
|
|
if ('_' == $template[0]) {
|
|
$path = $this->rootTheme.'/Custom/'.$template;
|
|
} elseif ('TestBundle' === $bundle) {
|
|
$path = $this->rootTheme.'/'.$controller.'/'.$template;
|
|
} else {
|
|
$path = $this->root.'/'.$controller.'/'.$template;
|
|
}
|
|
|
|
return new TemplateReference($path, 'php');
|
|
}
|
|
}
|