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 |
|
|
|
|
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
|
|
|
* Indicates that application will use composer. |
81
|
|
|
* |
82
|
|
|
* @return static |
83
|
|
|
*/ |
84
|
|
|
public function withComposer() |
85
|
|
|
{ |
86
|
|
|
$this->payload['composer'] = true; |
87
|
|
|
|
88
|
|
|
return $this; |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* Set git provider and repository name. |
93
|
|
|
* |
94
|
|
|
* @param string $provider |
95
|
|
|
* @param string $repository |
96
|
|
|
* |
97
|
|
|
* @return static |
98
|
|
|
*/ |
99
|
|
|
protected function setRepositorySource(string $provider, string $repository) |
100
|
|
|
{ |
101
|
|
|
$this->payload = [ |
102
|
|
|
'provider' => $provider, |
103
|
|
|
'repository' => $repository, |
104
|
|
|
]; |
105
|
|
|
|
106
|
|
|
return $this; |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
/** |
110
|
|
|
* Set the branch name. |
111
|
|
|
* |
112
|
|
|
* @param string $branch |
113
|
|
|
* |
114
|
|
|
* @return static |
115
|
|
|
*/ |
116
|
|
|
protected function setRepositoryBranch(string $branch) |
117
|
|
|
{ |
118
|
|
|
$this->payload['branch'] = $branch; |
119
|
|
|
|
120
|
|
|
return $this; |
121
|
|
|
} |
122
|
|
|
} |
123
|
|
|
|
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 methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.