Exemplo n.º 1
0
 /**
  * @param InputInterface $input
  * @param OutputInterface $output
  * @throws Google_Auth_Exception
  * @throws \Exception
  */
 public function interact(InputInterface $input, OutputInterface $output)
 {
     $this->input = $input;
     $this->output = $output;
     //$output->writeln(\Packaged\Figlet\Figlet::create('Homeservice', 'ivrit'));
     $output->write(\Packaged\Figlet\Figlet::create('Homeservice', 'smslant'));
     $output->writeln('Google API');
     if ($input->getOption('revoke')) {
         $this->revokeAccess();
         $output->writeln('Access revoked');
         return;
     }
     try {
         $this->logInClient();
         $googleOauthV2 = new Google_Service_Oauth2($this->googleClient);
         $user = $googleOauthV2->userinfo->get();
         //$output->writeln('OAuth2 userinfo: ' . print_r($user, true));
         $output->writeln('Currently logged in user:'******'name'], FILTER_SANITIZE_SPECIAL_CHARS)));
         $output->writeln(sprintf("Email:\t\t %s", filter_var($user['email'], FILTER_SANITIZE_EMAIL)));
         $output->writeln(sprintf("Profile url:\t %s", filter_var($user['link'], FILTER_VALIDATE_URL)));
         $output->writeln('');
     } catch (Google_Auth_Exception $e) {
         throw $e;
     }
 }
Exemplo n.º 2
0
 /**
  * Compute text banner from given string
  *
  * @param string $string
  * @param string $fontName
  *
  * @return string
  */
 public static function render($string, $fontName)
 {
     if (!in_array($fontName, static::getKnownFonts())) {
         throw new Exception("Error unknown font ID fontID");
     }
     $figletString = FigletEngine::create($string, $fontName);
     return $figletString;
 }
Exemplo n.º 3
0
 /**
  * @inheritdoc
  *
  * @param InputInterface  $input
  * @param OutputInterface $output
  *
  * @return int|mixed|null
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     if (ValueAs::bool($this->showfig)) {
         $output->write(Figlet::create('PHP WEB', 'ivrit'));
         $output->write(Figlet::create('SERVER', 'ivrit'));
     }
     $output->writeln("");
     $output->write("\tStarting on ");
     $output->write("http://");
     $output->write($this->host == '0.0.0.0' ? 'localhost' : $this->host);
     $output->write(':' . $this->port);
     $output->writeLn("");
     $projectRoot = trim($this->getCubex()->getProjectRoot());
     $projectRoot = $projectRoot ? '"' . $projectRoot . '"' : '';
     $command = ["php -S {$this->host}:{$this->port} -t"];
     $command[] = $projectRoot;
     $command[] = trim($this->router);
     $command = implode(' ', array_filter($command));
     $output->writeln(["", "\tRaw Command: {$command}", ""]);
     return $this->runCommand($command);
 }
 /**
  * Get the template data from a stream object.
  *
  * @param Module          $module
  * @param StreamInterface $stream
  *
  * @return array
  */
 protected function getTemplateData()
 {
     $moduleName = studly_case($this->slug);
     $vendorName = studly_case($this->vendor);
     return ['description' => 'Describe your module here', 'docblock' => ' *', 'vendor_name' => $vendorName, 'vendor_name_lower' => strtolower($vendorName), 'namespace' => strtolower($moduleName), 'module_name' => $moduleName, 'date' => date("Y-n-j"), 'figlet_module_name' => Figlet::create(strtoupper($moduleName . ' Module'), 'small'), 'module_name_lower' => strtolower($moduleName)];
 }
Exemplo n.º 5
0
 public function testStaticCreate()
 {
     $this->assertEquals($this->getStandardHello(), \Packaged\Figlet\Figlet::create('Hello'));
     $this->assertEquals($this->getMiniHello(), \Packaged\Figlet\Figlet::create('Hello', 'mini'));
 }