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.

YAML   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 25
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0
wmc 4
lcom 0
cbo 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A parse() 0 13 4
1
<?php
2
3
namespace Nathanmac\Utilities\Parser\Formats;
4
5
use Nathanmac\Utilities\Parser\Exceptions\ParserException;
6
use Symfony\Component\Yaml\Yaml as SFYaml;
7
8
/**
9
 * YAML Formatter
10
 *
11
 * @package    Nathanmac\Utilities\Parser\Formats
12
 * @author     Nathan Macnamara <[email protected]>
13
 * @license    https://github.com/nathanmac/Parser/blob/master/LICENSE.md  MIT
14
 */
15
class YAML implements FormatInterface
16
{
17
    /**
18
     * Parse Payload Data
19
     *
20
     * @param string $payload
21
     *
22
     * @throws ParserException
23
     * @return array
24
     *
25
     */
26 12
    public function parse($payload)
27
    {
28 12
        if ($payload) {
29
            try {
30 9
                $flags = (defined('Symfony\Component\Yaml\Yaml::PARSE_DATETIME')) ? (SFYaml::PARSE_EXCEPTION_ON_INVALID_TYPE | SFYaml::PARSE_DATETIME) : true;
31 9
                return SFYaml::parse(trim(preg_replace('/\t+/', '', $payload)), $flags);
32 2
            } catch (\Exception $ex) {
33 2
                throw new ParserException('Failed To Parse YAML');
34
            }
35
        }
36
37 3
        return [];
38
    }
39
}
40