Skip to content

Commit

Permalink
Cleanup (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
kylekatarnls authored Jun 28, 2016
1 parent 3813b3b commit 6b73338
Showing 1 changed file with 0 additions and 31 deletions.
31 changes: 0 additions & 31 deletions src/Jade/Compiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,37 +162,6 @@ protected function buffer($line, $indent = null)
$this->buffer[] = $line;
}

/**
* Test agains a array of constants.
*
* @param string $str
*
* @return bool|int
*/
protected function isArrayOfConstants($str)
{
$str = trim($str);

if (0 === strpos($str, 'array(') || 0 === strpos($str, '[')) {

// This pattern matches against array constants: useful for "data-" attributes (see test attrs-data.jade)
//
// simpler regex - explanation
//
// arrray\(\) - matches against the old array construct
// [] - matches against the new/shorter array construct
// (const=>)?const(,recursion) - matches against the value list, values can be a constant or a new array built of constants
if (preg_match("/array[ \t]*\((?R)\)|\\[(?R)\\]|(" . static::CONSTANT_VALUE . '=>)?' . static::CONSTANT_VALUE . '(,(?R))?/', $str, $matches)) {
// cant use ^ and $ because the patter is recursive
if (strlen($matches[0]) == strlen($str)) {
return true;
}
}
}

return false;
}

/**
* @param string $str
*
Expand Down

0 comments on commit 6b73338

Please sign in to comment.