コード例 #1
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     parent::execute($input, $output);
     $communicationID = $input->getArgument('communicationID');
     if (isset($communicationID)) {
         $communication = new Communication($communicationID);
         CommunicationProcessor::sendCommunication($communication);
     } else {
         $unsentCommunicationsArray = Communication::findUnsentCommunications();
         foreach ($unsentCommunicationsArray as $communication) {
             CommunicationProcessor::sendCommunication($communication);
         }
     }
 }
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     parent::execute($input, $output);
     $providerName = $input->getArgument("provider");
     $owner = $input->getArgument("owner");
     $repos = $input->getArgument("repos");
     $sha = $input->getArgument("sha");
     $ref = $input->getArgument("ref");
     $state = $input->getArgument("state");
     $url = $input->getArgument("url");
     $description = $input->getArgument("description");
     $username = $input->getOption("username");
     $password = $input->getOption("password");
     if ($username) {
         $settings = GitProviderSettings::singleton();
         $settings->username = $username;
         $settings->password = $password;
     }
     /**
      * @var GitProvider $provider
      */
     $provider = null;
     switch ($providerName) {
         case "bitbucket":
             $provider = new BitbucketGitProvider();
             break;
         case "github":
             $provider = new GitHubGitProvider();
             break;
     }
     if ($provider != null) {
         $provider->updateCommitStatus($owner, $repos, $sha, $ref, $state, $description, $url);
     } else {
         $output->writeln("Error: The provider `{$providerName}` wasn't recognised.");
     }
 }