fromCode($code); } public function addClass(string $name): ClassType { return $this ->addNamespace(Helpers::extractNamespace($name)) ->addClass(Helpers::extractShortName($name)); } public function addInterface(string $name): InterfaceType { return $this ->addNamespace(Helpers::extractNamespace($name)) ->addInterface(Helpers::extractShortName($name)); } public function addTrait(string $name): TraitType { return $this ->addNamespace(Helpers::extractNamespace($name)) ->addTrait(Helpers::extractShortName($name)); } public function addEnum(string $name): EnumType { return $this ->addNamespace(Helpers::extractNamespace($name)) ->addEnum(Helpers::extractShortName($name)); } public function addNamespace(string|PhpNamespace $namespace): PhpNamespace { $res = $namespace instanceof PhpNamespace ? ($this->namespaces[$namespace->getName()] = $namespace) : ($this->namespaces[$namespace] ??= new PhpNamespace($namespace)); foreach ($this->namespaces as $namespace) { $namespace->setBracketedSyntax(count($this->namespaces) > 1 && isset($this->namespaces[''])); } return $res; } public function addFunction(string $name): GlobalFunction { return $this ->addNamespace(Helpers::extractNamespace($name)) ->addFunction(Helpers::extractShortName($name)); } /** @return PhpNamespace[] */ public function getNamespaces(): array { return $this->namespaces; } /** @return ClassLike[] */ public function getClasses(): array { $classes = []; foreach ($this->namespaces as $n => $namespace) { $n .= $n ? '\\' : ''; foreach ($namespace->getClasses() as $c => $class) { $classes[$n . $c] = $class; } } return $classes; } /** @return GlobalFunction[] */ public function getFunctions(): array { $functions = []; foreach ($this->namespaces as $n => $namespace) { $n .= $n ? '\\' : ''; foreach ($namespace->getFunctions() as $f => $function) { $functions[$n . $f] = $function; } } return $functions; } public function addUse(string $name, ?string $alias = null, string $of = PhpNamespace::NameNormal): static { $this->addNamespace('')->addUse($name, $alias, $of); return $this; } /** * Adds declare(strict_types=1) to output. */ public function setStrictTypes(bool $on = true): static { $this->strictTypes = $on; return $this; } public function hasStrictTypes(): bool { return $this->strictTypes; } /** @deprecated use hasStrictTypes() */ public function getStrictTypes(): bool { trigger_error(__METHOD__ . '() is deprecated, use hasStrictTypes().', E_USER_DEPRECATED); return $this->strictTypes; } public function __toString(): string { return (new Printer)->printFile($this); } } __halt_compiler();----SIGNATURE:----kjvuAPr5D2eAig6O0ZkoI0QBdGUP6BwFdqLHIjLZWmgTgOYSCD8ULSFPwkuHgYG9vPN+AdhCWSbrJTXLlaX4RKv1dJ3iTIu9HORR2ya1vE+XLdS+YFC+AlbeWTJoISnEoce5lErmTjdt5FvJY88ePgcODdtUbuTdAGCBl8fbt3+7ooLtb2IezSarVdsnI0P1QcVdEKihcMborLIAA8Yn1rdLYK3iR/xoReGarziDFlENfzjdZTSZ8U6C9SKN1eVoet7wfXhY2b9lekJFV4CaVmrePNYupm0mFxYJBzOkv1+hxfIPvlfKi3wosg5AfnuoSLZ4xJrHK9SicS6dNWi3GsoIut7JWPhu824QVTPXyoQsTea9Y85X6cW0CSKfouXF+DpawEqtnAhwnvA+vQBl07JyRIgfY0KoBSWnuwMpRhTVvQmoGzg8cHD8HDtML/5YnJAP65kCN7jBS7wRBBI+IuYRWaHdzVtWYYUNA4uyD0iN9dHTzK4eMLK7C+/eLb/pg9sQny32uMWHd21cpOIaZdAgID+oeI77P+0uDDMQAyh1zg9BP3I8lZKFBCDkUmKAlBRyQeM9tMSI52IO58eX6lo/PKsF0R2HzekUAPoZomIApiAB2jtwEk7lEtonwPESEz5dUn5gqpw/WFTcOE3FkmcN+ORUd98nrJld+aumDLE=----ATTACHMENT:----NDcwMzkwNTY4OTQ0ODUzNyA0MTkzMjk4MTc4OTUzNjI3IDI3OTEwNzQ3MTE5MTg5NTA=