public function delete(string $key): self
    {
        if (!$this->validate($key)) {
            throw new \InvalidArgumentException('The key provided (' . $key . ') is not valid! It may contain only the following characters: "a-z", "0-9", ".", "/", "-" and "_".');
        }
        $driver = $this->getDriver();
        $driver->delete($key);
        if ($this->hasEventListeners('itemDelete')) {
            $this->dispatchEvent('itemDelete', new \BearFramework\App\Data\ItemDeleteEventDetails($key));
        }
        if ($this->hasEventListeners('itemChange')) {
            $this->dispatchEvent('itemChange', new \BearFramework\App\Data\ItemChangeEventDetails($key));
        }
        return $this;
    }
public function delete(string $key): self
    {
        if (!$this->validate($key)) {
            throw new \InvalidArgumentException('The key provided (' . $key . ') is not valid! It may contain only the following characters: "a-z", "0-9", ".", "/", "-" and "_".');
        }
        $driver = $this->getDriver();
        $driver->delete($key);
        if ($this->hasEventListeners('itemDelete')) {
            $this->dispatchEvent('itemDelete', new \BearFramework\App\Data\ItemDeleteEventDetails($key));
        }
        if ($this->hasEventListeners('itemChange')) {
            $this->dispatchEvent('itemChange', new \BearFramework\App\Data\ItemChangeEventDetails($key));
        }
        return $this;
    }
public function delete ( string $ key ) : self { if ( ! $ this -> validate ( $ key ) ) { throw new \ InvalidArgumentException ( 'The key provided (' . $ key . ') is not valid! It may contain only the following characters: "a-z", "0-9", ".", "/", "-" and "_".' ) ; } $ driver = $ this -> getDriver ( ) ; $ driver -> delete ( $ key ) ; if ( $ this -> hasEventListeners ( 'itemDelete' ) ) { $ this -> dispatchEvent ( 'itemDelete' , new \ BearFramework \ App \ Data \ ItemDeleteEventDetails ( $ key ) ) ; } if ( $ this -> hasEventListeners ( 'itemChange' ) ) { $ this -> dispatchEvent ( 'itemChange' , new \ BearFramework \ App \ Data \ ItemChangeEventDetails ( $ key ) ) ; } return $ this ; }
Deletes the data item specified and it's metadata.

@param string $key The key of the data item to delete.
@return self Returns a reference to itself.
@throws \Exception
@throws \BearFramework\App\Data\DataLockedException
@throws \InvalidArgumentException
Deletes the data item specified and it s metadata .