for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Bonfim\Tpl\Tag;
class Condition extends Tag
{
public function __construct()
$this->if();
$this->elseif();
$this->else();
$this->endif();
}
public function if()
self::match('/@\s*if\s*\((.*?)\)/', function($cond) {
Bonfim\Tpl\Tag\Tag::match()
If this is a false-positive, you can also ignore this issue in your code via the ignore-call annotation
ignore-call
self::/** @scrutinizer ignore-call */
match('/@\s*if\s*\((.*?)\)/', function($cond) {
self::replace("<?php if ($cond) : ?>");
Bonfim\Tpl\Tag\Tag::replace()
replace("<?php if ($cond) : ?>");
});
public function elseif() {
self::match('/@\s*elseif\s*\((.*?)\)/', function($cond) {
match('/@\s*elseif\s*\((.*?)\)/', function($cond) {
self::replace("<?php elseif ($cond) : ?>");
replace("<?php elseif ($cond) : ?>");
public function else()
self::match('/@\s*else/', function () {
match('/@\s*else/', function () {
self::replace("<?php else : ?>");
replace("<?php else : ?>");
public function endif()
$regex = '/@\s*\/if/';
self::match($regex, function () {
match($regex, function () {
self::replace("<?php endif ?>");
replace("<?php endif ?>");