Aerys\BodyParser::when PHP Method

when() public method

public when ( callable $cb, $cbData = null )
$cb callable
    public function when(callable $cb, $cbData = null)
    {
        if ($this->req || !$this->parsing) {
            $this->whens[] = [$cb, $cbData];
        } else {
            $cb($this->error, $this->result, $cbData);
        }
        return $this;
    }