Skip to content

Commit cd1df37

Browse files
committed
Add GitHub forks and GitHub stars
1 parent 44bdf78 commit cd1df37

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

spec/Packagist/Api/Result/PackageSpec.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ function let($maintainer, $version, $source, $dist, $downloads, $time)
2828
'favers' => 9999999999,
2929
'suggesters' => 21,
3030
'dependents' => 42,
31+
'github_stars' => 3086,
32+
'github_forks' => 1124
3133
));
3234
}
3335

@@ -100,4 +102,14 @@ function it_gets_dependents()
100102
{
101103
$this->getDependents()->shouldReturn(42);
102104
}
105+
106+
function it_gets_github_stars()
107+
{
108+
$this->getGithubStars()->shouldReturn(3086);
109+
}
110+
111+
function it_gets_github_forks()
112+
{
113+
$this->getGithubForks()->shouldReturn(1124);
114+
}
103115
}

src/Packagist/Api/Result/Package.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,16 @@ class Package extends AbstractResult
6464
*/
6565
protected $dependents = 0;
6666

67+
/**
68+
* @var integer
69+
*/
70+
protected $githubStars = 0;
71+
72+
/**
73+
* @var integer
74+
*/
75+
protected $githubForks = 0;
76+
6777
/**
6878
* @return string
6979
*/
@@ -159,4 +169,20 @@ public function getDependents()
159169
{
160170
return $this->dependents;
161171
}
172+
173+
/**
174+
* @return integer
175+
*/
176+
public function getGithubStars()
177+
{
178+
return $this->githubStars;
179+
}
180+
181+
/**
182+
* @return integer
183+
*/
184+
public function getGithubForks()
185+
{
186+
return $this->githubForks;
187+
}
162188
}

0 commit comments

Comments
 (0)