/** * Reports the given error * * @param PC_Obj_Location $locsrc an object from which the location will be copied (null = current) * @param string $msg the error-message * @param int $type the error-type */ public function report($locsrc, $msg, $type) { if (!$locsrc instanceof PC_Obj_Location) { FWS_Helper::def_error('instance', 'locsrc', 'PC_Obj_Location', $locsrc); } $locsrc = new PC_Obj_Location($locsrc->get_file(), $locsrc->get_line()); $this->errors[] = new PC_Obj_Error($locsrc, $msg, $type); }
/** * Builds an URL to the code for given location. * * @param PC_Obj_Location $loc the location * @return string the URL */ public static function get_code_url($loc) { $file = $loc->get_file(); $line = $loc->get_line(); if ($file) { $classes = PC_DAO::get_classes()->get_by_file($file); if (count($classes) == 1) { $url = PC_URL::get_mod_url('class')->set('name', $classes[0]->get_name()); } else { $url = PC_URL::get_mod_url('file')->set('path', $file); } $url->set_anchor('l' . $line); return $url->to_url(); } return '#'; }
/** * Builds an URL to the given location * * @param string $classfile the file of the class * @param PC_Obj_Location $loc the location of the item * @return string the URL */ private function get_url($classfile, $loc) { if ($loc->get_line() == 0) { return $loc->get_file(); } if ($loc->get_file() == $classfile) { return '#l' . $loc->get_line(); } return PC_Utils::get_code_url($loc); }
public function __ToString() { return '[' . $this->loc->get_file() . ', ' . $this->loc->get_line() . '] #' . $this->type . ' ' . $this->msg; }