From d74beb6c6a46f00190778be6ebd6f2a522444135 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre=20Mazi=C3=A8re?= Date: Fri, 8 Jul 2016 19:07:30 +0200 Subject: [PATCH] core: move message() method to parent class BridgeAbstract MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pierre Mazière --- lib/Bridge.php | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/lib/Bridge.php b/lib/Bridge.php index 2daca2af..c5a8ae05 100644 --- a/lib/Bridge.php +++ b/lib/Bridge.php @@ -105,6 +105,18 @@ abstract class BridgeAbstract implements BridgeInterface{ return $this; } + public function message($text) { + if(!file_exists('DEBUG')){ + return; + } + $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 3); + $calling = $backtrace[2]; + $message = $calling["file"].":".$calling["line"] + ." class ".get_class($this)."->".$calling["function"] + ." - ".$text; + error_log($message); + } + protected function getContents($url,$use_include_path=false,$context=null,$offset=0,$maxlen=null){ $contextOptions = array( 'http' => array( @@ -233,15 +245,7 @@ abstract class HttpCachingBridgeAbstract extends BridgeAbstract { // filename is NO GOOD // unlink($filename); } - - public function message($text) { - $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 3); - $calling = $backtrace[2]; - $message = $calling["file"].":".$calling["line"] - ." class ".get_class($this)."->".$calling["function"] - ." - ".$text; - error_log($message); - } + } class Bridge{