Sets public keys

@param  string|array $key Public keys
@return self
509401
public function setPublicKey($key)
    {
        if (is_array($key)) {
            foreach ($key as $type => $option) {
                if ($type !== 'public') {
                    $key['public'] = $option;
                    unset($key[$type]);
                }
            }
        } else {
            $key = ['public' => $key];
        }

        return $this->_setKeys($key);
    }
1265864
protected function sforget($key)
    {
        $keys = is_array($key) ? $key : [$key];

        foreach ($keys as $key) {
            $this->cache->forget($this->skey($key));
        }

        $this->cache->forget($this->skey('*'));
    }
891896
public function releaseKey($key)
    {
        $this->executor->execute(DriverCommand::SEND_KEYS_TO_ACTIVE_ELEMENT, [
            'value' => [(string) $key],
        ]);

        return $this;
    }
1117324
public function clear(array $keys=null)
    {
        $keys = $keys === null ? $this->keys() : $keys;

        foreach ($keys as $key) {
            $this->offsetUnset($key);
        }

        return $this;
    }
313959
public function withoutKeys(array $keys): self
    {
        $values = array_diff_key($this->values, array_flip($keys));

        if ($values === $this->values) {
            return $this;
        }

        return new static($values);
    }
36710
public function setData($data, $key = null)
	{
		if (is_array($data) && $key === null) {
			$this->data = $data;

			return $this;
		}

		if ($key === null)
			$key = 'data';

		$this->data[$key] = $data;

		return $this;
	}
281318
protected function set_key($key) {
        $bytes = strlen($key); // Get key length in bytes.

        // Only accept keys with the expected (backup::CIPHERKEYLEN) key length. There are a number of hashing,
        // random generators to achieve this esasily, like the one shown below to create the default
        // site encryption key and ivs.
        if ($bytes !== backup::CIPHERKEYLEN) {
            $info = (object)array('expected' => backup::CIPHERKEYLEN, 'found' => $bytes);
            throw new base_element_struct_exception('encrypted_final_element incorrect key length', $info);
        }
        // Everything went ok, store the key.
        $this->key = $key;
    }
399427
public function setKey($key) {
        if(!$this->setModified('key', $key)->isModified()) {
            return $this;
        }
		$this->key = $key;
		return $this;
    }
654413
public function setEndpoint($key = 'json')
    {
        $endPoints      = ['xml','json'];
        $this->endpoint = (in_array($key,$endPoints)) ? $key : 'json';
        return $this;
    }
1198646
public function set(string $key, $value): self
    {
        $this->data[$key] = $value;

        return $this;
    }
307389
public function setAuthKey($key)
    {
        $authKeyAttribute = $this->authKeyAttribute;
        return (is_string($authKeyAttribute) && !empty($authKeyAttribute)) ? $this->$authKeyAttribute = $key : null;
    }
194319
public function setSecretKey($secretKey)
    {
        $this->secretKey = "-----BEGIN PUBLIC KEY-----" . PHP_EOL . chunk_split($secretKey, 64, PHP_EOL) . "-----END PUBLIC KEY-----";
        $this->checkKey();

        return $this;
    }
620831
public function exclude(...$keys): self {
        if ($keys) {
            foreach ($keys as $key) {
                $this->_excludeKeys[$key] = 1;
            }
        } else {
            $this->_excludeKeys = [];
        }
        return $this;
    }
824148
public function replaceAllKeys(array $keys): self
    {
        return static::create(
            \array_combine($keys, $this->getArray()),
            $this->iteratorClass,
            false
        );
    }
70181
public function pressKey($key)
    {
        $this->executor->execute(DriverCommand::SEND_KEYS_TO_ACTIVE_ELEMENT, [
            'value' => [(string) $key],
        ]);

        return $this;
    }
1365503
public function set($key, $value = null)
    {
        if (is_array($key))
        {
            foreach ($key as $name => $value)
            {
                $this->_data[$name] = $value;
            }
        }
        else
        {
            $this->_data[$key] = $value;
        }

        return $this;
    }
819962
public function setSharedKey($key)
    {
        // If the public key is a file name then convert it to
        // the contents of the file (which should be an RSA public
        // key in PEM format)
        if (file_exists($key)) {
            $this->shared_key = file_get_contents($key);
        } elseif (! empty($key)) {
            $this->shared_key = $key;
        }

        return $this;
    }