Latte\Helpers::checkCallback PHP Method

checkCallback() public static method

Checks callback.
public static checkCallback ( $callable ) : callable
return callable
    public static function checkCallback($callable)
    {
        if (!is_callable($callable, FALSE, $text)) {
            throw new \InvalidArgumentException("Callback '{$text}' is not callable.");
        }
        return $callable;
    }

Usage Example

Example #1
0
 public function addMacro($name, $begin, $end = NULL, $attr = NULL, $flags = NULL)
 {
     if (!$begin && !$end && !$attr) {
         throw new \InvalidArgumentException("At least one argument must be specified for macro '{$name}'.");
     }
     foreach ([$begin, $end, $attr] as $arg) {
         if ($arg && !is_string($arg)) {
             Latte\Helpers::checkCallback($arg);
         }
     }
     $this->macros[$name] = [$begin, $end, $attr];
     $this->compiler->addMacro($name, $this, $flags);
     return $this;
 }
All Usage Examples Of Latte\Helpers::checkCallback