| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
class stubException extends Exception implements stubThrowable |
|---|
| 16 |
{ |
|---|
| 17 |
|
|---|
| 18 |
* returns class informations |
|---|
| 19 |
* |
|---|
| 20 |
* @return stubReflectionObject |
|---|
| 21 |
* @XMLIgnore |
|---|
| 22 |
*/ |
|---|
| 23 |
public function getClass() |
|---|
| 24 |
{ |
|---|
| 25 |
stubClassLoader::load('net::stubbles::reflection::stubReflectionObject'); |
|---|
| 26 |
$refObject = new stubReflectionObject($this); |
|---|
| 27 |
return $refObject; |
|---|
| 28 |
} |
|---|
| 29 |
|
|---|
| 30 |
|
|---|
| 31 |
* returns package informations |
|---|
| 32 |
* |
|---|
| 33 |
* @return stubReflectionPackage |
|---|
| 34 |
* @XMLIgnore |
|---|
| 35 |
*/ |
|---|
| 36 |
public function getPackage() |
|---|
| 37 |
{ |
|---|
| 38 |
stubClassLoader::load('net::stubbles::reflection::stubReflectionPackage'); |
|---|
| 39 |
$refPackage = new stubReflectionPackage(stubClassLoader::getPackageName($this->getClassName())); |
|---|
| 40 |
return $refPackage; |
|---|
| 41 |
} |
|---|
| 42 |
|
|---|
| 43 |
|
|---|
| 44 |
* returns the full qualified class name |
|---|
| 45 |
* |
|---|
| 46 |
* @return string |
|---|
| 47 |
* @XMLIgnore |
|---|
| 48 |
*/ |
|---|
| 49 |
public function getClassName() |
|---|
| 50 |
{ |
|---|
| 51 |
return stubClassLoader::getFullQualifiedClassName(get_class($this)); |
|---|
| 52 |
} |
|---|
| 53 |
|
|---|
| 54 |
|
|---|
| 55 |
* returns the name of the package where the class is inside |
|---|
| 56 |
* |
|---|
| 57 |
* @return string |
|---|
| 58 |
* @XMLIgnore |
|---|
| 59 |
*/ |
|---|
| 60 |
public function getPackageName() |
|---|
| 61 |
{ |
|---|
| 62 |
return stubClassLoader::getPackageName($this->getClassName()); |
|---|
| 63 |
} |
|---|
| 64 |
|
|---|
| 65 |
|
|---|
| 66 |
* returns a unique hash code for the class |
|---|
| 67 |
* |
|---|
| 68 |
* @return string |
|---|
| 69 |
* @XMLIgnore |
|---|
| 70 |
*/ |
|---|
| 71 |
public function hashCode() |
|---|
| 72 |
{ |
|---|
| 73 |
return spl_object_hash($this); |
|---|
| 74 |
} |
|---|
| 75 |
|
|---|
| 76 |
|
|---|
| 77 |
* checks whether a value is equal to the class |
|---|
| 78 |
* |
|---|
| 79 |
* @param mixed $compare |
|---|
| 80 |
* @return bool |
|---|
| 81 |
*/ |
|---|
| 82 |
public function equals($compare) |
|---|
| 83 |
{ |
|---|
| 84 |
if ($compare instanceof stubObject) { |
|---|
| 85 |
return ($this->hashCode() == $compare->hashCode()); |
|---|
| 86 |
} |
|---|
| 87 |
|
|---|
| 88 |
return false; |
|---|
| 89 |
} |
|---|
| 90 |
|
|---|
| 91 |
|
|---|
| 92 |
* returns a string representation of the class |
|---|
| 93 |
* |
|---|
| 94 |
* The result is a short but informative representation about the class and |
|---|
| 95 |
* its values. Per default, this method returns: |
|---|
| 96 |
* [fully-qualified-class-name] ' {' [members-and-value-list] '}' |
|---|
| 97 |
* <code> |
|---|
| 98 |
* example::MyException { |
|---|
| 99 |
* message(string): This is an exception. |
|---|
| 100 |
* file(string): foo.php |
|---|
| 101 |
* line(integer): 4 |
|---|
| 102 |
* code(integer): 3 |
|---|
| 103 |
* } |
|---|
| 104 |
* </code> |
|---|
| 105 |
* |
|---|
| 106 |
* @return string |
|---|
| 107 |
* @XMLIgnore |
|---|
| 108 |
*/ |
|---|
| 109 |
public function __toString() |
|---|
| 110 |
{ |
|---|
| 111 |
$string = $this->getClassName() . " {\n"; |
|---|
| 112 |
$string .= ' message(string): ' . $this->getMessage() . "\n"; |
|---|
| 113 |
$string .= ' file(string): ' . $this->getFile() . "\n"; |
|---|
| 114 |
$string .= ' line(integer): ' . $this->getLine() . "\n"; |
|---|
| 115 |
$string .= ' code(integer): ' . $this->getCode() . "\n"; |
|---|
| 116 |
$string .= "}\n"; |
|---|
| 117 |
return $string; |
|---|
| 118 |
} |
|---|
| 119 |
} |
|---|
| 120 |
?> |
|---|
| 121 |
|
|---|