1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
4
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
5
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
6
|
|
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
7
|
|
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
8
|
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
9
|
|
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
10
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
11
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
12
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
13
|
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
14
|
|
|
* |
15
|
|
|
* This software consists of voluntary contributions made by many individuals |
16
|
|
|
* and is licensed under the LGPL. For more information please see |
17
|
|
|
* <http://phing.info>. |
18
|
|
|
*/ |
19
|
|
|
|
20
|
|
|
namespace Phing\Task\System; |
21
|
|
|
|
22
|
|
|
use Phing\Exception\BuildException; |
23
|
|
|
use Phing\Task\System\FailTask; |
24
|
|
|
use Phing\Type\Reference; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* Exits the active build, giving an additional message |
28
|
|
|
* if available. |
29
|
|
|
* |
30
|
|
|
* @author Hans Lellelid <[email protected]> (Phing) |
31
|
|
|
* @author Nico Seessle <[email protected]> (Ant) |
32
|
|
|
*/ |
33
|
|
|
class ThrowTask extends FailTask |
34
|
|
|
{ |
35
|
|
|
/** |
36
|
|
|
* @var Reference |
37
|
|
|
*/ |
38
|
|
|
private $reference = null; |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* @throws BuildException |
42
|
|
|
*/ |
43
|
2 |
|
public function main() |
44
|
|
|
{ |
45
|
2 |
|
$reffed = $this->reference !== null ? $this->reference->getReferencedObject($this->getProject()) : null; |
46
|
|
|
|
47
|
2 |
|
if ($reffed !== null && $reffed instanceof BuildException) { |
48
|
2 |
|
throw $reffed; |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
parent::main(); |
52
|
|
|
} |
53
|
|
|
|
54
|
2 |
|
public function setRefid(Reference $ref) |
55
|
|
|
{ |
56
|
2 |
|
$this->reference = $ref; |
57
|
2 |
|
} |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* @return Reference |
61
|
|
|
*/ |
62
|
|
|
public function getRefid() |
63
|
|
|
{ |
64
|
|
|
return $this->reference; |
65
|
|
|
} |
66
|
|
|
} |
67
|
|
|
|