/** * @param Criterion $criterion * @return bool */ public function canAdd(Criterion $criterion) { $allowedKeys = $this->getAllowedKeys(); if (empty($allowedKeys)) { return true; } return in_array($criterion->getKey(), $allowedKeys); }