From 7ccd9a4d39176cd5514d3fad7e551878be933107 Mon Sep 17 00:00:00 2001 From: Egor Talantsev Date: Fri, 23 Feb 2018 17:19:25 +0500 Subject: [PATCH] Fix Issue with private fields and late static bindings --- src/PAGI/Client/Impl/ClientImpl.php | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/PAGI/Client/Impl/ClientImpl.php b/src/PAGI/Client/Impl/ClientImpl.php index 61d30ec..8b2d576 100644 --- a/src/PAGI/Client/Impl/ClientImpl.php +++ b/src/PAGI/Client/Impl/ClientImpl.php @@ -52,19 +52,19 @@ class ClientImpl extends AbstractClient * Current instance. * @var ClientImpl */ - private static $instance = false; + protected static $instance = false; /** * AGI input * @var stream */ - private $input; + protected $input; /** * AGI output * @var stream */ - private $output; + protected $output; /** * Sends a command to asterisk. Returns an array with: @@ -164,13 +164,11 @@ protected function read() */ public static function getInstance(array $options = array()) { - if (self::$instance === false) { - $ret = new ClientImpl($options); - self::$instance = $ret; - } else { - $ret = self::$instance; + if (static::$instance === false) { + static::$instance = new static($options); } - return $ret; + + return static::$instance; } /**