|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* Task runner, code generator and build tool for easier continuos integration |
|
5
|
|
|
* |
|
6
|
|
|
* @link https://github.com/hiqdev/hidev |
|
7
|
|
|
* @package hidev |
|
8
|
|
|
* @license BSD-3-Clause |
|
9
|
|
|
* @copyright Copyright (c) 2014-2016, HiQDev (http://hiqdev.com/) |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace hidev\controllers; |
|
13
|
|
|
|
|
14
|
|
|
/** |
|
15
|
|
|
* Goal for GitHub. |
|
16
|
|
|
*/ |
|
17
|
|
|
class GithubController extends CommonController |
|
18
|
|
|
{ |
|
19
|
|
|
protected $_name; |
|
20
|
|
|
protected $_vendor; |
|
21
|
|
|
protected $_package; |
|
22
|
|
|
|
|
23
|
|
|
public function setName($value) |
|
24
|
|
|
{ |
|
25
|
|
|
list($vendor, $package) = explode('/', $value, 2); |
|
26
|
|
|
$this->_name = $value; |
|
27
|
|
|
$this->_vendor = $vendor ?: $package; |
|
28
|
|
|
$this->_package = $package ?: $vendor; |
|
29
|
|
|
} |
|
30
|
|
|
|
|
31
|
|
|
public function getName() |
|
32
|
|
|
{ |
|
33
|
|
|
if ($this->_name === null) { |
|
34
|
|
|
$this->setName($this->takeGoal('package')->fullName); |
|
35
|
|
|
} |
|
36
|
|
|
|
|
37
|
|
|
return $this->_name; |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
public function setVendor($value) |
|
41
|
|
|
{ |
|
42
|
|
|
$this->_vendor = $value; |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
public function getVendor() |
|
46
|
|
|
{ |
|
47
|
|
|
if ($this->_vendor === null) { |
|
48
|
|
|
$this->_vendor = $this->getVendor()->name; |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
return $this->_vendor; |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
public function actionCreate() |
|
55
|
|
|
{ |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
public function setPackage($value) |
|
59
|
|
|
{ |
|
60
|
|
|
$this->_package = $value; |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
public function getPackage() |
|
64
|
|
|
{ |
|
65
|
|
|
if ($this->_package === null) { |
|
66
|
|
|
$this->_package = $this->takeGoal('package')->name; |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
return $this->_package; |
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
|
|
/** |
|
73
|
|
|
* Clone repo from github. |
|
74
|
|
|
* TODO to work need to redo HiDev to run this action without normal initilization. |
|
75
|
|
|
* @param string $repo full name vendor/package |
|
76
|
|
|
* @return int exit code |
|
77
|
|
|
*/ |
|
78
|
|
|
public function actionClone($repo) |
|
79
|
|
|
{ |
|
80
|
|
|
return $this->passthru('git', ['clone', '[email protected]:' . $repo]); |
|
|
|
|
|
|
81
|
|
|
} |
|
82
|
|
|
} |
|
83
|
|
|
|
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: