Aerys\Body::when PHP Method

when() public method

public when ( callable $func, $data = null )
$func callable
    public function when(callable $func, $data = null)
    {
        if (isset($this->string)) {
            $func($this->error, $this->string, $data);
        } else {
            $this->whens[] = [$func, $data];
        }
        return $this;
    }