/** * Construct the object * * @param ConfigInterface $config The configuration * @param string $name The identifier for the class */ public function __construct(ConfigInterface $config, $name) { parent::__construct($config, $name, null); $this->members = array(); $this->baseType = null; $this->abstract = false; }
/** * Function to find all needed types. * * @param Service $service Source service with all types and operations * @param Type $type Type to extract types from. * * @return Type[] * All identified types referred to including the current type. */ private function findUsedTypes($service, Type $type) { if ($type instanceof Enum) { return array($type); } if (!$type instanceof ComplexType) { return array(); } $foundTypes = array($type); // Process Base type $baseType = $type->getBaseType(); if ($baseType) { $foundTypes = array_merge($foundTypes, $this->findUsedTypes($service, $baseType)); } $members = $type->getMembers(); foreach ($members as $member) { /** @var Variable $member */ // Remove array mark from type name $memberTypeName = str_replace('[]', '', $member->getType()); $memberType = $service->getType($memberTypeName); if (!$memberType) { continue; } $foundTypes = array_merge($foundTypes, $this->findUsedTypes($service, $memberType)); } return $foundTypes; }
/** * Construct the object * * @param ConfigInterface $config The configuration * @param string $name The identifier for the class * @param string $restriction The restriction(datatype) of the values */ public function __construct(ConfigInterface $config, $name, $restriction) { parent::__construct($config, $name, $restriction); $this->values = array(); }