Ejemplo n.º 1
0
 /**
  * Retrieve complex type information from class public properties.
  *
  * @param string $class
  * @return array
  * @throws InvalidArgumentException
  */
 protected function _processComplexType($class)
 {
     $typeName = $this->_helper->translateTypeName($class);
     $this->_types[$typeName] = array();
     if ($this->_helper->isArrayType($class)) {
         $this->process($this->_helper->getArrayItemType($class));
     } else {
         if (!class_exists($class)) {
             throw new InvalidArgumentException(sprintf('Could not load the "%s" class as parameter type.', $class));
         }
         $reflection = new ClassReflection($class);
         $docBlock = $reflection->getDocBlock();
         $this->_types[$typeName]['documentation'] = $docBlock ? $this->_getDescription($docBlock) : '';
         $defaultProperties = $reflection->getDefaultProperties();
         /** @var \Zend\Code\Reflection\PropertyReflection $property */
         foreach ($reflection->getProperties(ReflectionProperty::IS_PUBLIC) as $property) {
             $this->_processProperty($property, $defaultProperties, $typeName);
         }
     }
     return $this->_types[$typeName];
 }
Ejemplo n.º 2
0
 public function testTranslateTypeNameInvalidArgument()
 {
     $this->setExpectedException('InvalidArgumentException', 'Invalid parameter type "Invalid_Type_Name".');
     $this->_helper->translateTypeName('Invalid_Type_Name');
 }