| 1 |
lars |
1 |
<?php
|
|
|
2 |
/*
|
|
|
3 |
* $Id: ProjectComponent.php 176 2007-03-14 14:23:39Z hans $
|
|
|
4 |
*
|
|
|
5 |
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
6 |
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
7 |
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
|
8 |
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
9 |
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
10 |
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
|
11 |
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
12 |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
13 |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
14 |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
15 |
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
16 |
*
|
|
|
17 |
* This software consists of voluntary contributions made by many individuals
|
|
|
18 |
* and is licensed under the LGPL. For more information please see
|
|
|
19 |
* <http://phing.info>.
|
|
|
20 |
*/
|
|
|
21 |
|
|
|
22 |
/**
|
|
|
23 |
* Abstract class providing properties and methods common to all
|
|
|
24 |
* the project components
|
|
|
25 |
*
|
|
|
26 |
* @author Andreas Aderhold <andi@binarycloud.com>
|
|
|
27 |
* @author Hans Lellelid <hans@xmpl.org>
|
|
|
28 |
* @version $Revision: 1.5 $
|
|
|
29 |
* @package phing
|
|
|
30 |
*/
|
|
|
31 |
abstract class ProjectComponent {
|
|
|
32 |
|
|
|
33 |
/**
|
|
|
34 |
* Holds a reference to the project that a project component
|
|
|
35 |
* (a task, a target, etc.) belongs to
|
|
|
36 |
*
|
|
|
37 |
* @var Project A reference to the current project instance
|
|
|
38 |
*/
|
|
|
39 |
protected $project = null;
|
|
|
40 |
|
|
|
41 |
/**
|
|
|
42 |
* References the project to the current component.
|
|
|
43 |
*
|
|
|
44 |
* @param Project $project The reference to the current project
|
|
|
45 |
*/
|
|
|
46 |
public function setProject($project) {
|
|
|
47 |
$this->project = $project;
|
|
|
48 |
}
|
|
|
49 |
|
|
|
50 |
/**
|
|
|
51 |
* Returns a reference to current project
|
|
|
52 |
*
|
|
|
53 |
* @return Project Reference to current porject object
|
|
|
54 |
*/
|
|
|
55 |
public function getProject() {
|
|
|
56 |
return $this->project;
|
|
|
57 |
}
|
|
|
58 |
|
|
|
59 |
/**
|
|
|
60 |
* Logs a message with the given priority.
|
|
|
61 |
*
|
|
|
62 |
* @param string $msg The message to be logged.
|
|
|
63 |
* @param integer $level The message's priority at this message should have
|
|
|
64 |
*/
|
|
|
65 |
public function log($msg, $level = Project::MSG_INFO) {
|
|
|
66 |
if ($this->project !== null) {
|
|
|
67 |
$this->project->log($msg, $level);
|
|
|
68 |
}
|
|
|
69 |
}
|
|
|
70 |
}
|