closedquestion-8.x-3.x-dev/src/Question/Mapping/CqMappingNot.php
src/Question/Mapping/CqMappingNot.php
<?php
namespace Drupal\closedquestion\Question\Mapping;
/**
* Class CqMappingNot.
*
* "NOT" implementation for mappings. Returns TRUE if it's one child returns
* FALSE.
*
* @package Drupal\closedquestion\Question\Mapping
*/
class CqMappingNot extends CqAbstractMapping {
/**
* Implements CqAbstractMapping::evaluate()
*/
public function evaluate() {
if (isset($this->children[0])) {
return (!$this->children[0]->evaluate());
}
return FALSE;
}
/**
* Overrides CqAbstractMapping::getAllText()
*/
public function getAllText() {
$retval = array();
$retval['logic']['#markup'] = 'NOT';
$retval += parent::getAllText();
return $retval;
}
}
