1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* See class comment |
4
|
|
|
* |
5
|
|
|
* PHP Version 5 |
6
|
|
|
* |
7
|
|
|
* @category Netresearch |
8
|
|
|
* @package Netresearch\Kite |
9
|
|
|
* @author Christian Opitz <[email protected]> |
10
|
|
|
* @license http://www.netresearch.de Netresearch Copyright |
11
|
|
|
* @link http://www.netresearch.de |
12
|
|
|
*/ |
13
|
|
|
|
14
|
|
|
namespace Netresearch\Kite; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* Node - node (and nodes) is a special variable name, which is casted to this class |
18
|
|
|
* |
19
|
|
|
* @category Netresearch |
20
|
|
|
* @package Netresearch\Kite |
21
|
|
|
* @author Christian Opitz <[email protected]> |
22
|
|
|
* @license http://www.netresearch.de Netresearch Copyright |
23
|
|
|
* @link http://www.netresearch.de |
24
|
|
|
*/ |
25
|
|
|
class Node extends Variables |
26
|
|
|
{ |
27
|
|
|
/** |
28
|
|
|
* Node constructor. |
29
|
|
|
* |
30
|
|
|
* @param Variables $parent Parent object (Task/Job/Workflow) |
31
|
|
|
*/ |
32
|
|
|
public function __construct(Variables $parent) |
33
|
|
|
{ |
34
|
|
|
parent::__construct( |
35
|
|
|
$parent, |
36
|
|
|
array( |
37
|
|
|
'user' => '', |
38
|
|
|
'pass' => '', |
39
|
|
|
'port' => '', |
40
|
|
|
// SCP/SSH URL |
41
|
|
|
'url' => '{(this.user ? this.user ~ "@" : "") ~ this.host}', |
42
|
|
|
'sshOptions' => ' -A{this.port ? " -p " ~ this.port : ""}{this.pass ? " -o PubkeyAuthentication=no" : ""}', |
43
|
|
|
'scpOptions' => '{this.port ? " -P " ~ this.port : ""}{this.pass ? " -o PubkeyAuthentication=no" : ""}', |
44
|
|
|
'php' => 'php', // PHP executable |
45
|
|
|
'webRoot' => '{this.deployPath}/current', |
46
|
|
|
// commented out to trigger exceptions when those are empty: |
47
|
|
|
// 'webUrl' => 'http://example.com', |
|
|
|
|
48
|
|
|
// 'host' => 'example.com', |
|
|
|
|
49
|
|
|
// 'deployPath' => '/var/www' |
|
|
|
|
50
|
|
|
) |
51
|
|
|
); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* Cast this to string - returns the url |
56
|
|
|
* |
57
|
|
|
* @return string |
58
|
|
|
*/ |
59
|
|
|
public function __toString() |
60
|
|
|
{ |
61
|
|
|
return (string) $this->get('url'); |
62
|
|
|
} |
63
|
|
|
} |
64
|
|
|
?> |
65
|
|
|
|
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.