phpCAS::error PHP Method

error() public static method

This method is used by interface methods to print an error and where the function was originally called from.
public static error ( string $msg ) : void
$msg string the message to print
return void
    public static function error($msg)
    {
        phpCAS::traceBegin();
        $dbg = debug_backtrace();
        $function = '?';
        $file = '?';
        $line = '?';
        if (is_array($dbg)) {
            for ($i = 1; $i < sizeof($dbg); $i++) {
                if (is_array($dbg[$i]) && isset($dbg[$i]['class'])) {
                    if ($dbg[$i]['class'] == __CLASS__) {
                        $function = $dbg[$i]['function'];
                        $file = $dbg[$i]['file'];
                        $line = $dbg[$i]['line'];
                    }
                }
            }
        }
        if (self::$_PHPCAS_VERBOSE) {
            echo "<br />\n<b>phpCAS error</b>: <font color=\"FF0000\"><b>" . __CLASS__ . "::" . $function . '(): ' . htmlentities($msg) . "</b></font> in <b>" . $file . "</b> on line <b>" . $line . "</b><br />\n";
        } else {
            echo "<br />\n<b>Error</b>: <font color=\"FF0000\"><b>" . DEFAULT_ERROR . "</b><br />\n";
        }
        phpCAS::trace($msg . ' in ' . $file . 'on line ' . $line);
        phpCAS::traceEnd();
        throw new CAS_GracefullTerminationException(__CLASS__ . "::" . $function . '(): ' . $msg);
    }

Usage Example

Ejemplo n.º 1
0
 /**
  * This virtual method reads a PGT corresponding to a PGT Iou and deletes
  * the corresponding storage entry.
  *
  * @param string $pgt_iou the PGT iou
  *
  * @return void
  *
  * @note Should never be called.
  */
 function read($pgt_iou)
 {
     phpCAS::error(__CLASS__ . '::' . __FUNCTION__ . '() should never be called');
 }
All Usage Examples Of phpCAS::error