Skip to content
This repository has been archived by the owner on Jan 24, 2022. It is now read-only.

Commit

Permalink
Fix: Use GitHub domain language
Browse files Browse the repository at this point in the history
  • Loading branch information
localheinz committed Aug 9, 2015
1 parent e4193a6 commit 2ac7c9a
Show file tree
Hide file tree
Showing 6 changed files with 204 additions and 204 deletions.
12 changes: 6 additions & 6 deletions src/Console/PullRequestCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ protected function configure()
->setName('pull-request')
->setDescription('Creates a changelog from merged pull requests between references')
->addArgument(
'vendor',
'owner',
Input\InputArgument::REQUIRED,
'The name of the vendor, e.g., "localheinz"'
'The owner, e.g., "localheinz"'
)
->addArgument(
'package',
'repository',
Input\InputArgument::REQUIRED,
'The name of the package, e.g. "github-changelog"'
'The repository, e.g. "github-changelog"'
)
->addArgument(
'start-reference',
Expand Down Expand Up @@ -89,8 +89,8 @@ protected function execute(Input\InputInterface $input, Output\OutputInterface $

try {
$pullRequests = $this->pullRequestRepository()->items(
$input->getArgument('vendor'),
$input->getArgument('package'),
$input->getArgument('owner'),
$input->getArgument('repository'),
$input->getArgument('start-reference'),
$input->getArgument('end-reference')
);
Expand Down
38 changes: 19 additions & 19 deletions src/Repository/CommitRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,21 @@ public function __construct(Api\Repository\Commits $api)
}

/**
* @param string $vendor
* @param string $package
* @param string $owner
* @param string $repository
* @param string $startReference
* @param string $endReference
* @return Entity\Commit[]
*/
public function items($vendor, $package, $startReference, $endReference)
public function items($owner, $repository, $startReference, $endReference)
{
if ($startReference === $endReference) {
return [];
}

$start = $this->show(
$vendor,
$package,
$owner,
$repository,
$startReference
);

Expand All @@ -41,16 +41,16 @@ public function items($vendor, $package, $startReference, $endReference)
}

$end = $this->show(
$vendor,
$package,
$owner,
$repository,
$endReference
);

if (null === $end) {
return [];
}

$commits = $this->all($vendor, $package, [
$commits = $this->all($owner, $repository, [
'sha' => $end->sha(),
]);

Expand All @@ -75,7 +75,7 @@ public function items($vendor, $package, $startReference, $endReference)

if (!count($commits)) {
$tail = $commit;
$commits = $this->all($vendor, $package, [
$commits = $this->all($owner, $repository, [
'sha' => $tail->sha(),
]);
}
Expand All @@ -85,16 +85,16 @@ public function items($vendor, $package, $startReference, $endReference)
}

/**
* @param string $vendor
* @param string $package
* @param string $owner
* @param string $repository
* @param string $sha
* @return Entity\Commit|null
*/
public function show($vendor, $package, $sha)
public function show($owner, $repository, $sha)
{
$response = $this->api->show(
$vendor,
$package,
$owner,
$repository,
$sha
);

Expand All @@ -109,20 +109,20 @@ public function show($vendor, $package, $sha)
}

/**
* @param string $vendor
* @param string $package
* @param string $owner
* @param string $repository
* @param array $params
* @return Entity\Commit[]
*/
public function all($vendor, $package, array $params = [])
public function all($owner, $repository, array $params = [])
{
if (!array_key_exists('per_page', $params)) {
$params['per_page'] = 250;
}

$response = $this->api->all(
$vendor,
$package,
$owner,
$repository,
$params
);

Expand Down
26 changes: 13 additions & 13 deletions src/Repository/PullRequestRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@ public function __construct(Api\PullRequest $api, CommitRepository $commitReposi
}

/**
* @param string $vendor
* @param string $package
* @param string $owner
* @param string $repository
* @param string $id
* @return Entity\PullRequest|null
*/
public function show($vendor, $package, $id)
public function show($owner, $repository, $id)
{
$response = $this->api->show(
$vendor,
$package,
$owner,
$repository,
$id
);

Expand All @@ -48,24 +48,24 @@ public function show($vendor, $package, $id)
}

/**
* @param string $vendor
* @param string $package
* @param string $owner
* @param string $repository
* @param string $startReference
* @param string $endReference
* @return Entity\PullRequest[] array
*/
public function items($vendor, $package, $startReference, $endReference)
public function items($owner, $repository, $startReference, $endReference)
{
$commits = $this->commitRepository->items(
$vendor,
$package,
$owner,
$repository,
$startReference,
$endReference
);

$pullRequests = [];

array_walk($commits, function (Entity\Commit $commit) use (&$pullRequests, $vendor, $package) {
array_walk($commits, function (Entity\Commit $commit) use (&$pullRequests, $owner, $repository) {

if (0 === preg_match('/^Merge pull request #(?P<id>\d+)/', $commit->message(), $matches)) {
return;
Expand All @@ -74,8 +74,8 @@ public function items($vendor, $package, $startReference, $endReference)
$id = $matches['id'];

$pullRequest = $this->show(
$vendor,
$package,
$owner,
$repository,
$id
);

Expand Down
28 changes: 14 additions & 14 deletions tests/Console/PullRequestCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,14 @@ public function providerArgument()
{
return [
[
'vendor',
'owner',
true,
'The name of the vendor, e.g., "localheinz"',
'The owner, e.g., "localheinz"',
],
[
'package',
'repository',
true,
'The name of the package, e.g. "github-changelog"',
'The repository, e.g. "github-changelog"',
],
[
'start-reference',
Expand Down Expand Up @@ -264,8 +264,8 @@ public function testExecuteDelegatesToPullRequestRepository()
{
$faker = $this->faker();

$vendor = $faker->unique()->word;
$package = $faker->unique()->word;
$owner = $faker->unique()->userName;
$repository = $faker->unique()->slug();
$startReference = $faker->unique()->sha1;
$endReference = $faker->unique()->sha1;

Expand All @@ -275,8 +275,8 @@ public function testExecuteDelegatesToPullRequestRepository()
->expects($this->once())
->method('items')
->with(
$this->equalTo($vendor),
$this->equalTo($package),
$this->equalTo($owner),
$this->equalTo($repository),
$this->equalTo($startReference),
$this->equalTo($endReference)
)
Expand All @@ -287,8 +287,8 @@ public function testExecuteDelegatesToPullRequestRepository()

$this->command->run(
$this->input([
'vendor' => $vendor,
'package' => $package,
'owner' => $owner,
'repository' => $repository,
'start-reference' => $startReference,
'end-reference' => $endReference,
]),
Expand Down Expand Up @@ -332,8 +332,8 @@ public function testExecuteRendersPullRequestsWithTheTemplate()
$faker = $this->faker;

$arguments = [
'vendor' => $faker->unique()->word,
'package' => $faker->unique()->word,
'owner' => $faker->unique()->userName,
'repository' => $faker->unique()->slug(),
'start-reference' => $faker->unique()->sha1,
'end-reference' => $faker->unique()->sha1,
];
Expand Down Expand Up @@ -369,8 +369,8 @@ public function testExecuteHandlesExceptionsThrownWhenFetchingPullRequests()
$faker = $this->faker();

$arguments = [
'vendor' => $faker->unique()->word,
'package' => $faker->unique()->word,
'owner' => $faker->unique()->userName,
'repository' => $faker->unique()->slug(),
'start-reference' => $faker->unique()->sha1,
'end-reference' => $faker->unique()->sha1,
];
Expand Down
Loading

0 comments on commit 2ac7c9a

Please sign in to comment.