Ejemplo n.º 1
0
 /**
  * _processSpecialties() - Break out the specialty names for this provider
  *
  */
 protected function _processSpecialties()
 {
     $specialties = array();
     if ($this->_providerReflection->hasMethod('getSpecialties')) {
         $specialties = $this->_provider->getSpecialties();
         if (!is_array($specialties)) {
             throw new Exception\RuntimeException('Provider ' . get_class($this->_provider) . ' must return an array for method getSpecialties().');
         }
     } else {
         $defaultProperties = $this->_providerReflection->getDefaultProperties();
         $specialties = isset($defaultProperties['_specialties']) ? $defaultProperties['_specialties'] : array();
         if (!is_array($specialties)) {
             throw new Exception\RuntimeException('Provider ' . get_class($this->_provider) . '\'s property $_specialties must be an array.');
         }
     }
     $this->_specialties = array_merge(array('_Global'), $specialties);
 }
Ejemplo n.º 2
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];
 }