@@ -37,7 +37,7 @@ |
||
| 37 | 37 | Throwable $previous = null |
| 38 | 38 | ) { |
| 39 | 39 | ///@todo Include Line number & file name within parse error exceptions |
| 40 | - $message .= ', on line ' . Hamle\Hamle::getLineNo() . ' in file ?.hamle'; |
|
| 40 | + $message .= ', on line '.Hamle\Hamle::getLineNo().' in file ?.hamle'; |
|
| 41 | 41 | parent::__construct($message, $code, $previous); |
| 42 | 42 | } |
| 43 | 43 | } |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | private $peg_currPos = 0; |
| 68 | 68 | private $peg_reportedPos = 0; |
| 69 | 69 | private $peg_cachedPos = 0; |
| 70 | - private $peg_cachedPosDetails = array('line' => 1, 'column' => 1, 'seenCR' => false ); |
|
| 70 | + private $peg_cachedPosDetails = array('line' => 1, 'column' => 1, 'seenCR' => false); |
|
| 71 | 71 | private $peg_maxFailPos = 0; |
| 72 | 72 | private $peg_maxFailExpected = array(); |
| 73 | 73 | private $peg_silentFails = 0; |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | $this->peg_currPos = 0; |
| 79 | 79 | $this->peg_reportedPos = 0; |
| 80 | 80 | $this->peg_cachedPos = 0; |
| 81 | - $this->peg_cachedPosDetails = array('line' => 1, 'column' => 1, 'seenCR' => false ); |
|
| 81 | + $this->peg_cachedPosDetails = array('line' => 1, 'column' => 1, 'seenCR' => false); |
|
| 82 | 82 | $this->peg_maxFailPos = 0; |
| 83 | 83 | $this->peg_maxFailExpected = array(); |
| 84 | 84 | $this->peg_silentFails = 0; |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | private function expected($description) { |
| 122 | 122 | throw $this->peg_buildException( |
| 123 | 123 | null, |
| 124 | - array(array("type" => "other", "description" => $description )), |
|
| 124 | + array(array("type" => "other", "description" => $description)), |
|
| 125 | 125 | $this->peg_reportedPos |
| 126 | 126 | ); |
| 127 | 127 | } |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | if ($this->peg_cachedPos !== $pos) { |
| 153 | 153 | if ($this->peg_cachedPos > $pos) { |
| 154 | 154 | $this->peg_cachedPos = 0; |
| 155 | - $this->peg_cachedPosDetails = array( "line" => 1, "column" => 1, "seenCR" => false ); |
|
| 155 | + $this->peg_cachedPosDetails = array("line" => 1, "column" => 1, "seenCR" => false); |
|
| 156 | 156 | } |
| 157 | 157 | $this->peg_advancePos($this->peg_cachedPosDetails, $this->peg_cachedPos, $pos); |
| 158 | 158 | $this->peg_cachedPos = $pos; |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | |
| 214 | 214 | $foundDesc = $found ? json_encode($found) : "end of input"; |
| 215 | 215 | |
| 216 | - $message = "Expected " . $expectedDesc . " but " . $foundDesc . " found."; |
|
| 216 | + $message = "Expected ".$expectedDesc." but ".$foundDesc." found."; |
|
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | return new SyntaxError( |
@@ -314,13 +314,13 @@ discard block |
||
| 314 | 314 | array_walk_recursive($i, function($a) use (&$return) { $return[] = $a; }); |
| 315 | 315 | return $return; |
| 316 | 316 | } |
| 317 | - private function peg_f2($text) { return new \Seufert\Hamle\TextNode\StringLit(join('',$text)); } |
|
| 317 | + private function peg_f2($text) { return new \Seufert\Hamle\TextNode\StringLit(join('', $text)); } |
|
| 318 | 318 | private function peg_f3($body) { return $body; } |
| 319 | 319 | private function peg_f4($name) { |
| 320 | 320 | return new \Seufert\Hamle\TextNode\ScopeId(null, null, new \Seufert\Hamle\TextNode\ModelParam($name)); } |
| 321 | - private function peg_f5($expr, $chain) { if(!$chain) return $expr; |
|
| 321 | + private function peg_f5($expr, $chain) { if (!$chain) return $expr; |
|
| 322 | 322 | $top = array_pop($chain); |
| 323 | - while($chain) { $top = array_pop($chain)->withChain($top); } return $expr->withChain($top); } |
|
| 323 | + while ($chain) { $top = array_pop($chain)->withChain($top); } return $expr->withChain($top); } |
|
| 324 | 324 | private function peg_f6($sub) { return $sub; } |
| 325 | 325 | private function peg_f7($filter) { return $filter; } |
| 326 | 326 | private function peg_f8($name) { return new \Seufert\Hamle\TextNode\ModelParam($name, null); } |
@@ -333,7 +333,7 @@ discard block |
||
| 333 | 333 | private function peg_f15($query) { return new \Seufert\Hamle\TextNode\Query($query); } |
| 334 | 334 | private function peg_f16($id, $query) { return array_merge([['q'=>'type', 'id'=> $id]], $query); } |
| 335 | 335 | private function peg_f17($query) { return array_merge([['q'=>'type', 'id'=> '*']], $query); } |
| 336 | - private function peg_f18($rel, $sub) { return \Seufert\Hamle\TextNode\RelQuery::for($rel, $sub); } |
|
| 336 | + private function peg_f18($rel, $sub) { return \Seufert\Hamle\TextNode\RelQuery::for ($rel, $sub); } |
|
| 337 | 337 | private function peg_f19() { return '<'; } |
| 338 | 338 | private function peg_f20() { return '>'; } |
| 339 | 339 | private function peg_f21($id) { return ['q'=>'id', 'id'=> $id]; } |
@@ -349,25 +349,25 @@ discard block |
||
| 349 | 349 | private function peg_f31($func, $args) { return new \Seufert\Hamle\TextNode\FilterFunc($func, null, $args); } |
| 350 | 350 | private function peg_f32($func) { return new \Seufert\Hamle\TextNode\FilterFunc($func); } |
| 351 | 351 | private function peg_f33($arg) { return $arg; } |
| 352 | - private function peg_f34($s, $n, $d) { return \Seufert\Hamle\TextNode\FloatLit((float)"$s$n.$d"); } |
|
| 352 | + private function peg_f34($s, $n, $d) { return \Seufert\Hamle\TextNode\FloatLit((float) "$s$n.$d"); } |
|
| 353 | 353 | private function peg_f35($parts) { return $parts[1]; } |
| 354 | 354 | private function peg_f36($s, $e, $post) { |
| 355 | 355 | return \Seufert\Hamle\TextNode\StringConcat::fromParser($s, $e, $post); |
| 356 | 356 | } |
| 357 | - private function peg_f37($s) { return new \Seufert\Hamle\TextNode\StringLit(join('',$s)); } |
|
| 357 | + private function peg_f37($s) { return new \Seufert\Hamle\TextNode\StringLit(join('', $s)); } |
|
| 358 | 358 | private function peg_f38($parts) { return new \Seufert\Hamle\TextNode\StringLit($parts[1]); } |
| 359 | 359 | private function peg_f39($chars) { return join('', $chars); } |
| 360 | 360 | private function peg_f40($c) { return $c; } |
| 361 | 361 | private function peg_f41($s) { return $s; } |
| 362 | 362 | private function peg_f42($char) { return $char; } |
| 363 | 363 | private function peg_f43($sequence) { return $sequence; } |
| 364 | - private function peg_f44($n) { return (int)join('', $n); } |
|
| 365 | - private function peg_f45($sign, $n) { return new \Seufert\Hamle\TextNode\IntLit((int)($sign.join('', $n))); } |
|
| 366 | - private function peg_f46($p, $ex) { return $p.join('',$ex); } |
|
| 364 | + private function peg_f44($n) { return (int) join('', $n); } |
|
| 365 | + private function peg_f45($sign, $n) { return new \Seufert\Hamle\TextNode\IntLit((int) ($sign.join('', $n))); } |
|
| 366 | + private function peg_f46($p, $ex) { return $p.join('', $ex); } |
|
| 367 | 367 | private function peg_f47($p, $s) { return $p.join('', $s); } |
| 368 | 368 | private function peg_f48($s) { return join('', $s); } |
| 369 | - private function peg_f49($name) { return join('',$name); } |
|
| 370 | - private function peg_f50($char_) { return str_replace(['f', 'n', 'r', 't'], ["\f","\n","\r","\t"], $char_); } |
|
| 369 | + private function peg_f49($name) { return join('', $name); } |
|
| 370 | + private function peg_f50($char_) { return str_replace(['f', 'n', 'r', 't'], ["\f", "\n", "\r", "\t"], $char_); } |
|
| 371 | 371 | |
| 372 | 372 | private function peg_parseHtmlInput() { |
| 373 | 373 | |
@@ -3595,89 +3595,89 @@ discard block |
||
| 3595 | 3595 | |
| 3596 | 3596 | $this->peg_FAILED = new \stdClass; |
| 3597 | 3597 | $this->peg_c0 = "{"; |
| 3598 | - $this->peg_c1 = array( "type" => "literal", "value" => "{", "description" => "\"{\"" ); |
|
| 3598 | + $this->peg_c1 = array("type" => "literal", "value" => "{", "description" => "\"{\""); |
|
| 3599 | 3599 | $this->peg_c2 = "}"; |
| 3600 | - $this->peg_c3 = array( "type" => "literal", "value" => "}", "description" => "\"}\"" ); |
|
| 3600 | + $this->peg_c3 = array("type" => "literal", "value" => "}", "description" => "\"}\""); |
|
| 3601 | 3601 | $this->peg_c4 = "$"; |
| 3602 | - $this->peg_c5 = array( "type" => "literal", "value" => "$", "description" => "\"$\"" ); |
|
| 3602 | + $this->peg_c5 = array("type" => "literal", "value" => "$", "description" => "\"$\""); |
|
| 3603 | 3603 | $this->peg_c6 = "|"; |
| 3604 | - $this->peg_c7 = array( "type" => "literal", "value" => "|", "description" => "\"|\"" ); |
|
| 3604 | + $this->peg_c7 = array("type" => "literal", "value" => "|", "description" => "\"|\""); |
|
| 3605 | 3605 | $this->peg_c8 = "("; |
| 3606 | - $this->peg_c9 = array( "type" => "literal", "value" => "(", "description" => "\"(\"" ); |
|
| 3606 | + $this->peg_c9 = array("type" => "literal", "value" => "(", "description" => "\"(\""); |
|
| 3607 | 3607 | $this->peg_c10 = " "; |
| 3608 | - $this->peg_c11 = array( "type" => "literal", "value" => " ", "description" => "\" \"" ); |
|
| 3608 | + $this->peg_c11 = array("type" => "literal", "value" => " ", "description" => "\" \""); |
|
| 3609 | 3609 | $this->peg_c12 = ")"; |
| 3610 | - $this->peg_c13 = array( "type" => "literal", "value" => ")", "description" => "\")\"" ); |
|
| 3610 | + $this->peg_c13 = array("type" => "literal", "value" => ")", "description" => "\")\""); |
|
| 3611 | 3611 | $this->peg_c14 = "["; |
| 3612 | - $this->peg_c15 = array( "type" => "literal", "value" => "[", "description" => "\"[\"" ); |
|
| 3612 | + $this->peg_c15 = array("type" => "literal", "value" => "[", "description" => "\"[\""); |
|
| 3613 | 3613 | $this->peg_c16 = "]"; |
| 3614 | - $this->peg_c17 = array( "type" => "literal", "value" => "]", "description" => "\"]\"" ); |
|
| 3614 | + $this->peg_c17 = array("type" => "literal", "value" => "]", "description" => "\"]\""); |
|
| 3615 | 3615 | $this->peg_c18 = "*"; |
| 3616 | - $this->peg_c19 = array( "type" => "literal", "value" => "*", "description" => "\"*\"" ); |
|
| 3616 | + $this->peg_c19 = array("type" => "literal", "value" => "*", "description" => "\"*\""); |
|
| 3617 | 3617 | $this->peg_c20 = ">"; |
| 3618 | - $this->peg_c21 = array( "type" => "literal", "value" => ">", "description" => "\">\"" ); |
|
| 3618 | + $this->peg_c21 = array("type" => "literal", "value" => ">", "description" => "\">\""); |
|
| 3619 | 3619 | $this->peg_c22 = "<"; |
| 3620 | - $this->peg_c23 = array( "type" => "literal", "value" => "<", "description" => "\"<\"" ); |
|
| 3620 | + $this->peg_c23 = array("type" => "literal", "value" => "<", "description" => "\"<\""); |
|
| 3621 | 3621 | $this->peg_c24 = "&"; |
| 3622 | - $this->peg_c25 = array( "type" => "literal", "value" => "&", "description" => "\"&\"" ); |
|
| 3622 | + $this->peg_c25 = array("type" => "literal", "value" => "&", "description" => "\"&\""); |
|
| 3623 | 3623 | $this->peg_c26 = "g"; |
| 3624 | - $this->peg_c27 = array( "type" => "literal", "value" => "g", "description" => "\"g\"" ); |
|
| 3624 | + $this->peg_c27 = array("type" => "literal", "value" => "g", "description" => "\"g\""); |
|
| 3625 | 3625 | $this->peg_c28 = "t"; |
| 3626 | - $this->peg_c29 = array( "type" => "literal", "value" => "t", "description" => "\"t\"" ); |
|
| 3626 | + $this->peg_c29 = array("type" => "literal", "value" => "t", "description" => "\"t\""); |
|
| 3627 | 3627 | $this->peg_c30 = ";"; |
| 3628 | - $this->peg_c31 = array( "type" => "literal", "value" => ";", "description" => "\";\"" ); |
|
| 3628 | + $this->peg_c31 = array("type" => "literal", "value" => ";", "description" => "\";\""); |
|
| 3629 | 3629 | $this->peg_c32 = "l"; |
| 3630 | - $this->peg_c33 = array( "type" => "literal", "value" => "l", "description" => "\"l\"" ); |
|
| 3630 | + $this->peg_c33 = array("type" => "literal", "value" => "l", "description" => "\"l\""); |
|
| 3631 | 3631 | $this->peg_c34 = "#"; |
| 3632 | - $this->peg_c35 = array( "type" => "literal", "value" => "#", "description" => "\"#\"" ); |
|
| 3632 | + $this->peg_c35 = array("type" => "literal", "value" => "#", "description" => "\"#\""); |
|
| 3633 | 3633 | $this->peg_c36 = ","; |
| 3634 | - $this->peg_c37 = array( "type" => "literal", "value" => ",", "description" => "\",\"" ); |
|
| 3634 | + $this->peg_c37 = array("type" => "literal", "value" => ",", "description" => "\",\""); |
|
| 3635 | 3635 | $this->peg_c38 = "."; |
| 3636 | - $this->peg_c39 = array( "type" => "literal", "value" => ".", "description" => "\".\"" ); |
|
| 3636 | + $this->peg_c39 = array("type" => "literal", "value" => ".", "description" => "\".\""); |
|
| 3637 | 3637 | $this->peg_c40 = "^"; |
| 3638 | - $this->peg_c41 = array( "type" => "literal", "value" => "^", "description" => "\"^\"" ); |
|
| 3638 | + $this->peg_c41 = array("type" => "literal", "value" => "^", "description" => "\"^\""); |
|
| 3639 | 3639 | $this->peg_c42 = "@"; |
| 3640 | - $this->peg_c43 = array( "type" => "literal", "value" => "@", "description" => "\"@\"" ); |
|
| 3640 | + $this->peg_c43 = array("type" => "literal", "value" => "@", "description" => "\"@\""); |
|
| 3641 | 3641 | $this->peg_c44 = ":"; |
| 3642 | - $this->peg_c45 = array( "type" => "literal", "value" => ":", "description" => "\":\"" ); |
|
| 3642 | + $this->peg_c45 = array("type" => "literal", "value" => ":", "description" => "\":\""); |
|
| 3643 | 3643 | $this->peg_c46 = "-"; |
| 3644 | - $this->peg_c47 = array( "type" => "literal", "value" => "-", "description" => "\"-\"" ); |
|
| 3644 | + $this->peg_c47 = array("type" => "literal", "value" => "-", "description" => "\"-\""); |
|
| 3645 | 3645 | $this->peg_c48 = "!"; |
| 3646 | - $this->peg_c49 = array( "type" => "literal", "value" => "!", "description" => "\"!\"" ); |
|
| 3646 | + $this->peg_c49 = array("type" => "literal", "value" => "!", "description" => "\"!\""); |
|
| 3647 | 3647 | $this->peg_c50 = "/^[0-9]/"; |
| 3648 | - $this->peg_c51 = array( "type" => "class", "value" => "[0-9]", "description" => "[0-9]" ); |
|
| 3648 | + $this->peg_c51 = array("type" => "class", "value" => "[0-9]", "description" => "[0-9]"); |
|
| 3649 | 3649 | $this->peg_c52 = "\""; |
| 3650 | - $this->peg_c53 = array( "type" => "literal", "value" => "\"", "description" => "\"\\\"\"" ); |
|
| 3650 | + $this->peg_c53 = array("type" => "literal", "value" => "\"", "description" => "\"\\\"\""); |
|
| 3651 | 3651 | $this->peg_c54 = "'"; |
| 3652 | - $this->peg_c55 = array( "type" => "literal", "value" => "'", "description" => "\"'\"" ); |
|
| 3653 | - $this->peg_c56 = array("type" => "other", "description" => "string" ); |
|
| 3652 | + $this->peg_c55 = array("type" => "literal", "value" => "'", "description" => "\"'\""); |
|
| 3653 | + $this->peg_c56 = array("type" => "other", "description" => "string"); |
|
| 3654 | 3654 | $this->peg_c57 = "\\"; |
| 3655 | - $this->peg_c58 = array( "type" => "literal", "value" => "\\", "description" => "\"\\\\\"" ); |
|
| 3656 | - $this->peg_c59 = array("type" => "any", "description" => "any character" ); |
|
| 3655 | + $this->peg_c58 = array("type" => "literal", "value" => "\\", "description" => "\"\\\\\""); |
|
| 3656 | + $this->peg_c59 = array("type" => "any", "description" => "any character"); |
|
| 3657 | 3657 | $this->peg_c60 = "/^[a-zA-Z_]/"; |
| 3658 | - $this->peg_c61 = array( "type" => "class", "value" => "[a-zA-Z_]", "description" => "[a-zA-Z_]" ); |
|
| 3658 | + $this->peg_c61 = array("type" => "class", "value" => "[a-zA-Z_]", "description" => "[a-zA-Z_]"); |
|
| 3659 | 3659 | $this->peg_c62 = "/^[a-zA-Z0-9_]/"; |
| 3660 | - $this->peg_c63 = array( "type" => "class", "value" => "[a-zA-Z0-9_]", "description" => "[a-zA-Z0-9_]" ); |
|
| 3660 | + $this->peg_c63 = array("type" => "class", "value" => "[a-zA-Z0-9_]", "description" => "[a-zA-Z0-9_]"); |
|
| 3661 | 3661 | $this->peg_c64 = "/^[a-zA-Z_-]/"; |
| 3662 | - $this->peg_c65 = array( "type" => "class", "value" => "[a-zA-Z_-]", "description" => "[a-zA-Z_-]" ); |
|
| 3662 | + $this->peg_c65 = array("type" => "class", "value" => "[a-zA-Z_-]", "description" => "[a-zA-Z_-]"); |
|
| 3663 | 3663 | $this->peg_c66 = "/^[0-9a-zA-Z_-]/"; |
| 3664 | - $this->peg_c67 = array( "type" => "class", "value" => "[0-9a-zA-Z_-]", "description" => "[0-9a-zA-Z_-]" ); |
|
| 3664 | + $this->peg_c67 = array("type" => "class", "value" => "[0-9a-zA-Z_-]", "description" => "[0-9a-zA-Z_-]"); |
|
| 3665 | 3665 | $this->peg_c68 = "/^[^{\\\$]/"; |
| 3666 | - $this->peg_c69 = array( "type" => "class", "value" => "[{\$]", "description" => "[{\$]" ); |
|
| 3666 | + $this->peg_c69 = array("type" => "class", "value" => "[{\$]", "description" => "[{\$]"); |
|
| 3667 | 3667 | $this->peg_c70 = "/^[a-z]/"; |
| 3668 | - $this->peg_c71 = array( "type" => "class", "value" => "[a-z]", "description" => "[a-z]" ); |
|
| 3668 | + $this->peg_c71 = array("type" => "class", "value" => "[a-z]", "description" => "[a-z]"); |
|
| 3669 | 3669 | $this->peg_c72 = "/^[^{]/"; |
| 3670 | - $this->peg_c73 = array( "type" => "class", "value" => "[{]", "description" => "[{]" ); |
|
| 3670 | + $this->peg_c73 = array("type" => "class", "value" => "[{]", "description" => "[{]"); |
|
| 3671 | 3671 | $this->peg_c74 = "/^[\\n\\r\\x{2028}\\x{2029}]/"; |
| 3672 | - $this->peg_c75 = array( "type" => "class", "value" => "[\n\r\x{2028}\x{2029}]", "description" => "[\n\r\x{2028}\x{2029}]" ); |
|
| 3672 | + $this->peg_c75 = array("type" => "class", "value" => "[\n\r\x{2028}\x{2029}]", "description" => "[\n\r\x{2028}\x{2029}]"); |
|
| 3673 | 3673 | $this->peg_c76 = "/^['\"\\\\fnrt]/"; |
| 3674 | - $this->peg_c77 = array( "type" => "class", "value" => "['\"\\fnrt]", "description" => "['\"\\fnrt]" ); |
|
| 3674 | + $this->peg_c77 = array("type" => "class", "value" => "['\"\\fnrt]", "description" => "['\"\\fnrt]"); |
|
| 3675 | 3675 | |
| 3676 | - $peg_startRuleFunctions = array( 'HtmlInput' => array($this, "peg_parseHtmlInput"), 'CodeInput' => array($this, "peg_parseCodeInput"), 'ControlInput' => array($this, "peg_parseControlInput") ); |
|
| 3676 | + $peg_startRuleFunctions = array('HtmlInput' => array($this, "peg_parseHtmlInput"), 'CodeInput' => array($this, "peg_parseCodeInput"), 'ControlInput' => array($this, "peg_parseControlInput")); |
|
| 3677 | 3677 | $peg_startRuleFunction = array($this, "peg_parseHtmlInput"); |
| 3678 | 3678 | if (isset($options["startRule"])) { |
| 3679 | 3679 | if (!(isset($peg_startRuleFunctions[$options["startRule"]]))) { |
| 3680 | - throw new \Exception("Can't start parsing from rule \"" + $options["startRule"] + "\"."); |
|
| 3680 | + throw new \Exception("Can't start parsing from rule \"" +$options["startRule"] + "\"."); |
|
| 3681 | 3681 | } |
| 3682 | 3682 | |
| 3683 | 3683 | $peg_startRuleFunction = $peg_startRuleFunctions[$options["startRule"]]; |
@@ -3691,7 +3691,7 @@ discard block |
||
| 3691 | 3691 | return $peg_result; |
| 3692 | 3692 | } else { |
| 3693 | 3693 | if ($peg_result !== $this->peg_FAILED && $this->peg_currPos < $this->input_length) { |
| 3694 | - $this->peg_fail(array("type" => "end", "description" => "end of input" )); |
|
| 3694 | + $this->peg_fail(array("type" => "end", "description" => "end of input")); |
|
| 3695 | 3695 | } |
| 3696 | 3696 | |
| 3697 | 3697 | $exception = $this->peg_buildException(null, $this->peg_maxFailExpected, $this->peg_maxFailPos); |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | $this->source[] = $ref; |
| 46 | 46 | $this->baseType = $tag; |
| 47 | 47 | self::$var++; |
| 48 | - $this->varname = "\$dynhtml" . self::$var; |
|
| 48 | + $this->varname = "\$dynhtml".self::$var; |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | function render(int $indent = 0, bool $minify = false): string |
@@ -58,16 +58,16 @@ discard block |
||
| 58 | 58 | 'content' => $this->content, |
| 59 | 59 | ]); |
| 60 | 60 | $out = |
| 61 | - '<?php ' . |
|
| 62 | - $this->varname . |
|
| 63 | - "=$data; echo Hamle\\Tag\\DynHtml::toStTag(" . |
|
| 64 | - $this->varname . |
|
| 61 | + '<?php '. |
|
| 62 | + $this->varname. |
|
| 63 | + "=$data; echo Hamle\\Tag\\DynHtml::toStTag(". |
|
| 64 | + $this->varname. |
|
| 65 | 65 | ",\$form)."; |
| 66 | - $out .= "implode(\"\\n\"," . $this->varname . "['content'])."; |
|
| 66 | + $out .= "implode(\"\\n\",".$this->varname."['content'])."; |
|
| 67 | 67 | $out .= |
| 68 | - 'Hamle\\Tag\\DynHtml::toEnTag(' . |
|
| 69 | - $this->varname . |
|
| 70 | - ",\$form)?>" . |
|
| 68 | + 'Hamle\\Tag\\DynHtml::toEnTag('. |
|
| 69 | + $this->varname. |
|
| 70 | + ",\$form)?>". |
|
| 71 | 71 | ($minify ? '' : "\n"); |
| 72 | 72 | return $out; |
| 73 | 73 | } |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | ->getField($source) |
| 85 | 85 | ->getDynamicAtt($d['base'], $d['opt'], $d['type'], $d['content']); |
| 86 | 86 | } |
| 87 | - $out = '<' . $d['type'] . ' '; |
|
| 87 | + $out = '<'.$d['type'].' '; |
|
| 88 | 88 | foreach ($d['opt'] as $k => $v) { |
| 89 | 89 | if (is_array($v)) { |
| 90 | 90 | foreach ($v as $k2 => $v2) { |
@@ -92,15 +92,15 @@ discard block |
||
| 92 | 92 | /** |
| 93 | 93 | * @psalm-suppress UndefinedMethod |
| 94 | 94 | */ |
| 95 | - $v[$k2] = eval('return ' . $v[$k2]->toPHP() . ';'); |
|
| 95 | + $v[$k2] = eval('return '.$v[$k2]->toPHP().';'); |
|
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | 98 | $v = implode(' ', $v); |
| 99 | 99 | } |
| 100 | 100 | if ($v instanceof H\Text) { |
| 101 | - $v = eval('return ' . $v->toPHP() . ';'); |
|
| 101 | + $v = eval('return '.$v->toPHP().';'); |
|
| 102 | 102 | } |
| 103 | - $out .= $k . "=\"" . htmlspecialchars($v) . "\" "; |
|
| 103 | + $out .= $k."=\"".htmlspecialchars($v)."\" "; |
|
| 104 | 104 | } |
| 105 | 105 | $out .= in_array($d['type'], self::$selfCloseTags) ? '/>' : '>'; |
| 106 | 106 | return $out; |
@@ -110,6 +110,6 @@ discard block |
||
| 110 | 110 | { |
| 111 | 111 | return in_array($d['type'], self::$selfCloseTags) |
| 112 | 112 | ? '' |
| 113 | - : '</' . $d['type'] . '>'; |
|
| 113 | + : '</'.$d['type'].'>'; |
|
| 114 | 114 | } |
| 115 | 115 | } |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | function renderStTag(): string |
| 85 | 85 | { |
| 86 | 86 | $close = in_array($this->type, self::$selfCloseTags) ? ' />' : '>'; |
| 87 | - return "<{$this->type}" . $this->optToTags() . $close; |
|
| 87 | + return "<{$this->type}".$this->optToTags().$close; |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | function renderEnTag(): string |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | $v = new H\Text($v ?? ''); |
| 115 | 115 | } |
| 116 | 116 | $k = new H\Text($k); |
| 117 | - $out[] = ' ' . $k->toHTML() . "=\"" . $v->toHTMLAtt() . "\""; |
|
| 117 | + $out[] = ' '.$k->toHTML()."=\"".$v->toHTMLAtt()."\""; |
|
| 118 | 118 | } |
| 119 | 119 | return implode('', $out); |
| 120 | 120 | } |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | static function fromParser( |
| 33 | 33 | array $chars, |
| 34 | 34 | ?Evaluated $expr = null, |
| 35 | - string|StringLit|StringConcat $rhs = null |
|
| 35 | + string | StringLit | StringConcat $rhs = null |
|
| 36 | 36 | ): self { |
| 37 | 37 | $o = []; |
| 38 | 38 | if ($chars) { |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | $this->filters = $filters; |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | - static function for(string $rel, array $filters): self |
|
| 22 | + static function for (string $rel, array $filters): self |
|
| 23 | 23 | { |
| 24 | 24 | return new self( |
| 25 | 25 | $rel === '>' ? Hamle::REL_CHILD : Hamle::REL_PARENT, |
@@ -30,9 +30,9 @@ discard block |
||
| 30 | 30 | public function apply(string $out): string |
| 31 | 31 | { |
| 32 | 32 | $out = |
| 33 | - $out . |
|
| 34 | - "->hamleRel({$this->rel}," . |
|
| 35 | - Query::queryParams($this->filters, true) . |
|
| 33 | + $out. |
|
| 34 | + "->hamleRel({$this->rel},". |
|
| 35 | + Query::queryParams($this->filters, true). |
|
| 36 | 36 | ')'; |
| 37 | 37 | if ($this->chain) { |
| 38 | 38 | $out = $this->chain->apply($out); |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | { |
| 43 | 43 | $m = []; |
| 44 | 44 | if ( |
| 45 | - !preg_match('/^ +([><]) +(' . self::REGEX_FUNCSEL . '+)(.*)$/', $s, $m) |
|
| 45 | + !preg_match('/^ +([><]) +('.self::REGEX_FUNCSEL.'+)(.*)$/', $s, $m) |
|
| 46 | 46 | ) { |
| 47 | 47 | throw new ParseError("Unable to read \$ sub func in '$s'"); |
| 48 | 48 | } |
@@ -71,18 +71,18 @@ discard block |
||
| 71 | 71 | public function toPHP(): string |
| 72 | 72 | { |
| 73 | 73 | $limit = |
| 74 | - Hamle\Text::varToCode($this->sortlimit['sort']) . |
|
| 75 | - ',' . |
|
| 76 | - $this->sortlimit['limit'] . |
|
| 77 | - ',' . |
|
| 78 | - $this->sortlimit['offset'] . |
|
| 79 | - ',' . |
|
| 74 | + Hamle\Text::varToCode($this->sortlimit['sort']). |
|
| 75 | + ','. |
|
| 76 | + $this->sortlimit['limit']. |
|
| 77 | + ','. |
|
| 78 | + $this->sortlimit['offset']. |
|
| 79 | + ','. |
|
| 80 | 80 | $this->grouptype['grouptype']; |
| 81 | - $sub = $this->sub ? '->' . $this->sub->toPHP() : ''; |
|
| 82 | - return 'hamleRel(' . |
|
| 83 | - $this->dir . |
|
| 84 | - ',' . |
|
| 85 | - Hamle\Text::varToCode($this->filt['tag']) . |
|
| 81 | + $sub = $this->sub ? '->'.$this->sub->toPHP() : ''; |
|
| 82 | + return 'hamleRel('. |
|
| 83 | + $this->dir. |
|
| 84 | + ','. |
|
| 85 | + Hamle\Text::varToCode($this->filt['tag']). |
|
| 86 | 86 | ",$limit)$sub"; |
| 87 | 87 | } |
| 88 | 88 | |
@@ -101,8 +101,8 @@ discard block |
||
| 101 | 101 | if (!$model->valid()) { |
| 102 | 102 | if (!$parent instanceof Hamle\WriteModel) { |
| 103 | 103 | throw new \RuntimeException( |
| 104 | - 'Cant create model, ' . |
|
| 105 | - get_class($parent) . |
|
| 104 | + 'Cant create model, '. |
|
| 105 | + get_class($parent). |
|
| 106 | 106 | ' must implement Hamle\\WriteModel.', |
| 107 | 107 | ); |
| 108 | 108 | } |
@@ -38,11 +38,11 @@ |
||
| 38 | 38 | |
| 39 | 39 | function toPHP(): string |
| 40 | 40 | { |
| 41 | - return '$form->getField(' . Text::varToCode($this->var) . ')->getValue()'; |
|
| 41 | + return '$form->getField('.Text::varToCode($this->var).')->getValue()'; |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | function toHTML(bool $escape = false): string |
| 45 | 45 | { |
| 46 | - return '<?=' . $this->toPHP() . '?>'; |
|
| 46 | + return '<?='.$this->toPHP().'?>'; |
|
| 47 | 47 | } |
| 48 | 48 | } |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | throw new ParseError("Unable to parse filter expression \"$s\""); |
| 73 | 73 | } |
| 74 | 74 | if (method_exists(Filter::class, $this->filter)) { |
| 75 | - $this->filter = Filter::class . '::' . $this->filter; |
|
| 75 | + $this->filter = Filter::class.'::'.$this->filter; |
|
| 76 | 76 | } elseif ( |
| 77 | 77 | in_array($this->filter, ['round', 'strtoupper', 'strtolower', 'ucfirst']) |
| 78 | 78 | ) { |
@@ -92,9 +92,9 @@ discard block |
||
| 92 | 92 | function toHTML(bool $escape = false): string |
| 93 | 93 | { |
| 94 | 94 | if ($escape) { |
| 95 | - return '<?=htmlspecialchars(' . $this->toPHP() . ')?>'; |
|
| 95 | + return '<?=htmlspecialchars('.$this->toPHP().')?>'; |
|
| 96 | 96 | } |
| 97 | - return '<?=' . $this->toPHP() . '?>'; |
|
| 97 | + return '<?='.$this->toPHP().'?>'; |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | function toPHPpre(): string |
@@ -114,14 +114,14 @@ discard block |
||
| 114 | 114 | } |
| 115 | 115 | $o = ''; |
| 116 | 116 | foreach ($this->vars as $v) { |
| 117 | - $o .= ',' . $this->varToCode($v); |
|
| 117 | + $o .= ','.$this->varToCode($v); |
|
| 118 | 118 | } |
| 119 | 119 | return "$o)$post"; |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | function toPHP(): string |
| 123 | 123 | { |
| 124 | - return $this->toPHPpre() . $this->what->toPHPVar() . $this->toPHPpost(); |
|
| 124 | + return $this->toPHPpre().$this->what->toPHPVar().$this->toPHPpost(); |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | static function itersplit(mixed $v, string $sep = ','): Model |