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:----OcuQR8lD21ifIZw4TnboJesPAv7X5fygq4BzSSt3B3XMhnKlDTKTirEcnEaXZx3TrCq5O8Tzoxlv7WNmo0ktamh7SwGXQ4RKKtdZV3qiMEkhbDRc3SeWi0nw6JgXSP+mSl/VKLNB8FzaHPyDxzwlED+Rx34xDksExxFDkZK+1oKVJ3hDPkXD5s1VyS4TEFiLzEn0eVWeLGN1dwSbH6aSUvWr0kNzTGH4FCZEoLyWW3JyeiH5G7fOQXicwIxs/y0YYUb2SxawLTTIJAO99oDu5CqAPBeKpPTXpuQ55zlOKestF45fX/6kdmPLMde8ezj3Z0l0Y5HjGY8XxAIz/boeVX4AVk3cnGDniJdiiGCCPLqHZeq97PFrb51PBlhnuxoC1lV/LDTRJLx90xnAHUnIgxqATDDVYurkzwpcau81EDsjvSYz912b80GbG0i0rMwEjZZifQ73jP1vQ4o8Xp3iymaphwGvlHZT8LCfnCeKFZpGcDRM3GWWwQftRQD7WXsu9utyuzVeMUVjLxi1sZg5tcArUr3iM5YcBsn16fZlsQKw52g7TjVtAkpMh4ALziZXzcFltxxFF/wAwohBYmcJRd9kCFrj20Px/Vji0RGkYSyb7mIaE82kSRVY21YQDYCZocO5DCpBZ/k8VPADmThp89h4FsAAMfThZaE2PnSH9gc=----ATTACHMENT:----MzU5NjY3MjI3NjU0MDA1OCAyNjgzOTEzNDE3NjY1NTkxIDc5NjQ1NzEyNDI5NjM4MzA=