for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* {CLASS SUMMARY}
*
* Date: 7/27/18
* Time: 11:31 PM
* @author Michael Munger <[email protected]>
*/
namespace HPHIO\Farret;
class TemplateHookWithArgs extends AbstractTag
{
public function setup()
$this->type = AbstractTag::HOOK;
type
$this->parseArgs();
}
private function trimArg($arg) {
$arg = str_replace("|",'',$arg);
$arg = trim($arg);
return $arg;
public function parseArgs() {
$argsPattern = '/(\|(?:{{){0,1}([A-Za-z0-9-]+)(?:}}){0,1})/';
$matches = [];
preg_match_all($argsPattern, $this->tag, $matches, PREG_PATTERN_ORDER);
//Clean up the args.
$this->args = array_map([$this,'trimArg'], $matches[0]);
public function getLabel()
$result = (preg_match_all($this->pattern, $this->tag,$matches, PREG_SET_ORDER) !== false);
return ($result ? $matches[0][1] : false);