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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | 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.