Skip to content

Commit 4634b39

Browse files
Merge pull request #98 from robbieaverill/add-some-new-properties
Add new properties to Package, Version, and Maintainer
2 parents f731d03 + 5a648b9 commit 4634b39

File tree

6 files changed

+96
-0
lines changed

6 files changed

+96
-0
lines changed

spec/Packagist/Api/Result/Package/MaintainerSpec.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ public function let()
1515
'name' => 'Saša Stamenković',
1616
'email' => 'umpirsky@gmail.com',
1717
'homepage' => 'umpirsky.com',
18+
'avatar_url' => 'https://www.gravatar.com/avatar/example',
1819
]);
1920
}
2021

@@ -38,4 +39,8 @@ public function it_gets_homepage()
3839
$this->getHomepage()->shouldReturn('umpirsky.com');
3940
}
4041

42+
public function it_gets_avatar_url()
43+
{
44+
$this->getAvatarUrl()->shouldReturn('https://www.gravatar.com/avatar/example');
45+
}
4146
}

spec/Packagist/Api/Result/Package/VersionSpec.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ public function let(Author $author, Source $source, Dist $dist)
3434
'require-dev' => ['phpspec/phpspec2' => 'dev-develop'],
3535
'suggest' => ['illuminate/events' => 'Required to use the observers with Eloquent (5.1.*).'],
3636
'bin' => ['bin/sylius'],
37+
'support' => [
38+
'issues' => 'https://github.com/Sylius/Sylius/issues',
39+
'source' => 'https://github.com/Sylius/Sylius/tree/v0.1.0',
40+
],
41+
'target_dir' => '',
42+
'default_branch' => false,
3743
]);
3844
}
3945

@@ -173,4 +179,22 @@ public function it_gets_replacement_package_returning_null()
173179

174180
$this->getReplacementPackage()->shouldReturn(null);
175181
}
182+
183+
public function it_gets_support()
184+
{
185+
$this->getSupport()->shouldReturn([
186+
'issues' => 'https://github.com/Sylius/Sylius/issues',
187+
'source' => 'https://github.com/Sylius/Sylius/tree/v0.1.0',
188+
]);
189+
}
190+
191+
public function it_gets_target_dir()
192+
{
193+
$this->getTargetDir()->shouldReturn('');
194+
}
195+
196+
public function it_gets_default_branch()
197+
{
198+
$this->getDefaultBranch()->shouldReturn(false);
199+
}
176200
}

spec/Packagist/Api/Result/PackageSpec.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,11 @@ public function let(Maintainer $maintainer, Version $version, Downloads $downloa
2929
'dependents' => 42,
3030
'github_stars' => 3086,
3131
'github_forks' => 1124,
32+
'github_watchers' => 480,
33+
'github_open_issues' => 32,
3234
// A dynamic property, causes deprecation warnings in PHP 8.2+ and is now ignored in AbstractResult
3335
'supports_cheese' => true,
36+
'language' => 'PHP',
3437
]);
3538
}
3639

@@ -143,4 +146,19 @@ public function it_gets_github_forks()
143146
{
144147
$this->getGithubForks()->shouldReturn(1124);
145148
}
149+
150+
public function it_gets_github_watchers()
151+
{
152+
$this->getGithubWatchers()->shouldReturn(480);
153+
}
154+
155+
public function it_gets_github_open_issues()
156+
{
157+
$this->getGithubOpenIssues()->shouldReturn(32);
158+
}
159+
160+
public function it_gets_language()
161+
{
162+
$this->getLanguage()->shouldReturn('PHP');
163+
}
146164
}

src/Packagist/Api/Result/Package.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@ class Package extends AbstractResult
3939

4040
protected int $githubForks = 0;
4141

42+
protected int $githubOpenIssues = 0;
43+
44+
protected int $githubWatchers = 0;
45+
46+
protected string $language = '';
47+
4248
public function getName(): string
4349
{
4450
return $this->name;
@@ -132,4 +138,19 @@ public function getGithubForks(): int
132138
{
133139
return $this->githubForks;
134140
}
141+
142+
public function getGithubWatchers(): int
143+
{
144+
return $this->githubWatchers;
145+
}
146+
147+
public function getGithubOpenIssues(): int
148+
{
149+
return $this->githubOpenIssues;
150+
}
151+
152+
public function getLanguage(): string
153+
{
154+
return $this->language;
155+
}
135156
}

src/Packagist/Api/Result/Package/Maintainer.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ class Maintainer extends AbstractResult
1414

1515
protected string $homepage = '';
1616

17+
protected string $avatarUrl = '';
18+
1719
public function getName(): string
1820
{
1921
return $this->name;
@@ -28,4 +30,9 @@ public function getHomepage(): string
2830
{
2931
return $this->homepage;
3032
}
33+
34+
public function getAvatarUrl(): string
35+
{
36+
return $this->avatarUrl;
37+
}
3138
}

src/Packagist/Api/Result/Package/Version.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@ class Version extends AbstractResult
5050

5151
protected array $suggest = [];
5252

53+
protected array $support = [];
54+
55+
protected string $targetDir = '';
56+
57+
protected bool $defaultBranch = false;
58+
5359
/**
5460
* @var bool|string
5561
*/
@@ -160,6 +166,21 @@ public function getSuggest(): array
160166
return $this->suggest;
161167
}
162168

169+
public function getSupport(): array
170+
{
171+
return $this->support;
172+
}
173+
174+
public function getTargetDir(): string
175+
{
176+
return $this->targetDir;
177+
}
178+
179+
public function getDefaultBranch(): bool
180+
{
181+
return $this->defaultBranch;
182+
}
183+
163184
public function isAbandoned(): bool
164185
{
165186
return (bool) $this->abandoned;

0 commit comments

Comments
 (0)