Thunder\Shortcode\Processor\Processor::withRecursionDepth PHP Method

withRecursionDepth() public method

Recursion depth level, null means infinite, any integer greater than or equal to zero sets value (number of recursion levels). Zero disables recursion. Defaults to null.
public withRecursionDepth ( integer | null $depth ) : self
$depth integer | null
return self
    public function withRecursionDepth($depth)
    {
        if (null !== $depth && !(is_int($depth) && $depth >= 0)) {
            $msg = 'Recursion depth must be null (infinite) or integer >= 0!';
            throw new \InvalidArgumentException($msg);
        }
        $self = clone $this;
        $self->recursionDepth = $depth;
        return $self;
    }

Usage Example

コード例 #1
0
ファイル: ProcessorTest.php プロジェクト: rhukster/Shortcode
 public function testExceptionOnInvalidRecursionDepth()
 {
     $processor = new Processor(new RegularParser(), new HandlerContainer());
     $this->setExpectedException('InvalidArgumentException');
     $processor->withRecursionDepth(new \stdClass());
 }