closedquestion-8.x-3.x-dev/src/Question/Mapping/CqMappingAnd.php
src/Question/Mapping/CqMappingAnd.php
<?php
namespace Drupal\closedquestion\Question\Mapping;
/**
* Class CqMappingAnd.
*
* "And" implementation for mappings. Returns TRUE only of all children return
* TRUE.
*
* @package Drupal\closedquestion\Question\Mapping
*/
class CqMappingAnd extends CqAbstractMapping {
/**
* Implements CqAbstractMapping::evaluate()
*/
public function evaluate() {
foreach ($this->children as $id => $tempExpression) {
if (!$tempExpression->evaluate()) {
return FALSE;
}
}
return TRUE;
}
/**
* Overrides CqAbstractMapping::getAllText()
*/
public function getAllText() {
$retval = array();
$retval['logic']['#markup'] = 'AND';
$retval += parent::getAllText();
return $retval;
}
}
