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 ( 777b8c...ce01dd )
by Miles
02:28
created

ResourceFlagsTrait::explodeResourceIfElse()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 11
ccs 7
cts 7
cp 1
rs 9.4286
cc 2
eloc 6
nc 2
nop 1
crap 2
1
<?php
2
3
/**
4
 * This file is part of the m1\vars library
5
 *
6
 * (c) m1 <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 *
11
 * @package     m1/vars
12
 * @version     0.3.0
13
 * @author      Miles Croxford <[email protected]>
14
 * @copyright   Copyright (c) Miles Croxford <[email protected]>
15
 * @license     http://github.com/m1/vars/blob/master/LICENSE
16
 * @link        http://github.com/m1/vars/blob/master/README.MD Documentation
17
 */
18
19
namespace M1\Vars\Traits;
20
21
/**
22
 * This trait manages the resource flags that you can use
23
 *
24
 * @since 0.3.0
25
 */
26
trait ResourceFlagsTrait
27
{
28
    /**
29
     * Explodes the ?: flag into pieces
30
     *
31
     * @param string $resource The resource string
32
     *
33
     * @return array The parsed resources
34
     */
35 71
    protected function explodeResourceIfElse($resource)
36
    {
37 71
        $resource = explode("?:", $resource, 2);
38 71
        $resources = array();
39
40 71
        foreach ($resource as $r) {
41 71
            $resources[] = trim($r);
42 71
        }
43
44 71
        return $resources;
45
    }
46
47
    /**
48
     * Returns the array pieces of the exploded ?: into a string
49
     *
50
     * @param array $resource The resource array
51
     *
52
     * @return string The parsed string resource
53
     */
54 46
    protected function implodeResourceIfElse($resource)
55
    {
56 46
        if (count($resource) > 1) {
57 5
            return implode(" ?: ", $resource);
58
        }
59
60 41
        return $resource[0];
61
    }
62
63
    /**
64
     * Checks to see if the file not found exception is suppressed
65
     *
66
     * @param string $resource The resource
67
     *
68
     * @return bool Is the exception suppressed
69
     */
70 71
    private function checkSuppression($resource)
71
    {
72 71
        return substr($resource, 0, 1) === "@";
73
    }
74
}
75