* @license http://www.apache.org/licenses/LICENSE-2.0 * @link http://phpsx.org */ class Swift extends CodeGeneratorAbstract { /** * @inheritDoc */ public function getFileName(string $file): string { return $file . '.swift'; } /** * @inheritDoc */ protected function newTypeGenerator(array $mapping): GeneratorInterface { return new Type\Swift($mapping); } /** * @inheritDoc */ protected function writeStruct( string $name, array $properties, ?string $extends, ?array $generics, StructType $origin, ): string { $code = 'class ' . $name . ': '; if (!empty($extends)) { $code.= $extends . ' '; } else { $code.= 'Codable '; } $code.= '{' . "\n"; foreach ($properties as $name => $property) { /** @var Code\Property $property */ $code.= $this->indent . 'var ' . $name . ': ' . $property->getType() . "\n"; } $code.= '}' . "\n"; return $code; } protected function writeMap(string $name, string $type, MapType $origin): string { return 'typealias ' . $name . ' = ' . $type . ';' . "\n"; } protected function writeArray(string $name, string $type, ArrayType $origin): string { return 'typealias ' . $name . ' = ' . $type . ';' . "\n"; } protected function writeUnion(string $name, string $type, UnionType $origin): string { return 'typealias ' . $name . ' = ' . $type . ';' . "\n"; } protected function writeIntersection(string $name, string $type, IntersectionType $origin): string { return 'typealias ' . $name . ' = ' . $type . ';' . "\n"; } protected function writeReference(string $name, string $type, ReferenceType $origin): string { return 'typealias ' . $name . ' = ' . $type . ';' . "\n"; } protected function writeHeader(TypeAbstract $origin): string { $code = ''; $comment = $origin->getDescription(); if (!empty($comment)) { $code.= '// ' . $comment . "\n"; } return $code; } } __halt_compiler();----SIGNATURE:----T7GjM+7EJLa8xwYlppz2EsOZloVrSduZRIhm/53AHoXWH6stRKpGGw64EgHAGYBMaLspG0kG92Z5ksHPve5s+y8GP2pcSjxQCxf7wu8Wbwzt7qtyWYr9QxivMUvoMtMouv0Y1Dd30zbNTndRMHJSKL1DuT+66GHwoJnDTn/w/Y+tKe88NJXfVOEzGWMwDIrj+lXfNVWtvrP2tzLW3JqhmQONM6h9cDMM1dbkoGSqg88yzm5tCh3g7O8kcu977iyfOWlZuBNazQqZaT8xTdsF3LipmgqHEghu2a0q+FptbX/bixE5RHrILNcH0kB62UuMiq39Qdmr1ELu6x2smc7bEtb2qpEnD07+aGyYmvJWTzUVvbMOxXPHPUKY4K9OiCy5vi+YoKj9NZiRK2ulxzIY8CMIYk1OIm9w0t+4/rZ5B2QxYIFHFfBa/os3s07MP5Xl33QXJBaJT/2ZnQoRDJ5TWR+xYrqIRLSBy/IVwyErP2fPP/bsfqZ8C0MVU+cdr4uRu/64v6Is/FGmJvQrpsjerML+OG3SV8dKw2E5KSe0SBQpZiAV1aAZ/IerXcmBXhovbPaYf1I1XqjM4Y268cr1fk3kvIXP/pcEPgTCRX8pQUoSTgYi+x/yrUbj295eyr+mgOP0Nq1x/Z3LUpTBfGfwyo95PpoPJL+l3TJo56rA+bQ=----ATTACHMENT:----NzAxNDg5NjA0ODAzNjI0MiA5NjgzMjA0MDU1MjMwNDA1IDcxNjY4ODQxMjg3MTk0MzE=