You are here

protected static function RestfulDataProviderCToolsPlugins::isValidConjunctionForFilter in RESTful 7

Overrides \RestfulBase::isValidConjuctionForFilter().

Overrides RestfulBase::isValidConjunctionForFilter

File

plugins/restful/RestfulDataProviderCToolsPlugins.php, line 116
Contains \RestfulDataProviderCToolsPlugins

Class

RestfulDataProviderCToolsPlugins
@file Contains \RestfulDataProviderCToolsPlugins

Code

protected static function isValidConjunctionForFilter($conjunction) {
  $allowed_conjunctions = array(
    'AND',
    'OR',
  );
  if (!in_array(strtoupper($conjunction), $allowed_conjunctions)) {
    throw new \RestfulBadRequestException(format_string('Conjunction "@conjunction" is not allowed for filtering on this resource. Allowed conjunctions are: !allowed', array(
      '@conjunction' => $conjunction,
      '!allowed' => implode(', ', $allowed_conjunctions),
    )));
  }
}