public function performAction() { if ($user = AuthService::getInstance()->getUser()) { $this->response->addContent('Hello, ' . $user->urlName . ' '); $this->response->addContent(new Anchor('Sign out', $this->io->makeAnchor(SignOut::createState()))); } //else { $this->response->addContent(new Anchor('vk auth', $this->io->makeAnchor(VkAuth::createState()))); //} if (null === $this->action) { $this->response->error("Page not found"); return; } parent::performAction(); }
static function setUpDefinition(Definition $definition, $options) { $options->action = Option::create(EnumActions::create()->addToEnum(SignIn::definition())->addToEnum(SignOut::definition())->addToEnum(Register::definition())->addToEnum(RegisterReceive::definition())->addToEnum(VkAuth::definition(), 'vk'))->setIsUnnamed()->setIsRequired(); }