Completed
Push — master ( f0c745...274b6a )
by Sergi Tur
01:40
created

PublishGithub::getRepoFromGithubConfig()   A

Complexity

Conditions 4
Paths 4

Size

Total Lines 16
Code Lines 8

Duplication

Lines 8
Ratio 50 %

Importance

Changes 0
Metric Value
cc 4
eloc 8
nc 4
nop 0
dl 8
loc 16
rs 9.2
c 0
b 0
f 0
1
<?php
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 12 and the first side effect is on line 75.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
2
3
namespace Acacha\ForgePublish\Commands;
4
5
use Acacha\ForgePublish\Commands\Traits\InteractsWithLocalGithub;
6
7
/**
8
 * Class PublishGit.
9
 *
10
 * @package Acacha\ForgePublish\Commands
11
 */
12
class PublishGithub extends SaveEnvVariable
13
{
14
    use InteractsWithLocalGithub;
15
16
    /**
17
     * The name and signature of the console command.
18
     *
19
     * @var string
20
     */
21
    protected $signature = 'publish:github {repo?}';
22
23
    /**
24
     * The console command description.
25
     *
26
     * @var string
27
     */
28
    protected $description = 'Save acacha forge github repo';
29
30
    /**
31
     * Env var to set.
32
     *
33
     * @return mixed
34
     */
35
    protected function envVar()
36
    {
37
        return 'ACACHA_FORGE_GITHUB_REPO';
38
    }
39
40
    /**
41
     * Argument key.
42
     *
43
     * @return mixed
44
     */
45
    protected function argKey()
46
    {
47
        return 'repo';
48
    }
49
50
    /**
51
     * Question text.
52
     *
53
     * @return mixed
54
     */
55
    protected function questionText()
56
    {
57
        return 'Acacha forge Github Repo (vendor/name)?';
58
    }
59
60
    /**
61
     * Default proposed value when asking.
62
     *
63
     */
64
    protected function default()
0 ignored issues
show
Coding Style introduced by
Possible parse error: non-abstract method defined as abstract
Loading history...
65
    {
66
        $default = $this->getRepoFromGithubConfig();
0 ignored issues
show
Coding Style introduced by
It is generally advisable to only define one property per statement.

Only declaring a single property per statement allows you to later on add doc comments more easily.

It is also recommended by PSR2, so it is a common style that many people expect.

Loading history...
Coding Style introduced by
The visibility should be declared for property $default.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
67
        if (! $default) {
0 ignored issues
show
Coding Style introduced by
It is generally advisable to only define one property per statement.

Only declaring a single property per statement allows you to later on add doc comments more easily.

It is also recommended by PSR2, so it is a common style that many people expect.

Loading history...
Coding Style introduced by
The visibility should be declared for property $default.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
68
            $this->error('No Github Repository found!');
69
            if ($this->confirm('Do you want to run llum github:init command (requires llum installed!)?')) {
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $this.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
70
                passthru('llum github:init');
71
            }
72
        }
73
        return fp_env($this->envVar()) ? fp_env($this->envVar()) : $default;
0 ignored issues
show
Coding Style introduced by
It is generally advisable to only define one property per statement.

Only declaring a single property per statement allows you to later on add doc comments more easily.

It is also recommended by PSR2, so it is a common style that many people expect.

Loading history...
Coding Style introduced by
The visibility should be declared for property $this.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
74
    }
75
}
76