src/Controller/TypeController.php
protected function getTypeFromRequestBody(array &$request_body)
    {
        $type_class = $this->getTypeClassName();

        if (isset($request_body['type'])) {
            $type_class = $request_body['type'];
            unset($request_body['type']);
        }

        if (class_exists($type_class)) {
            $type_class_reflection = new ReflectionClass($type_class);

            if ($type_class_reflection->isSubclassOf($this->getTypeClassName()) && !$type_class_reflection->isAbstract()) {
                return $type_class;
            }
        }

        throw new InvalidArgumentException('Please specify a valid type');
    }
protected function getTypeFromRequestBody(array &$request_body)
    {
        $type_class = $this->getTypeClassName();

        if (isset($request_body['type'])) {
            $type_class = $request_body['type'];
            unset($request_body['type']);
        }

        if (class_exists($type_class)) {
            $type_class_reflection = new ReflectionClass($type_class);

            if ($type_class_reflection->isSubclassOf($this->getTypeClassName()) && !$type_class_reflection->isAbstract()) {
                return $type_class;
            }
        }

        throw new InvalidArgumentException('Please specify a valid type');
    }
protected function getTypeFromRequestBody ( array & $ request_body ) { $ type_class = $ this -> getTypeClassName ( ) ; if ( isset ( $ request_body [ 'type' ] ) ) { $ type_class = $ request_body [ 'type' ] ; unset ( $ request_body [ 'type' ] ) ; } if ( class_exists ( $ type_class ) ) { $ type_class_reflection = new ReflectionClass ( $ type_class ) ; if ( $ type_class_reflection -> isSubclassOf ( $ this -> getTypeClassName ( ) ) && ! $ type_class_reflection -> isAbstract ( ) ) { return $ type_class ; } } throw new InvalidArgumentException ( 'Please specify a valid type' ) ; }
Get a valid type class from request body.

@param  array  $request_body
@return string
Get a valid type class from request body .