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.

AbstractProtocol   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 0
dl 0
loc 37
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setOption() 0 6 2
A setExecutable() 0 8 2
1
<?php
2
3
/*
4
 * This file is part of rsync-lib
5
 *
6
 * (c) Alberto Fernández <[email protected]>
7
 *
8
 * For the full copyright and license information, please read
9
 * the LICENSE file that was distributed with this source code.
10
 */
11
12
namespace AFM\Rsync;
13
14
/**
15
 * Abstract protocol
16
 *
17
 * @author Alberto <[email protected]>
18
 */
19
abstract class AbstractProtocol
20
{
21
    /**
22
     * @var string
23
     */
24
    protected $executable = "";
25
26
    /**
27
     * Shortcut to set options from array config
28
     *
29
     * @param array $options
30
     * @param $name
31
     * @param $method
32
     */
33
    protected function setOption(Array $options, $name, $method)
34
    {
35
        if (isset($options[$name])) {
36
            $this->$method($options[$name]);
37
        }
38
    }
39
40
    /**
41
     * Sets rsync executable location, i.e.: /usr/bin/rsync
42
     *
43
     * @param $rsyncLocation
44
     *
45
     * @throws \InvalidArgumentException If the rsync location is not executable
46
     */
47
    public function setExecutable($rsyncLocation)
48
    {
49
        if (!is_executable($rsyncLocation)) {
50
            throw new \InvalidArgumentException("Rsync location '".$rsyncLocation."' is invalid");
51
        }
52
53
        $this->executable = $rsyncLocation;
54
    }
55
}
56