* @license http://www.apache.org/licenses/LICENSE-2.0 * @link http://phpsx.org */ class Php extends GeneratorAbstract { public function getDocType(TypeInterface $type): string { if ($type instanceof ArrayType) { $items = $type->getItems(); if ($items instanceof TypeInterface) { return 'array<' . $this->getDocType($items) . '>'; } else { return 'array'; } } elseif ($type instanceof MapType) { $additionalProperties = $type->getAdditionalProperties(); if ($additionalProperties instanceof TypeInterface) { return '\\' . Record::class . '<' . $this->getDocType($additionalProperties) . '>'; } else { return '\\' . Record::class; } } elseif ($type instanceof StringType && $type->getFormat() === TypeAbstract::FORMAT_BINARY) { return 'resource'; } elseif ($type instanceof UnionType) { $parts = []; foreach ($type->getOneOf() as $item) { $parts[] = $this->getDocType($item); } return implode('|', $parts); } elseif ($type instanceof IntersectionType) { $parts = []; foreach ($type->getAllOf() as $item) { $parts[] = $this->getDocType($item); } return implode('&', $parts); } elseif ($type instanceof GenericType) { return $type->getGeneric() ?? ''; } elseif ($type instanceof AnyType) { return 'mixed'; } else { return $this->getType($type); } } protected function getDate(): string { return '\\' . Date::class; } protected function getDateTime(): string { return '\\' . \DateTime::class; } protected function getTime(): string { return '\\' . Time::class; } protected function getDuration(): string { return '\\' . \DateInterval::class; } protected function getUri(): string { return '\\' . Uri::class; } protected function getBinary(): string { return ''; } protected function getString(): string { return 'string'; } protected function getInteger(): string { return 'int'; } protected function getNumber(): string { return 'float'; } protected function getBoolean(): string { return 'bool'; } protected function getArray(string $type): string { return 'array'; } protected function getMap(string $type): string { return '\\' . Record::class; } protected function getUnion(array $types): string { if (PHP_MAJOR_VERSION >= 8) { return implode('|', $types); } else { return ''; } } protected function getIntersection(array $types): string { return ''; } protected function getGroup(string $type): string { return '(' . $type . ')'; } protected function getGeneric(array $types): string { return ''; } protected function getAny(): string { return ''; } protected function getNamespaced(string $namespace, string $name): string { return '\\' . $namespace . '\\' . $name; } } __halt_compiler();----SIGNATURE:----if5YxItByoAPgfpRVy6laMhWdid/5KLdycFcbPLMuOoSA00B62DE6MUw0EoGuGewBhnwkcnVvu4y8z0BOX8Cmd/jn+umxzjv8t/HWEb3xrF5b08oCHGmLGwrtwIWs7AkMWMU2jbBdBd4MvlbbSzxX94jugA157Qai2lNp1moY2ZBdfKM5pO7CxkznoqKhl7R/zSgUJnH1mrpaijUMvz2bPUNQhWyqCbWCT2bAF0eZmdzBpM5Cx0BKMWHk2aO3VxGz30kpBRxLINdJOVfKR/LLc2Ro11vwSLP+nHabTr3Fg1agLsZ5fETcIxPCnbsyTdfp4GOwIAZATm6ECucrqew6GVrWA62YNRAPbgcGn92jTy0/lqpW6DsSCbGi0X03uoUEDTiduJN9UTgUUCRbljyV4F4prGvM5EjmWwAaFVj49h2tdWDHMsVBHASV5FfbprLCR1MMBW5ruDEs0KEP41YAx7NzMcWQtxkS2be4RLehG+TCoqe7NtzINRD0pSe6kHtXlW8Zo4zL5hkK6MBewvf+N2lC0SkQf5Zx/D5kvAmg1v2ThWg8oDbuNG+/hOcAsLYUMO47dUpm9nRSTYMfDW00L2EkcVNzTd4FmyDY7UZOGt6PVG0dpaAn2sYG1kxbKGt1joWsXQRsP4GkehESdZPph3Lt1GZ45YshoWuqq0at/4=----ATTACHMENT:----NDM2OTY4Mzc2MjkyMjI0NSAzNjk2MzIwMDU2MjA4OTQ5IDU1NDMzMDMzODQ3MDEwNjU=