Set the initialization key for the object

@param string $key Initialization key
@throws \InvalidArgumentException If hash is not valid base32
@return \GAuth\Auth instance
771498
public function setInitKey($key)
    {
        if (preg_match('/^['.implode('', array_keys($this->getLookup())).']+$/', $key) == false) {
            throw new \InvalidArgumentException('Invalid base32 hash!');
        }
        $this->initKey = $key;
        return $this;
    }
222516
public function setLatProperty($key)
    {
        if ($key === null) {
            $this->latProperty = $key;
            return $this;
        }

        if (!is_string($key)) {
            throw new InvalidArgumentException(
                'The "lat_property" must be a string'
            );
        }

        $this->latProperty = $key;
        return $this;
    }
630126
public function setAuth($auth)
    {
        $auth = strtolower($auth);

        if (!in_array($auth, [self::AUTHENTICATION_METHOD_OAUTH])) {
            throw new \InvalidArgumentException('Parameter "auth" must be filled and valid');
        }

        $this->auth = $auth;
        return $this;
    }
427456
public function unsetProperty( $key )
    {

        // readonly safety check
        if( $this->readOnlySafetyCheck() ) {
            return 0;
        }

        if( is_scalar( $key ) ) {
            $keys = array( (string) $key );
        } elseif( is_array( $key ) ) {
            $keys = array_map( 'strval', $key );
        } else {
            throw new \InvalidArgumentException("Bad argument passed to " .__FUNCTION__ );
        }

        $numUnset = 0;

        // remove unsettable properties from this array
        $keys = array_diff( $keys, static::$unsetableProperties);

        // iterate over the keys
        foreach( $keys as $key ) {

            if( array_key_exists( $key, $this->data ) ) {

                if( $key === static::$lateLoadProperty and isset( $this->lateLoadKey ) ) {
                    unset( $this->lateLoadKey );
                    $numUnset++;
                } else {
                    $this->load();
                    if( isset( $this->data[$key] ) ) {
                        $this->data[$key] = null;
                        $numUnset++;
                    }
                }

            }

        }

        return $numUnset;

    }
1367183
public function &__get($key)
    {
        $ret = null;

        if ($this->flag == self::ARRAY_AS_PROPS) {
            $ret =& $this->offsetGet($key);

            return $ret;
        }

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

        return $this->$key;
    }
1086171
protected function _setKeys($keys)
    {
        if (!is_array($keys)) {
            throw new Exception\InvalidArgumentException('Invalid options argument provided to filter');
        }

        foreach ($keys as $type => $key) {
            if (is_file($key) and is_readable($key)) {
                $file = fopen($key, 'r');
                $cert = fread($file, 8192);
                fclose($file);
            } else {
                $cert = $key;
                $key  = count($this->keys[$type]);
            }

            switch ($type) {
                case 'public':
                    $test = openssl_pkey_get_public($cert);
                    if ($test === false) {
                        throw new Exception\InvalidArgumentException("Public key '{$cert}' not valid");
                    }

                    openssl_free_key($test);
                    $this->keys['public'][$key] = $cert;
                    break;
                case 'private':
                    $test = openssl_pkey_get_private($cert, $this->passphrase);
                    if ($test === false) {
                        throw new Exception\InvalidArgumentException("Private key '{$cert}' not valid");
                    }

                    openssl_free_key($test);
                    $this->keys['private'][$key] = $cert;
                    break;
                case 'envelope':
                    $this->keys['envelope'][$key] = $cert;
                    break;
                default:
                    break;
            }
        }

        return $this;
    }
755150
public static function get( $key )
	{
		$key	= strtoupper( $key );
		if( self::has( $key ) )
			return constant( $key );
		throw new InvalidArgumentException( 'Constant "'.$key.'" is not set' );
	}
401380
public function getProvider($key)
    {
        if (!$this->hasProvider($key)) {
            throw new \InvalidArgumentException(sprintf('Location Provider with key "%s" does not exist', $key));
        }

        return $this->providers[$key];
    }
1267529
public static function ensureOnCurve($key)
    {
        $point = self::unserializePoint($key);
        if (!static::curve()->contains($point->getX(), $point->getY())) {
            throw new \InvalidArgumentException(
                'Invalid key. Point is not on the curve.'
            );
        }
    }
604677
public function initKey($key)
    {
        if (!isset($_SESSION[self::SCOPE_KEY])) {
            $_SESSION[self::SCOPE_KEY] = array();
        }
        if (!isset($_SESSION[self::SCOPE_KEY][$key])) {
            $_SESSION[self::SCOPE_KEY][$key] = array();
        }
    }
451030
protected function assertKey($key): void
    {
        if (!is_string($key)) {
            $type = (is_object($key) ? get_class($key) . ' ' : '') . gettype($key);
            throw new InvalidArgumentException("Expected key to be a string, not $type");
        }

        if ($key === '' || preg_match('~[{}()/\\\\@:]~', $key)) {
            throw new InvalidArgumentException("Invalid key '$key'");
        }
    }
63977
public function protect($key) {
        if (!is_string($key)) {
            throw new \Calf\Exception\InvalidArgument('Key must be string.');
        }

        if (!isset($this->_keys[$key])) {
            throw new \Calf\Exception\Runtime('Key doesn\'t exists: ' . $key);
        }

        $this->_protected[$key] = true;
    }
371368
public function keyConvert(string $key) : string
    {
        $key = str_replace(ConfigKey::VALID_NON_ALPHANUM, '_', $key);
        if (!ConfigKey::validate($key)) {
            throw new InvalidArgumentException('Arg key contains invalid character(s).');
        }
        return $key;
    }
897531
public function get( $key ) {

		if ( $this->has( $key ) ) {
			return $this->container[strtolower( $key )];
		}

		throw new InvalidArgumentException( "{$key} is unknown" );
	}
422968
public function setPrivateKey($privateKey)
    {
        $privateKey = <<<PKEY
-----BEGIN RSA PRIVATE KEY-----
$privateKey
-----END RSA PRIVATE KEY-----
PKEY;

        if (!$privateKey = @openssl_pkey_get_private($privateKey)) {
            throw new \Exception("Invalid private key given.");
        }

        $this->privateKey = $privateKey;
    }
337486
protected function _key($key)
    {
        $key = $this->key($key);
        if ($key === false) {
            throw new InvalidArgumentException('An empty value is not valid as a cache key');
        }

        return $this->_config['prefix'] . $key;
    }
444292
protected function setKey($key): self
    {
        assert(is_resource($key) === true);

        $this->closeKey();
        $this->key = $key;

        return $this;
    }