protected Condition::match(array $condition, $value)
Perform the actual matching.
Parameters
array $condition: The condition array as created by the condition() method.
string $value: The value to match against.
Return value
bool TRUE when matches else FALSE.
File
- core/lib/Drupal/Core/Config/Entity/Query/Condition.php, line 156
Class
- Condition
- Defines the condition class for the config entity query.
Namespace
Drupal\Core\Config\Entity\Query
Code
protected function match(array $condition, $value) { if (isset($value)) { // We always want a case-insensitive match. if (!is_bool($value)) { $value = Unicode::strtolower($value); } switch ($condition['operator']) { case '=': return $value == $condition['value']; case '>': return $value > $condition['value']; case '<': return $value < $condition['value']; case '>=': return $value >= $condition['value']; case '<=': return $value <= $condition['value']; case '<>': return $value != $condition['value']; case 'IN': return array_search($value, $condition['value']) !== FALSE; case 'NOT IN': return array_search($value, $condition['value']) === FALSE; case 'STARTS_WITH': return strpos($value, $condition['value']) === 0; case 'CONTAINS': return strpos($value, $condition['value']) !== FALSE; case 'ENDS_WITH': return substr($value, -strlen($condition['value'])) === (string) $condition['value']; case 'IS NOT NULL': return TRUE; case 'IS NULL': return FALSE; default: throw new QueryException('Invalid condition operator.'); } } return $condition['operator'] === 'IS NULL'; }
Please login to continue.