getArg() публичный статический Метод

if $function is one of include/require the $arg is converted to a relative path
public static getArg ( string $arg, string $function ) : string
$arg string argument to process
$function string function name
Результат string
Пример #1
0
 /**
  * Formats function call in a backtrace
  *
  * @param array  $step      backtrace step
  * @param string $separator Arguments separator to use
  *
  * @return string
  */
 public static function getFunctionCall($step, $separator)
 {
     $retval = $step['function'] . '(';
     if (isset($step['args'])) {
         if (count($step['args']) > 1) {
             $retval .= $separator;
             foreach ($step['args'] as $arg) {
                 $retval .= "\t";
                 $retval .= Error::getArg($arg, $step['function']);
                 $retval .= ',' . $separator;
             }
         } elseif (count($step['args']) > 0) {
             foreach ($step['args'] as $arg) {
                 $retval .= Error::getArg($arg, $step['function']);
             }
         }
     }
     $retval .= ')';
     return $retval;
 }
Пример #2
0
 /**
  * Process backtrace to avoid path disclossures, objects and so on
  *
  * @param array $backtrace backtrace
  *
  * @return array
  */
 public static function processBacktrace($backtrace)
 {
     $result = array();
     $members = array('line', 'function', 'class', 'type');
     foreach ($backtrace as $idx => $step) {
         /* Create new backtrace entry */
         $result[$idx] = array();
         /* Make path relative */
         if (isset($step['file'])) {
             $result[$idx]['file'] = Error::relPath($step['file']);
         }
         /* Store members we want */
         foreach ($members as $name) {
             if (isset($step[$name])) {
                 $result[$idx][$name] = $step[$name];
             }
         }
         /* Store simplified args */
         if (isset($step['args'])) {
             foreach ($step['args'] as $key => $arg) {
                 $result[$idx]['args'][$key] = Error::getArg($arg, $step['function']);
             }
         }
     }
     return $result;
 }