Returns a setting if a predicate is satisfied.
Throws {@see \FeaturePhp\InvalidSettingsException} if the predicate fails.
@param string $key
@param callable $predicate
@return mixed
16352
public function getWith($key, $predicate) {
        $object = $this->get($key);
        if (!call_user_func($predicate, $object))
            throw new fphp\InvalidSettingsException($object, $key);
        return $object;
    }
1258453
private function getSetting($key)
    {
        $settings = $this->settingsHelper->getSettings('general');

        if (array_key_exists($key, $settings)) {
            return $settings[$key];
        }

        return null;
    }
43178
public function exists(Closure $predicate)
    {
        foreach ($this->collections as $key => $element) {
            if ($predicate($key, $element)) {
                return true;
            }
        }

        return false;
    }
67839
public static function get($key)
    {
        self::getInstance();

        if (array_key_exists($key, self::$settings))
        {
            return self::$settings[$key];
        }

        throw new \InvalidArgumentException("The key $key doesn't exist in the Config Registry.");
    }
1272161
public function &__get($key)
    {
        if (!isset($this->stack[$key])) {
            throw new InvalidArgumentException(sprintf('Value "%s" is not defined.', $key));
        }

        $set = isset($this->stack[$key]);

        //return $this->stack[$key];
        $return = $set &&
        is_callable($this->stack[$key]) ?
            $this->stack[$key]($this) :
            $this->stack[$key];

        return $return;
    }
474688
public function hasKey($key)
    {
        if (!is_string($key) && !is_int($key)) {
            throw new InvalidIntOrStringException('key', $key);
        }

        if (!is_array($this->value)) {
            throw new InvalidArrayException($this->name, $this->value);
        }

        if (!array_key_exists($key, $this->value)) {
            throw new ArrayKeyNotExistsException($this->name, $key);
        }

        return $this;
    }
970660
public function defaultSetting($key = null)
    {
        if (!is_null($key)) {
            return $this->settings()->getDefault($key);
        }

        return $this->settings()->allDefaults();
    }
296533
public function get($key)
    {
        if (!$this->has($key)) {
            return null;
        }

        return (new SettingModel)
            ->cached()
            ->where('key', $key)
            ->first()
            ->value;
    }
469164
public function has(string $key): bool
    {
        if (strpos($key, '.') != false) {
            return $this->getNested($key) != null;
        }

        return array_key_exists($key, $this->settings);
    }
874484
public function get(string $key, bool $throwException = true)
    {
        if (!array_key_exists($key, $this->configData)) {
            if ($throwException) {
                throw new \InvalidArgumentException("Key \"{$key}\" not found in configuration with name \"{$this->instanceName}\"");
            }
            return null;
        }
        return $this->configData[$key];
    }
205595
public function takeUntil(callable $predicate)
    {
        return $this->takeWhile(
            function ($value, $key, $iterable) use ($predicate) {
                return !$predicate($value, $key, $iterable);
            }
        );
    }
1190924
public static function get(string $key)
    {
        if (!in_array($key, self::$allowedKeys) || !isset(self::$storedValues[$key])) {
            throw new \InvalidArgumentException('Invalid key given');
        }

        return self::$storedValues[$key];
    }
418603
public function __isset($key)
    {
        if ($this->flag == self::ARRAY_AS_PROPS) {
            return $this->offsetExists($key);
        }

        if (in_array($key, $this->protectedProperties)) {
            throw new \InvalidArgumentException('$key is a protected property, use a different key');
        }

        return isset($this->$key);
    }
938465
public function getSetting($key, $transform = null)
    {
        if (isset($transform[$key])) {
            return $transform[$key];
        }

        return $this[$key];
    }
389220
protected function getSettingOrFail(string $key)
    {
        if (!$this->registry->has($key)) {
            throw new UnregisteredSettingException(
                sprintf(
                    'There\'s no setting registered with key `%s`',
                    $key
                    )
            );
        }

        return $this->registry->get($key);
    }
249651
public function set($key, $value = null)
     {
         if (isset($this->_settings->$key)) {
             $this->_settings->$key = $value;
         }

         return $this->_settings->$key;
     }
1006334
public function normalizeKey($key)
	{
		$normalizedKey = filter_var(
			(preg_match('(^-\\d+$)D', $key)) ? count($this->items) + $key : $key,
			FILTER_VALIDATE_INT,
			[
				'options' => [
					'min_range' => 0,
					'max_range' => count($this->items)
				]
			]
		);

		if ($normalizedKey === false)
		{
			throw new InvalidArgumentException("Invalid offset '" . $key . "'");
		}

		return $normalizedKey;
	}