public static function dump() { return Amslib_Debug::vdump(func_get_arg(0)); }
/** * method: dump * * todo: write documentation */ public static function dump($vdump = false, $print = false, $die = false) { $data = array("path" => self::$path, "current" => self::$route, "cache" => self::$cache, "url" => self::$url, "name" => self::$name); if ($vdump || $print) { $data = Amslib_Debug::vdump($data); } if ($print) { print $data; } if ($die !== false) { if (!is_string($die)) { $die = ""; } die($die . $data); } return $data; }
public static function getCodeLocation($stack_offset = 2, $exception = NULL) { $stack = $exception ? self::getStackTrace("exception", $exception) : self::getStackTrace(); // eliminate this function from the stack $location = array_slice($stack, $stack_offset); $line = array_shift($location); $location = count($location) == 0 ? ltrim(Amslib_Website::web($line["file"]), "/") : array_shift($location); $line = isset($line["line"]) ? "@{$line["line"]}" : ""; $location = is_array($location) && Amslib_Array::hasKeys($location, array("class", "type", "function")) ? $location["class"] . $location["type"] . $location["function"] : $location; $location = is_array($location) && Amslib_Array::hasKeys($location, array("file", "function")) ? basename($location["file"]) . "({$location["function"]})" : $location; $location = is_array($location) && Amslib_Array::hasKeys($location, "function") ? "{$location["function"]}()" : $location; if (is_array($location)) { error_log("Debugging error, location of error not available: " . Amslib_Debug::vdump($location)); } $location = is_array($location) ? "__ERROR_unknown_location" : $location; return $location . $line; }
/** * method: getConnectionDetails * * todo: write documentation * * note: * - we store the password like this because it hides it from var_dump and friends but * still allows the password to be returned within the duration of the script * - I'm not 100% sure it stops people from grabbing the password, but 90%+ :D */ public function getConnectionDetails() { static $password = NULL; if ($this->connectionDetails) { if (isset($this->connectionDetails["password"])) { $password = $this->connectionDetails["password"]; unset($this->connectionDetails["password"]); } return array($this->connectionDetails, $password); } die(__METHOD__ . ", FATAL ERROR: there were no connection details" . Amslib_Debug::vdump($this->connectionDetails)); }