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.
Completed
Push — master ( aea469...8a5434 )
by Miles
02:13
created

PathTrait   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
c 1
b 0
f 0
lcom 1
cbo 0
dl 0
loc 45
ccs 11
cts 11
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getPath() 0 4 1
B setPath() 0 16 5
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: miles
5
 * Date: 19/12/15
6
 * Time: 11:32
7
 */
8
9
namespace M1\Vars\Traits;
10
11
trait PathTrait
12
{
13
    /**
14
     * The base path for the Vars config and cache folders
15
     *
16
     * @var string $path
17
     */
18
    public $path;
19
20
    /**
21
     * Get the path
22
     *
23
     * @return string The path
24
     */
25 69
    public function getPath()
26
    {
27 69
        return $this->path;
28
    }
29
30
    /**
31
     * Set the Vars base path
32
     *
33
     * @param string $path The  path to set
34
     *
35
     * @throws \InvalidArgumentException If the path does not exist or is not writable
36
     *
37
     * @return \M1\Vars\Vars
38
     */
39 80
    public function setPath($path, $check_writeable = false)
40
    {
41 80
        if (is_null($path)) {
42 77
            return;
43
        }
44
45 71
        if (!is_dir($path) || ($check_writeable && !is_writable($path))) {
46 2
            throw new \InvalidArgumentException(sprintf(
47 2
                "'%s' base path does not exist or is not writable",
48
                $path
49 2
            ));
50
        }
51
52 69
        $this->path = realpath($path);
53 69
        return $this;
54
    }
55
}