Conditions | 2 |
Paths | 2 |
Total Lines | 31 |
Code Lines | 24 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 2 |
1 | <?php |
||
20 | protected function convertRepo(array $data) |
||
21 | { |
||
22 | $permissions = null; |
||
23 | |||
24 | if (array_key_exists('permissions', $data)) { |
||
25 | $permissions = new GithubRepoPermissions( |
||
26 | (bool) $data['permissions']['admin'], |
||
27 | (bool) $data['permissions']['push'], |
||
28 | (bool) $data['permissions']['pull'] |
||
29 | ); |
||
30 | } |
||
31 | |||
32 | return new GithubRepoSource( |
||
33 | new GithubRepoId($data['id']), |
||
34 | $this->getUser($data['owner']), |
||
|
|||
35 | $data['owner']['login'], |
||
36 | $data['name'], |
||
37 | $data['full_name'], |
||
38 | $data['html_url'], |
||
39 | $data['description'], |
||
40 | $data['fork'], |
||
41 | $data['default_branch'], |
||
42 | $data['private'], |
||
43 | $data['git_url'], |
||
44 | $data['ssh_url'], |
||
45 | $permissions, |
||
46 | new DateTime($data['created_at']), |
||
47 | new DateTime($data['updated_at']), |
||
48 | new DateTime($data['pushed_at']) |
||
49 | ); |
||
50 | } |
||
51 | } |
||
52 |
This check looks for methods that are used by a trait but not required by it.
To illustrate, let’s look at the following code example
The trait
Idable
provides a methodequalsId
that in turn relies on the methodgetId()
. If this method does not exist on a class mixing in this trait, the method will fail.Adding the
getId()
as an abstract method to the trait will make sure it is available.