From 497ce71a778541f98993fc2000e0ca7081b0293f Mon Sep 17 00:00:00 2001 From: Dan Alloway Date: Wed, 13 May 2015 15:58:26 -0400 Subject: [PATCH 1/3] example class extending the main client --- tests/LateStaticClient.php | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 tests/LateStaticClient.php diff --git a/tests/LateStaticClient.php b/tests/LateStaticClient.php new file mode 100644 index 0000000..9f06fb5 --- /dev/null +++ b/tests/LateStaticClient.php @@ -0,0 +1,8 @@ + Date: Wed, 13 May 2015 15:58:42 -0400 Subject: [PATCH 2/3] test to ensure instance of proper class --- tests/LateStaticClientTest.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 tests/LateStaticClientTest.php diff --git a/tests/LateStaticClientTest.php b/tests/LateStaticClientTest.php new file mode 100644 index 0000000..5f7e5a3 --- /dev/null +++ b/tests/LateStaticClientTest.php @@ -0,0 +1,15 @@ +assertTrue($instance instanceof LateStaticClient); + } + +} From 43e8fb07cc41a284fc3b1f6f67e5b02f7609e4af Mon Sep 17 00:00:00 2001 From: Dan Alloway Date: Wed, 13 May 2015 15:59:01 -0400 Subject: [PATCH 3/3] use late-static binding to new up the client class --- src/Client.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Client.php b/src/Client.php index 1c751c7..2b2c5ba 100644 --- a/src/Client.php +++ b/src/Client.php @@ -69,7 +69,7 @@ class Client public static function instance($name = 'default') { if (! isset(self::$instances[$name])) { - self::$instances[$name] = new Client($name); + self::$instances[$name] = new static($name); } return self::$instances[$name]; }