Licenses   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 30
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A listAllLicenses() 0 4 1
A getIndividualLicense() 0 6 1
1
<?php
2
namespace FlexyProject\GitHub\Receiver\Miscellaneous;
3
4
/**
5
 * The Licenses API class returns information about open source licenses or under what license, if any a given project
6
 * is distributed.
7
 *
8
 * @link    https://developer.github.com/v3/licenses/
9
 * @package FlexyProject\GitHub\Receiver\Miscellaneous
10
 */
11
class Licenses extends AbstractMiscellaneous
12
{
13
14
    /**
15
     * List all licenses
16
     *
17
     * @link https://developer.github.com/v3/licenses/#list-all-licenses
18
     * @return array
19
     */
20
    public function listAllLicenses(): array
21
    {
22
        return $this->getApi()->setAccept('application/vnd.github.drax-preview+json')->request('/licenses');
23
    }
24
25
    /**
26
     * Get an individual license
27
     *
28
     * @link https://developer.github.com/v3/licenses/#get-an-individual-license
29
     *
30
     * @param string $license
31
     *
32
     * @return array
33
     */
34
    public function getIndividualLicense(string $license): array
35
    {
36
        return $this->getApi()->setAccept('application/vnd.github.drax-preview+json')->request($this->getApi()
37
                                                                                                    ->sprintf('/licenses/:license',
38
                                                                                                        $license));
39
    }
40
}