Code Duplication    Length = 50-50 lines in 2 locations

src/Providers/Drone.php 1 location

@@ 15-64 (lines=50) @@
12
 * @copyright Copyright (c) 2016, Matthias Mullie. All rights reserved.
13
 * @license LICENSE MIT
14
 */
15
class Drone extends None implements Environment
16
{
17
    /**
18
     * {@inheritdoc}
19
     */
20
    public static function isCurrent()
21
    {
22
        return getenv('DRONE') === 'true';
23
    }
24
25
    /**
26
     * {@inheritdoc}
27
     */
28
    public function getProvider()
29
    {
30
        return 'drone';
31
    }
32
33
    /**
34
     * {@inheritdoc}
35
     */
36
    public function getBranch()
37
    {
38
        return $this->getPullRequest() === '' ? getenv('DRONE_BRANCH') : '';
39
    }
40
41
    /**
42
     * {@inheritdoc}
43
     */
44
    public function getPullRequest()
45
    {
46
        return getenv('DRONE_PR');
47
    }
48
49
    /**
50
     * {@inheritdoc}
51
     */
52
    public function getCommit()
53
    {
54
        return getenv('DRONE_COMMIT') ?: getenv('SVN_REVISION');
55
    }
56
57
    /**
58
     * {@inheritdoc}
59
     */
60
    public function getBuild()
61
    {
62
        return getenv('DRONE_BUILD_NUMBER');
63
    }
64
}
65

src/Providers/SnapCI.php 1 location

@@ 14-63 (lines=50) @@
11
 * @copyright Copyright (c) 2016, Matthias Mullie. All rights reserved.
12
 * @license LICENSE MIT
13
 */
14
class SnapCI extends None implements Environment
15
{
16
    /**
17
     * {@inheritdoc}
18
     */
19
    public static function isCurrent()
20
    {
21
        return getenv('SNAP_CI') === 'true';
22
    }
23
24
    /**
25
     * {@inheritdoc}
26
     */
27
    public function getProvider()
28
    {
29
        return 'snap';
30
    }
31
32
    /**
33
     * {@inheritdoc}
34
     */
35
    public function getBranch()
36
    {
37
        return getenv('SNAP_BRANCH') ?: '';
38
    }
39
40
    /**
41
     * {@inheritdoc}
42
     */
43
    public function getPullRequest()
44
    {
45
        return getenv('SNAP_PULL_REQUEST_NUMBER') ?: '';
46
    }
47
48
    /**
49
     * {@inheritdoc}
50
     */
51
    public function getCommit()
52
    {
53
        return getenv('SNAP_COMMIT');
54
    }
55
56
    /**
57
     * {@inheritdoc}
58
     */
59
    public function getBuild()
60
    {
61
        return getenv('SNAP_PIPELINE_COUNTER');
62
    }
63
}
64