Make sure the given option exists - raise exception if not

@param string $categoryKey Category key
@param string $optionKey   Option key

@throws InvalidArgumentException

@return void
762890
private function requireOptionExists($categoryKey, $optionKey)
    {
        if (!$this->optionExists($categoryKey, $optionKey)) {
            throw new InvalidArgumentException(
                'Option ' . $optionKey . ' in category ' . $categoryKey . ' does not exist'
            );
        }
    }
8526
public function setActionCategory($action_category)
    {
        $allowedValues = $this->getActionCategoryAllowableValues();
        if (!in_array($action_category, $allowedValues, true)) {
            throw new \InvalidArgumentException(
                sprintf(
                    "Invalid value for 'action_category', must be one of '%s'",
                    implode("', '", $allowedValues)
                )
            );
        }
        $this->container['action_category'] = $action_category;

        return $this;
    }
184803
public function validateId($id)
    {
        if (null === $id) {
            throw new \InvalidArgumentException('Category id missing');
        } elseif (!is_numeric($id) || (int)$id != $id) {
            throw new \InvalidArgumentException('Invalid data type for category id');
        }
    }
403829
public function set($key, $value)
	{
		if ( !($value instanceof Option) &&
			!($value instanceof Optgroup) )
		{
			throw new \InvalidArgumentException('Only Options or Optgroups can be added to a Select.');
		}

		parent::set($key, $value);
		return $this;
	}
319406
public function setUniqueKey($uniqueKey)
    {
        if (! is_null($this->uniqueKey)) {
            throw new RuntimeException('The unique key was already set.');
        }
        if (! is_int($uniqueKey) && ! is_string($uniqueKey)) {
            throw new InvalidArgumentException(sprintf(
                'Invalid type of specified unique key; must be an integer or '
                . 'an string, "%s" received.',
                gettype($uniqueKey)
            ));
        }
        $this->uniqueKey = $uniqueKey;
    }
1232259
public function setOption($key, $value)
    {
        if (!in_array($key, array_keys($this->defaultOptions))) {
            throw InvalidOptionException::build([], ['option' => $key]);
        }

        $this->options[$key] = $value;
    }
1160333
public function removeOptionType(OptionType $optionType): void
    {
        if (!$this->optionTypes->contains($optionType)) {
            throw new InvalidArgumentException(sprintf('OptionType « %s » for product « %s » is not set', $optionType->getName(), $this->getName()));
        }
        $this->optionTypes->removeElement($optionType);
        $optionType->removeProduct($this);
    }
255802
public boolean hasProperty(String category, String key) {
		return this.categories.containsKey(category) && this.categories.get(category).containsKey(key);
	}
1354355
public function validateOptions()
    {
        if (!$this->rules instanceof AllOf) {
            throw new InvalidArgumentException('Validation rules are missing or invalid');
        }

        if (!$this->hasKey()) {
            throw new InvalidArgumentException('A key must be set');
        }

        if ($this->hasMessage() && !is_string($this->message)) {
            throw new InvalidArgumentException(sprintf('Expected custom message to be of type string, %s given', gettype($this->message)));
        }
    }
227501
protected function dbInsert($category, $key, $value)
    {
        $created_by = \Yii::$app->user->getId();
        $this->getDb()->createCommand('
        INSERT INTO
            {{setting}} (`category`, `key`, `value`, `created_at`, `created_by`)
        VALUES
            (:category, :key, :value, NOW(), :created_by)
        ', compact('category', 'key', 'value', 'created_by'))->execute();
    }
775879
public function hasKey($nsKey, $itemKey)
    {
        $this->prepareCache($nsKey);

        return array_key_exists($itemKey, $this->contents[$nsKey]);
    }
105035
public function update(User $user, $option, $categoryKey)
    {
        if (!empty($option)) {
            return $user->hasPermission('options-update-' . $categoryKey);
        }
        return false;
    }
770802
public function getOption($categoryKey, $optionKey)
    {
        $this->requireOptionExists($categoryKey, $optionKey);


        return $this->options[$categoryKey][$optionKey];
    }
1075753
public void setDefault(String category, String key, String value) {
		if (this.hasProperty(category, key)) return;
		this.setProperty(category, key, value);
	}
102468
private static void validateCategories(String... categories) {

        for (String category : categories) {
            if (!category.matches(FCM_TOPIC_PATTERN)) {
                throw new IllegalArgumentException(String.format("%s does not match %s", category, FCM_TOPIC_PATTERN));
            }
        }
    }
1345832
public function setTypeConverterOption($typeConverter, $optionKey, $optionValue)
    {
        foreach ($this->getTypeConvertersWithParentClasses($typeConverter) as $typeConverter) {
            $this->configuration[$typeConverter][$optionKey] = $optionValue;
        }
        return $this;
    }
1078004
protected function validateKey(/*# string */ &$key)
    {
        // validate key
        if (is_string($key)) {
            $key = trim($key);
            return;
        }

        // throw exception
        throw new InvalidArgumentException(
            Message::get(Message::CACHE_INVALID_KEY, $key),
            Message::CACHE_INVALID_KEY
        );
    }