File "AndStrategy.php"
Full Path: /home/siazco/grocery.siazco.se/wp-content/plugins/flexible-shipping/vendor_prefixed/wpdesk/wp-show-decision/src/AndStrategy.php
File size: 677 bytes
MIME-type: text/x-php
Charset: utf-8
<?php
namespace FSVendor\WPDesk\ShowDecision;
class AndStrategy implements ShouldShowStrategy
{
/**
* @var ShouldShowStrategy[]
*/
private array $conditions = [];
public function __construct(ShouldShowStrategy $strategy)
{
$this->conditions[] = $strategy;
}
public function addCondition(ShouldShowStrategy $condition): self
{
$this->conditions[] = $condition;
return $this;
}
public function shouldDisplay(): bool
{
foreach ($this->conditions as $condition) {
if (!$condition->shouldDisplay()) {
return \false;
}
}
return \true;
}
}