| @@ 73-99 (lines=27) @@ | ||
| 70 | } |
|
| 71 | } |
|
| 72 | ||
| 73 | protected static function checkCalledMethod($constant) |
|
| 74 | { |
|
| 75 | $trace = debug_backtrace(); |
|
| 76 | $info = Backtrace::getInfo('ConstantPatcher', $trace); |
|
| 77 | ||
| 78 | $class = strtolower($info['class']); |
|
| 79 | $class_method = strtolower($info['class_method']); |
|
| 80 | ||
| 81 | // Patches the constants only in the class |
|
| 82 | if (strpos(self::$patches_to_apply[$constant], '::') === false) |
|
| 83 | { |
|
| 84 | if (self::$patches_to_apply[$constant] !== $class) |
|
| 85 | { |
|
| 86 | return false; |
|
| 87 | } |
|
| 88 | return true; |
|
| 89 | } |
|
| 90 | //Patches the constants only in the class method |
|
| 91 | else |
|
| 92 | { |
|
| 93 | if (self::$patches_to_apply[$constant] !== $class_method) |
|
| 94 | { |
|
| 95 | return false; |
|
| 96 | } |
|
| 97 | return true; |
|
| 98 | } |
|
| 99 | } |
|
| 100 | ||
| 101 | /** |
|
| 102 | * Get patched constant value |
|
| @@ 114-140 (lines=27) @@ | ||
| 111 | } |
|
| 112 | } |
|
| 113 | ||
| 114 | protected static function checkCalledMethod($function) |
|
| 115 | { |
|
| 116 | $trace = debug_backtrace(); |
|
| 117 | $info = Backtrace::getInfo('FunctionPatcher', $trace); |
|
| 118 | ||
| 119 | $class = strtolower($info['class']); |
|
| 120 | $class_method = strtolower($info['class_method']); |
|
| 121 | ||
| 122 | // Patches the functions only in the class |
|
| 123 | if (strpos(self::$patches_to_apply[$function], '::') === false) |
|
| 124 | { |
|
| 125 | if (self::$patches_to_apply[$function] !== $class) |
|
| 126 | { |
|
| 127 | return false; |
|
| 128 | } |
|
| 129 | return true; |
|
| 130 | } |
|
| 131 | //Patches the functions only in the class method |
|
| 132 | else |
|
| 133 | { |
|
| 134 | if (self::$patches_to_apply[$function] !== $class_method) |
|
| 135 | { |
|
| 136 | return false; |
|
| 137 | } |
|
| 138 | return true; |
|
| 139 | } |
|
| 140 | } |
|
| 141 | ||
| 142 | public static function __callStatic($function, array $arguments) |
|
| 143 | { |
|