Exemplo n.º 1
0
 /**
  * @test
  */
 public function shouldReturnComplexType()
 {
     //when
     $parser = new ComplexTypeParser('string', 'name');
     //then
     $this->assertEquals('string', $parser->getType());
 }
Exemplo n.º 2
0
 /**
  * @param string $types
  * @return ComplexTypeParser[]
  */
 public static function create($types)
 {
     preg_match_all('#@(\\((?:.+)\\)|(?:.+?))(?: |$)#', $types, $matches);
     $typesArray = $matches[1];
     $obj = array_map(function ($type) {
         if (ComplexTypeParser::isReflectionType($type)) {
             $type = str_replace(array('(', ')'), '', $type);
         } else {
             $type = str_replace('=', ' ', $type);
         }
         $parser = new ParameterParser($type, '');
         return $parser->parse();
     }, $typesArray);
     return $obj;
 }
Exemplo n.º 3
0
 public function complexTypes()
 {
     if (!$this->isComplex()) {
         throw new ParameterParserException("This parameter is not complex type.");
     }
     preg_match("#(@.+)#", $this->_parameter, $complexTypes);
     return ComplexTypeParser::create($complexTypes[1]);
 }