Acacha\Llum\Github\GithubAPI::createRepo PHP Method

createRepo() public method

Create repo in github.
public createRepo ( $repo_name, $repo_description ) : mixed
$repo_name
$repo_description
return mixed
    public function createRepo($repo_name, $repo_description)
    {
        return $this->client->request('POST', $this->create_repo_url(), ["auth" => $this->credentials(), "json" => json_decode($this->compileStub($repo_name, $repo_description), true)]);
    }

Usage Example

Ejemplo n.º 1
0
 /**
  * Github create repo command.
  *
  * @param InputInterface $input
  * @param OutputInterface $output
  */
 public function githubCreateRepo(InputInterface $input, OutputInterface $output)
 {
     $this->api->setCredentials($this->getCredentials($output));
     $name = $this->repoName($input);
     try {
         $this->api->createRepo($name, $this->repoDescription($input));
     } catch (ServerException $se) {
         //TODO
         $output->writeln('<error>Server exception thrown</error>');
         die;
     } catch (ClientException $ce) {
         $this->showError($ce, $output);
     }
     $output->writeln('<info>Repository ' . $name . ' created</info>');
 }