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

GitHubService   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
dl 0
loc 16
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A GetPublicRepo() 0 9 2
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