@@ -21,7 +21,7 @@ |
||
| 21 | 21 | $templateFunction = new \Transphporm\TSSFunction\Template($config->getElementData(), $config->getCssToXpath(), $baseDir); |
| 22 | 22 | $functionSet->addFunction('template', $templateFunction); |
| 23 | 23 | $functionSet->addFunction('json', new \Transphporm\TSSFunction\Json($baseDir)); |
| 24 | - $functionSet->addFunction('constant', new \Transphporm\TSSFunction\Constant()); |
|
| 24 | + $functionSet->addFunction('constant', new \Transphporm\TSSFunction\Constant()); |
|
| 25 | 25 | $functionSet->addFunction('file', new \Transphporm\TSSFunction\File($baseDir)); |
| 26 | 26 | |
| 27 | 27 | // Register HTML formatter here because it uses the template function |
@@ -7,30 +7,30 @@ |
||
| 7 | 7 | |
| 8 | 8 | class File implements \Transphporm\TSSFunction |
| 9 | 9 | { |
| 10 | - private $filePath; |
|
| 10 | + private $filePath; |
|
| 11 | 11 | |
| 12 | - public function __construct(\Transphporm\FilePath $filePath) |
|
| 13 | - { |
|
| 14 | - $this->filePath = $filePath; |
|
| 15 | - } |
|
| 12 | + public function __construct(\Transphporm\FilePath $filePath) |
|
| 13 | + { |
|
| 14 | + $this->filePath = $filePath; |
|
| 15 | + } |
|
| 16 | 16 | |
| 17 | - /** |
|
| 18 | - * @param array $args |
|
| 19 | - * @param \DomElement|null $element |
|
| 20 | - * |
|
| 21 | - * @return array |
|
| 22 | - * @throws \Exception |
|
| 23 | - */ |
|
| 24 | - public function run(array $args, \DomElement $element = null) |
|
| 25 | - { |
|
| 26 | - $fileContents = $args[0]; |
|
| 17 | + /** |
|
| 18 | + * @param array $args |
|
| 19 | + * @param \DomElement|null $element |
|
| 20 | + * |
|
| 21 | + * @return array |
|
| 22 | + * @throws \Exception |
|
| 23 | + */ |
|
| 24 | + public function run(array $args, \DomElement $element = null) |
|
| 25 | + { |
|
| 26 | + $fileContents = $args[0]; |
|
| 27 | 27 | |
| 28 | - $path = $this->filePath->getFilePath($fileContents); |
|
| 29 | - if (!file_exists($path)) { |
|
| 30 | - throw new \Exception('File does not exist at: ' . $path); |
|
| 31 | - } |
|
| 32 | - $fileContents = file_get_contents($path); |
|
| 28 | + $path = $this->filePath->getFilePath($fileContents); |
|
| 29 | + if (!file_exists($path)) { |
|
| 30 | + throw new \Exception('File does not exist at: ' . $path); |
|
| 31 | + } |
|
| 32 | + $fileContents = file_get_contents($path); |
|
| 33 | 33 | |
| 34 | - return $fileContents; |
|
| 35 | - } |
|
| 34 | + return $fileContents; |
|
| 35 | + } |
|
| 36 | 36 | } |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | |
| 28 | 28 | $path = $this->filePath->getFilePath($fileContents); |
| 29 | 29 | if (!file_exists($path)) { |
| 30 | - throw new \Exception('File does not exist at: ' . $path); |
|
| 30 | + throw new \Exception('File does not exist at: '.$path); |
|
| 31 | 31 | } |
| 32 | 32 | $fileContents = file_get_contents($path); |
| 33 | 33 | |