public function withAutoProcessContent($flag) { if (!is_bool($flag)) { $msg = 'Auto processing flag must be a boolean value!'; throw new \InvalidArgumentException($msg); } $self = clone $this; $self->autoProcessContent = (bool) $flag; return $self; }
public function testProcessContentIfHasChildHandlerButNotParent() { $handlers = new HandlerContainer(); $handlers->add('valid', function (ShortcodeInterface $s) { return $s->getName(); }); $text = 'x [invalid ] [valid /] [/invalid] y'; $processor = new Processor(new RegexParser(), $handlers); $this->assertSame('x [invalid ] valid [/invalid] y', $processor->withAutoProcessContent(true)->process($text)); $this->assertSame('x [invalid ] [valid /] [/invalid] y', $processor->withAutoProcessContent(false)->process($text)); }