Passed
Push — stage ( a7e110...431749 )
by Jon
06:24
created

GitHubService::GetPublicRepo()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 9.6666
c 0
b 0
f 0
cc 2
eloc 6
nc 2
nop 1
1
<?php
2
3
/** Created by PhpStorm,  User: jonphipps,  Date: 2018-02-17,  Time: 6:48 PM */
4
5
namespace App\Services\Publish;
6
7
use Github\Exception\RuntimeException;
8
use GrahamCampbell\GitHub\Facades\GitHub;
9
10
class GitHubService
11
{
12
    /**
13
     * @param $path
14
     *
15
     * @return string|bool json
16
     */
17
    public static function GetPublicRepo($path)
18
    {
19
        $user = str_before($path, '/');
20
        $repo = str_after($path, '/');
21
        try {
22
            return GitHub::repo()->show($user, $repo);
23
        }
24
        catch (RuntimeException $e) {
25
            return false;
26
        }
27
    }
28
}
29