public function setAttribute ($attribute, $value) {
        // @see https://github.com/gajus/doll/issues/16
        if ($attribute === \PDO::ATTR_ERRMODE) {
            throw new Exception\InvalidArgumentException('Doll does not allow to change PDO::ATTR_ERRMODE.');
        }

        // @see
        if ($attribute === \PDO::ATTR_STATEMENT_CLASS) {
            throw new Exception\InvalidArgumentException('Doll does not allow to change PDO::ATTR_STATEMENT_CLASS.');
        }

        if ($attribute === \Gajus\Doll\PDO::ATTR_INFERRED_TYPE_HINTING) {
            $this->custom_attributes[$attribute] = !!$value;

            return;
        }

        if ($attribute === \Gajus\Doll\PDO::ATTR_LOGGING) {
            if ($this->isConnected()) {
                throw new Exception\RuntimeException('Cannot change Gajus\Doll\PDO::ATTR_LOGGING value after connection is established.');
            }

            $this->custom_attributes[$attribute] = !!$value;

            return;
        }

        if (!$this->isConnected()) {
            $this->attributes[$attribute] = $value;
        } else {
            parent::setAttribute($attribute, $value);
        }
    }