{@inheritdoc}

@throws UnexpectedValueException
194513
public function denormalize(
        FixtureInterface $scope,
        FlagParserInterface $parser,
        array $unparsedConstructor
    ): MethodCallInterface {
        return new SimpleMethodCall(
            '__construct',
            $this->argumentDenormalizer->denormalize($scope, $parser, $unparsedConstructor)
        );
    }
1103044
public function set($key, $value)
    {
        $result = $this->allowed($value);
        if ($this->passes($result)) {
            parent::set($key, $this->normalize($value));
        } else {
            throw new \UnexpectedValueException(sprintf(
                'Value of type "%s" forbidden in this instance of %s',
                gettype($value),
                get_class($this)
            ));
        }
    }
1186145
public function method($name)
    {
        if ( ! $this->object->hasMethod($name))
        {
            throw new UnexpectedValueException(
                "Method {$name} does not exist"
            );
        }

        return $this->extractComment($this->object->getMethod($name));
    }
27955
public function setValue($value)
    {
        if (!$this->isValid($value)) {
            throw new \UnexpectedValueException("Value '$value' is not part of the enum ".get_called_class());
        }
        $this->value = $value;
    }
868093
protected function incrementInternal($key, $offset = 1, $initial = 0, $expiry = 0)
    {
        if ($this->hasInternal($key)) {
            $oldValue = $this->getInternal($key);
            if (!is_int($oldValue)) {
                throw new UnexpectedValueException(sprintf(
                    'Method increment() requires existing value to be integer, %s found.',
                    gettype($oldValue)
                ));
            }
            $value = $oldValue + $offset;
        } else {
            $value = $initial;
        }
        // setInternal() always returns true without casToken argument.
        $this->setInternal($key, $value, $expiry);
        return $value;
    }
398068
public function getResponse()
    {
        if(!$this->_response instanceof ControllerResponseInterface)
        {
            //Setup the response
            $this->_response->request = $this->getRequest();
            $this->_response->user    = $this->getUser();

            $this->_response = $this->getObject('lib:controller.response', ObjectConfig::unbox($this->_response));

            if(!$this->_response instanceof ControllerResponseInterface)
            {
                throw new \UnexpectedValueException(
                    'Response: '.get_class($this->_response).' does not implement ControllerResponseInterface'
                );
            }
        }

        return $this->_response;
    }
14471
public function asUTF8String(): Primitive\UTF8String
    {
        if (!$this->_element instanceof Primitive\UTF8String) {
            throw new \UnexpectedValueException(
                $this->_generateExceptionMessage(Element::TYPE_UTF8_STRING));
        }
        return $this->_element;
    }
294889
public function getTemplate()
    {
        if(!$this->__template instanceof TemplateInterface)
        {
            $this->__template = $this->getObject($this->__template);

            if(!$this->__template instanceof TemplateInterface)
            {
                throw new \UnexpectedValueException(
                    'Template: '.get_class($this->_model).' does not implement TemplateInterface'
                );
            }
        }

        return $this->__template;
    }
881447
private function createStructureModel()
    {
        $structClass = $this->structureModelClass();
        $structure   = $this->structureModelFactory()->create($structClass);

        if (!$structure instanceof ArrayAccess) {
            throw new UnexpectedValueException(sprintf(
                'Structure [%s] must implement [%s]',
                $structClass,
                ArrayAccess::class
            ));
        }

        return $structure;
    }
1105006
private function initTypeExtensions(): void
    {
        $this->typeExtensions = [];

        foreach ($this->loadTypeExtensions() as $extension) {
            if (!$extension instanceof ObjectTypeExtensionInterface) {
                throw new UnexpectedTypeException($extension, 'Fxp\Component\DefaultValue\ObjectTypeExtensionInterface');
            }

            $type = $extension->getExtendedType();

            $this->typeExtensions[$type][] = $extension;
        }
    }
783874
public function create()
    {
        if (!$this->name) {
            throw new UnexpectedValueException(
                'Cannot create a user with no name'
            );
        }

        $parts = array('CREATE USER :user');
        $params = array(':user' => $this->name);

        if ($this->host) {
            $parts[] = '@:host';
            $params[':host'] = strtolower($this->host) == 'any' ? '%' : $this->host;
        }
        if ($this->password) {
            $parts[] = 'IDENTIFIED BY :password';
            $params[':password'] = $this->password;
        }

        // Wrap in 'FLUSH PRIVILEGES' commands to update in-memory state
        $this->client->execute('FLUSH PRIVILEGES');
        $this->client->execute(implode(' ', $parts), $params);
        $this->client->execute('FLUSH PRIVILEGES');
    }
1188084
protected function checkConfig(array $config)
    {
        if (!isset($config['dataSource']) || !is_array($config['dataSource'])) {
            throw new UnexpectedValueException($this->translate(
                'Information about data source in metadata configuration should be an array or Traversable.'
            ));
        }
        if (!isset($config['types']) || !is_array($config['types'])) {
            throw new UnexpectedValueException($this->translate(
                'Information about types in metadata configuration should be an array or Traversable.'
            ));
        }
        if (!isset($config['fields']) || !is_array($config['fields'])) {
            throw new UnexpectedValueException($this->translate(
                'Information about fields in metadata configuration should be an array or Traversable.'
            ));
        }
    }
1336114
protected function create_key() {
		if ( is_array( $this->data ) ) {
			$this->data[ $this->key ] = null;
		} elseif ( is_object( $this->data ) ) {
			$this->data->{$this->key} = null;
		} else {
			$type = gettype( $this->data );
			throw new UnexpectedValueException(
				"Cannot create key \"{$this->key}\" on data type {$type}"
			);
		}
	}
697293
public function unserialize($serialized)
    {
        $data = unserialize($serialized);
        if (!is_array($data)) {
            throw new \UnexpectedValueException('Unserialized data is not an array');
        }

        // TODO: check existence
        $this->message      = CustomAmqpMessage::fromProperties($data['message']);
        $this->tag          = (string) $data['tag'];
        $this->exchange     = (string) $data['exchange'];
        $this->queue        = (string) $data['queue'];
        $this->routingKey   = (string) $data['routingKey'];
        $this->redelivered  = (bool) $data['routingKey'];
    }
1116375
protected function checkForProtected(array $data)
    {
        foreach (array_keys($data) as $key) {

            if ($this->isProtected($key)) {

                throw new \UnexpectedValueException("Cannot set value in protected '$key' index");
            }
        }
    }
732288
public function get($key)
    {
        if (!$this->offsetExists($key)) {
            throw new UnexpectedValueException(sprintf('Unknown key %s.', $key));
        }

        return $this->offsetGet($key);
    }
251083
public function remove($key)
    {
        if (!$this->offsetExists($key)) {
            throw new UnexpectedValueException(sprintf('Unknown key %s.', $key));
        }

        return $this->offsetUnset($key);
    }