Skip to content

Commit

Permalink
Merge pull request #237 from pug-php/analysis-J2rOwV
Browse files Browse the repository at this point in the history
Apply fixes from StyleCI
  • Loading branch information
kylekatarnls authored May 28, 2020
2 parents 7f6660a + 91faa4c commit 4f5bb74
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
3 changes: 2 additions & 1 deletion src/Pug/Engine/Options.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ protected function setUpFilterAutoload(&$options)
if (class_exists($filter)) {
$this->filters[$name] = method_exists($filter, 'pugInvoke')
? [new $filter(), 'pugInvoke']
: (method_exists($filter, 'parse')
: (
method_exists($filter, 'parse')
? [new $filter(), 'parse']
: $filter
); // @codeCoverageIgnore
Expand Down
12 changes: 6 additions & 6 deletions src/Pug/Engine/OptionsHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ abstract class OptionsHandler extends PugJsEngine
* @var array
*/
protected $optionsAliases = [
'cache' => 'cachedir',
'prettyprint' => 'pretty',
'allowMixedIndent' => 'allow_mixed_indent',
'keepBaseName' => 'keep_base_name',
'notFound' => 'not_found_template',
'customKeywords' => 'keywords',
'cache' => 'cachedir',
'prettyprint' => 'pretty',
'allowMixedIndent' => 'allow_mixed_indent',
'keepBaseName' => 'keep_base_name',
'notFound' => 'not_found_template',
'customKeywords' => 'keywords',
'time_precision' => 'time_precision',
'line_height' => 'line_height',
];
Expand Down
10 changes: 7 additions & 3 deletions src/Pug/Engine/PugJsEngine.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ class PugJsEngine extends Keywords
public function getNodeEngine()
{
if (!$this->nodeEngine) {
$this->nodeEngine = new NodejsPhpFallback($this->hasOption('node_path')
$this->nodeEngine = new NodejsPhpFallback(
$this->hasOption('node_path')
? $this->getDefaultOption('node_path')
: 'node'
);
Expand Down Expand Up @@ -50,7 +51,8 @@ protected function getHtml($file, array &$options)
$directory = dirname($file);
$renderFile = './render.' . time() . mt_rand(0, 999999999) . '.js';
chdir($directory);
file_put_contents($renderFile,
file_put_contents(
$renderFile,
'console.log(require(' . json_encode($realPath) . ')' .
'(require(' . json_encode($options['obj']) . ')));'
);
Expand Down Expand Up @@ -215,7 +217,9 @@ public function renderWithJs($input, $filename, $vars = null, $fallback = null)
];

$optionsFile = $workDirectory . '/options-' . mt_rand(0, 999999999) . '.js';
file_put_contents($optionsFile, 'module.exports = require(' .
file_put_contents(
$optionsFile,
'module.exports = require(' .
json_encode(realpath(NodejsPhpFallback::getPrefixPath() . '/require.js')) .
').appendRequireMethod(' .
(empty($vars) ? '{}' : json_encode($vars, JSON_UNESCAPED_SLASHES)) .
Expand Down

0 comments on commit 4f5bb74

Please sign in to comment.