Files
DesignPatternsPHP/Behavioral/Interpreter/AndExp.php
2021-04-13 00:16:23 +03:00

21 lines
496 B
PHP

<?php declare(strict_types=1);
namespace DesignPatterns\Behavioral\Interpreter;
class AndExp extends AbstractExp
{
private AbstractExp $first;
private AbstractExp $second;
public function __construct(AbstractExp $first, AbstractExp $second)
{
$this->first = $first;
$this->second = $second;
}
public function interpret(Context $context): bool
{
return (bool) $this->first->interpret($context) && $this->second->interpret($context);
}
}