Completed
Push — master ( 14b89e...4d034c )
by Timur
07:23 queued 02:10
created

GitApplication::usingBranch()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace Laravel\Forge\Applications;
4
5
use Laravel\Forge\Contracts\ApplicationContract;
6
7
class GitApplication extends Application implements ApplicationContract
8
{
9
    /**
10
     * Application type.
11
     *
12
     * @return string
13
     */
14
    public function type()
15
    {
16
        return 'git';
17
    }
18
19
    /**
20
     * Indicates that application will be installed from GitHub repository.
21
     *
22
     * @param string $repository
23
     *
24
     * @return static
25
     */
26
    public function fromGithub(string $repository)
27
    {
28
        return $this->setRepositorySource('github', $repository);
29
    }
30
31
    /**
32
     * Indicates that application will be installed from Bitbucket repository.
33
     *
34
     * @param string $repository
35
     *
36
     * @return static
37
     */
38
    public function fromBitbucket(string $repository)
39
    {
40
        return $this->setRepositorySource('bitbucket', $repository);
41
    }
42
43
    /**
44
     * Indicates that application will be installed from Gitlab repository.
45
     *
46
     * @param string $repository
47
     *
48
     * @return static
49
     */
50
    public function fromGitlab(string $repository)
51
    {
52
        return $this->setRepositorySource('gitlab', $repository);
53
    }
54
55
    /**
56
     * Indicates that application will be installed from custom git repository.
57
     *
58
     * @param string $repository
0 ignored issues
show
Bug introduced by
There is no parameter named $repository. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
59
     *
60
     * @return static
61
     */
62
    public function fromGit(string $url)
63
    {
64
        return $this->setRepositorySource('custom', $url);
65
    }
66
67
    /**
68
     * Indicates which branch from the repository should be used.
69
     *
70
     * @param string $branch
71
     *
72
     * @return static
73
     */
74
    public function usingBranch(string $branch)
75
    {
76
        return $this->setRepositoryBranch($branch);
77
    }
78
79
    /**
80
     * Set git provider and repository name.
81
     *
82
     * @param string $provider
83
     * @param string $repository
84
     *
85
     * @return static
86
     */
87
    protected function setRepositorySource(string $provider, string $repository)
88
    {
89
        $this->payload = [
90
            'provider' => $provider,
91
            'repository' => $repository,
92
        ];
93
94
        return $this;
95
    }
96
97
    /**
98
     * Set the branch name.
99
     *
100
     * @param string $branch
101
     *
102
     * @return static
103
     */
104
    protected function setRepositoryBranch(string $branch)
105
    {
106
        $this->payload['branch'] = $branch;
107
108
        return $this;
109
    }
110
}
111