/** * @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 $query * * @return string */ private function getQueryPath($query) { $sepr = DIRECTORY_SEPARATOR; $replacedQuery = str_replace(array('\\', '/'), $sepr, $query); if ($this->queryContainsQualifiedClassName($query)) { $namespacedQuery = null === $this->psr4Prefix ? $replacedQuery : substr($replacedQuery, strlen($this->srcNamespace)); $path = $this->fullSpecPath . $namespacedQuery . 'Spec.php'; if ($this->filesystem->pathExists($path)) { return $path; } } return rtrim(realpath($replacedQuery), $sepr); }
/** * @param string $path * * @return PSR0Resource[] */ protected function findSpecResources($path) { if (!$this->filesystem->pathExists($path)) { return array(); } if ('.php' === substr($path, -4)) { return array($this->createResourceFromSpecFile(realpath($path))); } $resources = array(); foreach ($this->filesystem->findSpecFilesIn($path) as $file) { $resources[] = $this->createResourceFromSpecFile($file->getRealPath()); } return $resources; }
/** * @param string $filepath * * @return bool */ private function ifFileAlreadyExists($filepath) { return $this->filesystem->pathExists($filepath); }
private function moduleFileExists() { return $this->filesystem->pathExists($this->getFilePath()); }
/** * @param string $filePath * @return bool */ private function fileExists($filePath) { return $this->filesystem->pathExists($filePath); }
private function moduleFileExists($moduleName) { return $this->fileSystem->pathExists($this->getFilePath($moduleName)); }