Add a key.

@since 2.8.0

@param string $key A hashed key.
@return bool True on success, false on failure.
549549
public function addKey( $key ) {
		/*
		 * @todo The majority of this method has been copied from
		 * Boldgrid\Library\Library\Notice\KeyPrompt\addKey() because the logic to add a key should
		 * be in this class and not the KeyPrompt class. that KeyPrompt method needs to be refactored.
		 */

		// When adding Keys, delete the transient to make sure we get new license info.
		delete_site_transient( 'bg_license_data' );
		delete_site_transient( 'boldgrid_api_data' );

		$data = $this->callCheckVersion( array( 'key' => $key ) );

		if ( is_object( $data ) ) {
			$this->save( $data, $key );
			return true;
		} else {
			return false;
		}
	}
1101835
public function addTable(string $key) : TomlBuilder
    {
        $this->exceptionIfKeyEmpty($key);
        $addPreNewline = $this->currentLine > 0 ? true : false;
        $keyParts = explode('.', $key);

        foreach ($keyParts as $keyPart) {
            $this->exceptionIfKeyEmpty($keyPart, "Table: \"{$key}\".");
            $this->exceptionIfKeyIsNotUnquotedKey($keyPart);
        }

        $line = "[{$key}]";
        $this->addTableKey($key);
        $this->append($line, true, false, $addPreNewline);

        return $this;
    }
1216428
protected function getFileKey($key)
    {
        $key = (string) $key;
        if (!array_key_exists($key, $this->fileKeys))
        {
            $this->fileKeys[$key] = new FileKey($key);
        }
        
        return $this->fileKeys[$key];
    }
318103
public function add($key, $value)
    {
        if (!$key) {
            return $this;
        }

        $this->param[$key] = $value;

        return $this;
    }
46211
public function tableHaskey($table, $key)
	{
		$keys = $this->getTableKeys($table);

		if (!is_array($keys))
		{
			return false;
		}

		return isset($keys[$key]);
	}
557055
public function requestHasToken($key)
    {
        $token = $this->request->input($key, null);
        
        if($token && $token === $this->getToken($key))
        {
            return true;
        }

        return false;
    }
476172
protected function _hashKey( $key )
    {
        if ( null !== $this->_keyHashCallback && is_callable( $this->_keyHashCallback ) )
        {
            $_arguments = func_get_args();

            return call_user_func_array( $this->_keyHashCallback, $_arguments );
        }

        return $key;
    }
663871
public function removeKey($key)
    {
        if ($this->hasKey($key)) {
            unset($this->container[$key]);
            return true;
        } else {
            return false;
        }
    }
307389
public function setAuthKey($key)
    {
        $authKeyAttribute = $this->authKeyAttribute;
        return (is_string($authKeyAttribute) && !empty($authKeyAttribute)) ? $this->$authKeyAttribute = $key : null;
    }
220977
public function containsKey($key)
    {
        if (!$this->enabled)
            return false;

        $has_key = array_key_exists($this->key($key), $this->cache);

        // $this->Logger->debug("Cache contains {$key}? " . (($has_key) ? 'TRUE' : 'FALSE'));

        return $has_key;
    }
75183
public function newFromKey($key)
    {
        $scope = $this->get($key);
        if ($this->checkRefs && is_array($scope)) {
            $this->replaceRefs($key, $scope);
        }
        $result = new static($scope);

        return $result;
    }
347567
public function setKey($key)
    {
        $arr = $this->parseKey($key);
        $this->key = $arr['key'];
        $this->identifier = $arr['identifier'];
        $this->prefix = $arr['prefix'];

        return $this;
    }
1030155
public function setKey($key)
    {
        $this->hash = null;

        if (empty($key)) {
            $this->key = null;
            return;
        }

        $this->key = (string) $key;
        $this->hash = $this->makeHash($key);
    }
597948
public static function has(string $key) : bool
  {
    if ((new Cache)->retrieve($key) == null) return false;
    return true;
  }
841592
public function setApiKey($key)
    {
        $this->apiKey = $key;
        return $this->apiKey === $key ? true : false;
    }
1313834
public static function push($key, $data)
    {
        if (is_callable($data)) {
            $content = $data();
        } else {
            $content = $data;
        }

        static::$with_meta = true;

        $cache = static::get($key);

        static::$with_meta = false;

        if (is_array($cache['content'])) {
            array_push($cache['content'], $content);
        } else {
            $cache['content'] .= $content;
        }

        return (bool) file_put_contents(
            static::makeHashFilename($key),
            serialize($cache)
        );
    }
1220614
public function filled($key): bool
    {
        return $this->has($key) && !empty($this->get($key));
    }