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

getPats() public static méthode

public static getPats ( )
    public static function getPats()
    {
        if (!self::$pats) {
            $r = new \ReflectionClass(get_class());
            $pats = array_flip($r->getConstants());
            array_walk($pats, function (&$value) {
                $value = strtolower($value);
            });
            self::$pats = array_flip($pats);
        }
        return self::$pats;
    }

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::getPats