You are here

public function ServicesClientPropertyCondition::match in Services Client 7.2

Match entity with condition.

Parameters

stdClass $entity: Drupal entity.

Return value

boolean TRUE if entity matches condition.

Overrides ServicesClientConditionInterface::match

File

include/condition.inc, line 124

Class

ServicesClientPropertyCondition
Test property condition of entity against value.

Code

public function match($entity) {
  switch ($this->config['condition']) {
    case 'empty':
      return $this
        ->isEmpty($entity);
    case 'not_empty':
      return !$this
        ->isEmpty($entity);
    case 'equals':
      return $this
        ->equals($entity);
    case 'not_equals':
      return !$this
        ->equals($entity);
    default:
      return FALSE;
  }
}