GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Composer   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A canRead() 0 4 1
A read() 0 7 1
1
<?php
2
/**
3
 * Composer.php
4
 *
5
 * @package         ProjectVersioner
6
 * @subpackage      Reader
7
 */
8
9
namespace Naneau\ProjectVersioner\Reader;
10
11
use Naneau\ProjectVersioner\ReaderInterface;
12
13
/**
14
 * Composer
15
 *
16
 * Finds version from composer lock file
17
 *
18
 * @category        Naneau
19
 * @package         ProjectVersioner
20
 * @subpackage      Reader
21
 */
22
class Composer implements ReaderInterface
23
{
24
    /**
25
     * {@inheritdoc}
26
     **/
27
    public function canRead($directory)
28
    {
29
        return is_readable($directory . '/composer.lock');
30
    }
31
32
    /**
33
     * {@inheritdoc}
34
     **/
35
    public function read($directory)
36
    {
37
        return substr(
38
            md5(file_get_contents($directory . '/composer.lock')),
39
            0, 6
40
        );
41
    }
42
}
43