private function &visitType(Type $type, $force = false)
{
if (!isset($this->classes[spl_object_hash($type)])) {
if ($alias = $this->getTypeAlias($type)) {
$class = array();
$class[$alias] = array();
$this->classes[spl_object_hash($type)]["class"] =& $class;
$this->classes[spl_object_hash($type)]["skip"] = true;
return $class;
}
$className = $this->findPHPName($type);
$class = array();
$data = array();
$class[$className] =& $data;
$this->classes[spl_object_hash($type)]["class"] =& $class;
$this->visitTypeBase($class, $data, $type, $type->getName());
if ($type instanceof SimpleType) {
$this->classes[spl_object_hash($type)]["skip"] = true;
return $class;
}
if (!$force && ($this->isArrayType($type) || $this->isArrayNestedElement($type))) {
$this->classes[spl_object_hash($type)]["skip"] = true;
return $class;
}
} elseif ($force) {
if (!$type instanceof SimpleType && !$this->getTypeAlias($type)) {
$this->classes[spl_object_hash($type)]["skip"] = false;
}
}
return $this->classes[spl_object_hash($type)]["class"];
}