Gush\Template\Pats\Pats::getRandomPatName PHP Méthode

getRandomPatName() public static méthode

public static getRandomPatName ( )
    public static function getRandomPatName()
    {
        return array_rand(self::getPats());
    }

Usage Example

 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $prNumber = $input->getArgument('pr_number');
     $adapter = $this->getAdapter();
     $pr = $adapter->getPullRequest($prNumber);
     if ($pr['user'] === $this->getParameter($input, 'authentication')['username']) {
         throw new UserException('You cannot pat yourself.');
     }
     $config = $this->getConfig();
     if ($customPats = $config->get('pats')) {
         Pats::addPats($customPats);
     }
     $pats = Pats::getPats();
     if ($pat = $input->getOption('pat')) {
         if ('random' === $pat) {
             $pat = Pats::getRandomPatName();
         }
     } else {
         $pat = $this->choosePat($pats);
     }
     $patMessage = $this->getHelper('template')->bindAndRender(['pat' => $pat, 'author' => $pr['user']], 'pats', 'general');
     $adapter->createComment($prNumber, $patMessage);
     $url = $adapter->getPullRequest($prNumber)['url'];
     $this->getHelper('gush_style')->success("Pat on the back pushed to {$url}");
     return self::COMMAND_SUCCESS;
 }
All Usage Examples Of Gush\Template\Pats\Pats::getRandomPatName