Completed
Pull Request — master (#26)
by Bernhard
07:30
created

Objct::equals()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 6
c 0
b 0
f 0
rs 10
cc 2
nc 2
nop 1
1
<?php
2
3
/**
4
 * \AppserverIo\Lang\Object
5
 *
6
 * NOTICE OF LICENSE
7
 *
8
 * This source file is subject to the Open Software License (OSL 3.0)
9
 * that is available through the world-wide-web at this URL:
10
 * http://opensource.org/licenses/osl-3.0.php
11
 *
12
 * PHP version 5
13
 *
14
 * @author    Tim Wagner <[email protected]>
15
 * @copyright 2015 TechDivision GmbH <[email protected]>
16
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
 * @link      https://github.com/appserver-io/lang
18
 * @link      http://www.appserver.io
19
 */
20
21
namespace AppserverIo\Lang;
22
23
/**
24
 * This class is the abstract class of all other classes.
25
 *
26
 * @author    Tim Wagner <[email protected]>
27
 * @copyright 2015 TechDivision GmbH <[email protected]>
28
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
29
 * @link      https://github.com/appserver-io/lang
30
 * @link      http://www.appserver.io
31
 */
32
abstract class Objct
33
{
34
35
    /**
36
     * This method returns the class as
37
     * a string representation.
38
     *
39
     * @return string The objects string representation
40
     */
41
    public function __toString()
42
    {
43
        return get_class($this) . "@" . sha1(serialize($this));
44
    }
45
46
    /**
47
     * This method returns the class name as
48
     * a string.
49
     *
50
     * @return string
51
     */
52
    public static function __getClass()
53
    {
54
        return __CLASS__;
55
    }
56
57
    /**
58
     * This method checks if the passed object is equal
59
     * to itself.
60
     *
61
     * @param \AppserverIo\Lang\Objct $obj The object to check
62
     *
63
     * @return boolean Returns TRUE if the passed object is equal
64
     */
65
    public function equals(Objct $obj)
66
    {
67
        if ($obj === $this) {
68
            return true;
69
        }
70
        return false;
71
    }
72
}
73