public function setKey($key)
    {
        $this->key = $key;

        if (!is_string($this->key) && $this->key !== null) {
            throw new \InvalidArgumentException('Key should be string');
        }

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

        if (!is_string($this->key) && $this->key !== null) {
            throw new \InvalidArgumentException('Key should be string');
        }

        return $this;
    }
public function setKey ( $ key ) { $ this -> key = $ key ; if ( ! is_string ( $ this -> key ) && $ this -> key !== null ) { throw new \ InvalidArgumentException ( 'Key should be string' ) ; } return $ this ; }
Method to set property private

@param   null|string $key

@throws \InvalidArgumentException
@return  static  Return self to support chaining.
Method to set property private