mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-06-11 16:30:51 +02:00
21 lines
412 B
PHP
21 lines
412 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace DesignPatterns\Behavioral\Interpreter;
|
|
|
|
/**
|
|
* This NoTerminalExpression
|
|
*/
|
|
class OrExp extends AbstractExp
|
|
{
|
|
public function __construct(private AbstractExp $first, private AbstractExp $second)
|
|
{
|
|
}
|
|
|
|
public function interpret(Context $context): bool
|
|
{
|
|
return $this->first->interpret($context) || $this->second->interpret($context);
|
|
}
|
|
}
|