/** * @return string|null */ public function getDefault() { $origin = $this->gitConfig->getOrigin(); if (null !== $origin) { $response = $this->github->get("/repos/{$origin}"); $repo = json_decode($response->getBody(), true); return $repo['description']; } }
/** * @return string|null */ public function getDefault() { $origin = $this->gitConfig->getOrigin(); if (null !== $origin) { $response = $this->github->get("/repos/{$origin}"); $repo = json_decode($response->getBody(), true); return "{$repo['html_url']}/issues/new"; } }
/** * @return array */ public function getDefaults() { $origin = $this->gitConfig->getOrigin(); if (null !== $origin) { list($vendor, $name) = explode('/', $origin); return [$this->inflector->titlecase($vendor) . '\\' . $this->inflector->titlecase($name), $this->inflector->initials($vendor) . '\\' . $this->inflector->titlecase($name)]; } else { return []; } }
/** * @return string */ public function getDefault() { $origin = $this->gitConfig->getOrigin(); if (null !== $origin) { $response = $this->github->get("/repos/{$origin}"); $repo = json_decode($response->getBody(), true); return $this->inflector->title($repo['name']); } return $this->inflector->title(getcwd()); }
/** * Get default values from different sources * * - github organization * - github user * - git user * - file owner * * @return array */ public function getDefaults() { $defaults = []; $origin = $this->gitConfig->getOrigin(); if (null !== $origin) { $response = $this->github->get("/repos/{$origin}"); $repo = json_decode($response->getBody(), true); if (isset($repo['organization'])) { $response = $this->github->get("/orgs/{$repo['organization']['login']}"); $organizaion = json_decode($response->getBody(), true); $defaults[] = $organizaion['name']; } $response = $this->github->get("/users/{$repo['owner']['login']}"); $owner = json_decode($response->getBody(), true); $defaults[] = $owner['name']; } $defaults[] = $this->gitConfig->get('user.name'); $defaults[] = get_current_user(); return array_values(array_unique(array_filter($defaults))); }
/** * @return string|null */ public function getDefault() { return $this->gitConfig->getOrigin(); }
/** * @return string */ public function getDefault() { return $this->gitConfig->get('user.name'); }
/** * @covers ::shell */ public function testShell() { $gitConfig = new GitConfig(); $this->assertEquals("VALUE", $gitConfig->shell('echo VALUE')); }