Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?php
2
/*
3
 *  $Id: EventObject.php 325 2007-12-20 15:44:58Z 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
 *  @package phing.system.lang
24
 */
25
class EventObject {
26
 
27
    /** The object on which the Event initially occurred. */
28
    protected $source;
29
 
30
    /** Constructs a prototypical Event. */
31
    function __construct($source) {
32
        if ($source === null) {
33
            throw new Exception("Null source");
34
        }
35
        $this->source = $source;
36
    }
37
 
38
    /** The object on which the Event initially occurred. */
39
    function getSource() {
40
        return $this->source;
41
    }
42
 
43
    /** Returns a String representation of this EventObject.*/
44
    function toString() {
45
        if (method_exists($this->source, "toString")) {
46
            return get_class($this)."[source=".$this->source->toString()."]";
47
        } else {
48
            return get_class($this)."[source=".get_class($this->source)."]";
49
        }
50
    }
51
}
52