/**
  * Loads a ServiceDefinition from annotations from a class.
  *
  * @param string $class A class name
  * @param string $type  The resource type
  *
  * @return ServiceDefinition A ServiceDefinition instance
  *
  * @throws \InvalidArgumentException When route can't be parsed
  */
 public function load($class, $type = null)
 {
     if (!class_exists($class)) {
         throw new \InvalidArgumentException(sprintf('Class "%s" does not exist.', $class));
     }
     $annotations = array();
     $class = new \ReflectionClass($class);
     if ($alias = $this->reader->getClassAnnotation($class, $this->aliasClass)) {
         $annotations['alias'] = $alias->getValue();
     }
     $annotations['properties'] = new Collection('getName', 'BeSimple\\SoapBundle\\ServiceDefinition\\ComplexType');
     foreach ($class->getProperties() as $property) {
         $complexType = $this->reader->getPropertyAnnotation($property, $this->complexTypeClass);
         if ($complexType) {
             $propertyComplexType = new ComplexType();
             $propertyComplexType->setValue($complexType->getValue());
             $propertyComplexType->setNillable($complexType->isNillable());
             $propertyComplexType->setMinOccurs($complexType->getMinOccurs());
             $propertyComplexType->setMaxOccurs($complexType->getMaxOccurs());
             $propertyComplexType->setName($property->getName());
             $annotations['properties']->add($propertyComplexType);
         }
     }
     return $annotations;
 }
 private function createComplexTypeCollection(array $properties)
 {
     $collection = new Collection('getName', 'BeSimple\\SoapBundle\\ServiceDefinition\\ComplexType');
     foreach ($properties as $property) {
         $complexType = new Definition\ComplexType();
         $complexType->setName($property[0]);
         $complexType->setValue($property[1]);
         if (isset($property[2])) {
             $complexType->setNillable($property[2]);
         }
         $collection->add($complexType);
     }
     return array('properties' => $collection);
 }