public function parseType(string $input)
    {
        $matches = $properties = [];
        if (\preg_match(self::STRUCT, trim($input), $matches)) {
            /* Optional parse properties of the struct, could be empty complex types */
            \preg_match_all(self::PROPERTY, $matches['properties'], $properties);

            $struct = new Struct();
            $struct->setName($matches['name']);

            for ($x = 0, $max = count($properties['name']); $x < $max; $x++) {
                $type = $this->convertWsdlTypeToPhpType($properties['type'][$x]);
                $name = $this->covertNameToPhpName($properties['name'][$x]);
                $struct->addProperty(new Property($name, $type));
            }

            return $struct;
        } elseif (\preg_match(self::ARRAY_OF_COMPLEX_TYPE, trim($input), $matches)) {
            $struct = new Struct();
            $struct->setName($matches['name']);
            $struct->addProperty(new Property($matches['type'], $matches['type'] . '[]'));
            return $struct;
        } elseif (\preg_match(self::SIMPLE_TYPE, trim($input), $matches)) {
            return new Property($matches['name'], $matches['type']);
        } else {
            throw new \Exception(sprintf('Unable to parse input [%s]', $input));
        }
    }
public function parseType(string $input)
    {
        $matches = $properties = [];
        if (\preg_match(self::STRUCT, trim($input), $matches)) {
            /* Optional parse properties of the struct, could be empty complex types */
            \preg_match_all(self::PROPERTY, $matches['properties'], $properties);

            $struct = new Struct();
            $struct->setName($matches['name']);

            for ($x = 0, $max = count($properties['name']); $x < $max; $x++) {
                $type = $this->convertWsdlTypeToPhpType($properties['type'][$x]);
                $name = $this->covertNameToPhpName($properties['name'][$x]);
                $struct->addProperty(new Property($name, $type));
            }

            return $struct;
        } elseif (\preg_match(self::ARRAY_OF_COMPLEX_TYPE, trim($input), $matches)) {
            $struct = new Struct();
            $struct->setName($matches['name']);
            $struct->addProperty(new Property($matches['type'], $matches['type'] . '[]'));
            return $struct;
        } elseif (\preg_match(self::SIMPLE_TYPE, trim($input), $matches)) {
            return new Property($matches['name'], $matches['type']);
        } else {
            throw new \Exception(sprintf('Unable to parse input [%s]', $input));
        }
    }
public function parseType ( string $ input ) { $ matches = $ properties = [ ] ; if ( \ preg_match ( self :: STRUCT , trim ( $ input ) , $ matches ) ) { /* Optional parse properties of the struct, could be empty complex types */ \ preg_match_all ( self :: PROPERTY , $ matches [ 'properties' ] , $ properties ) ; $ struct = new Struct ( ) ; $ struct -> setName ( $ matches [ 'name' ] ) ; for ( $ x = 0 , $ max = count ( $ properties [ 'name' ] ) ; $ x < $ max ; $ x ++ ) { $ type = $ this -> convertWsdlTypeToPhpType ( $ properties [ 'type' ] [ $ x ] ) ; $ name = $ this -> covertNameToPhpName ( $ properties [ 'name' ] [ $ x ] ) ; $ struct -> addProperty ( new Property ( $ name , $ type ) ) ; } return $ struct ; } elseif ( \ preg_match ( self :: ARRAY_OF_COMPLEX_TYPE , trim ( $ input ) , $ matches ) ) { $ struct = new Struct ( ) ; $ struct -> setName ( $ matches [ 'name' ] ) ; $ struct -> addProperty ( new Property ( $ matches [ 'type' ] , $ matches [ 'type' ] . '[]' ) ) ; return $ struct ; } elseif ( \ preg_match ( self :: SIMPLE_TYPE , trim ( $ input ) , $ matches ) ) { return new Property ( $ matches [ 'name' ] , $ matches [ 'type' ] ) ; } else { throw new \ Exception ( sprintf ( 'Unable to parse input [%s]' , $ input ) ) ; } }
Parse a type from a string to a Struct
@param string $input
@return Struct|Property
@throws \Exception when the input cannot be properly parsed.
Parse a type from a string to a Struct