Example #1
0
 /**
  * Formats a Vampire for the log
  *
  * @param Vampire $vampire
  *
  * @return string
  */
 public function format(Vampire $vampire)
 {
     return json_encode(array('tombstoneDate' => $vampire->getTombstoneDate(), 'author' => $vampire->getAuthor(), 'label' => $vampire->getLabel(), 'file' => $vampire->getFile(), 'line' => $vampire->getLine(), 'method' => $vampire->getMethod(), 'invocationDate' => $vampire->getInvocationDate(), 'invoker' => $vampire->getInvoker())) . "\n";
 }
Example #2
0
 /**
  * @param Vampire $vampire
  *
  * @return string
  */
 public static function vampireToLog(Vampire $vampire)
 {
     return json_encode(array('v' => self::CURRENT_VERSION, 'd' => $vampire->getTombstoneDate(), 'a' => $vampire->getAuthor(), 'l' => $vampire->getLabel(), 'f' => $vampire->getFile(), 'n' => $vampire->getLine(), 'm' => $vampire->getMethod(), 'id' => $vampire->getInvocationDate(), 'im' => $vampire->getInvoker()));
 }
Example #3
0
 /**
  * Formats a Vampire for the log
  *
  * @param Vampire $vampire
  *
  * @return string
  */
 public function format(Vampire $vampire)
 {
     $template = '%s - Vampire detected: tombstone("%s", "%s"%s), in file %s:%s, in function %s, invoked by %s' . "\n";
     return sprintf($template, $vampire->getInvocationDate(), $vampire->getTombstoneDate(), $vampire->getAuthor(), $vampire->getLabel() ? ', "' . $vampire->getLabel() . '"' : '', $vampire->getFile(), $vampire->getLine(), $vampire->getMethod(), $vampire->getInvoker());
 }