/** * Notin constructor. * * @param string $field Field. * @param string $value Value. * * @throws InvalidArgumentException If $field is not 'category'. */ public function __construct($field, $value) { parent::__construct($field, $value); if ($field != 'category') { throw new InvalidArgumentException('The in operator "notin" supports only "category" as field.'); } self::$filter = null; }
/** * In constructor. * * @param string $objectType Object type. * @param string $field Field. * @param string $value Value. * * @throws InvalidArgumentException If $field is not 'category'. */ public function __construct($objectType, $field, $value) { // cast all numbers in the list to integers because of security if ($field == 'id') { $ids = explode(',', $value); $newValue = array(); foreach ($ids as $id) { $newValue[] = (int) $id; } $value = $newValue; } parent::__construct($objectType, $field, $value); if ($field != 'category' && $field != 'id') { throw new InvalidArgumentException('The in operator "in" supports only "category" and "id" as field.'); } self::$filter = null; }