Changeset View
Changeset View
Standalone View
Standalone View
src/error/PhutilErrorTrap.php
| Show All 35 Lines | |||||
| * that you should not create long-lived traps, or they may consume | * that you should not create long-lived traps, or they may consume | ||||
| * unbounded amounts of memory to hold the error log. | * unbounded amounts of memory to hold the error log. | ||||
| */ | */ | ||||
| final class PhutilErrorTrap extends Phobject { | final class PhutilErrorTrap extends Phobject { | ||||
| private $destroyed; | private $destroyed; | ||||
| private $errors = array(); | private $errors = array(); | ||||
| public function addError($num, $str, $file, $line, $ctx) { | public function addError($num, $str, $file, $line) { | ||||
| $this->errors[] = array( | $this->errors[] = array( | ||||
| 'num' => $num, | 'num' => $num, | ||||
| 'str' => $str, | 'str' => $str, | ||||
| 'file' => $file, | 'file' => $file, | ||||
| 'line' => $line, | 'line' => $line, | ||||
| 'ctx' => $ctx, | |||||
| ); | ); | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function getErrorsAsString() { | public function getErrorsAsString() { | ||||
| $out = array(); | $out = array(); | ||||
| foreach ($this->errors as $error) { | foreach ($this->errors as $error) { | ||||
| $out[] = $error['str']; | $out[] = $error['str']; | ||||
| Show All 25 Lines | |||||