mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-09-26 06:19:20 +02:00
21 lines
496 B
PHP
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);
|
|
}
|
|
}
|