From f5614b64f778d45600505cc35f70b4b8aec237c4 Mon Sep 17 00:00:00 2001 From: Fabiano Sant'Ana Date: Sat, 11 Jul 2020 01:04:38 -0300 Subject: [PATCH 1/6] PostHog/posthog-php#3: Update composer.json to support PSR-4 --- composer.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index db06ad9..f1a9fbc 100644 --- a/composer.json +++ b/composer.json @@ -22,9 +22,9 @@ "squizlabs/php_codesniffer": "^3.5" }, "autoload": { - "files": [ - "lib/PostHog.php" - ] + "psr-4": { + "Posthog": "lib" + } }, "bin": [ "bin/posthog" From c3ad52c4faa04fd4827ac6c2972f7b325b8c205b Mon Sep 17 00:00:00 2001 From: Fabiano Sant'Ana Date: Sat, 11 Jul 2020 01:05:08 -0300 Subject: [PATCH 2/6] PostHog/posthog-php#3: Updates Posthog.php to use PSR-4 --- lib/PostHog.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/PostHog.php b/lib/PostHog.php index da22ab4..72dbf13 100644 --- a/lib/PostHog.php +++ b/lib/PostHog.php @@ -1,6 +1,6 @@ Date: Sat, 11 Jul 2020 01:05:17 -0300 Subject: [PATCH 3/6] PostHog/posthog-php#3: Updates Posthog Client to use PSR-4 --- lib/PostHog/Client.php | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/lib/PostHog/Client.php b/lib/PostHog/Client.php index f3413c1..9acdfb2 100644 --- a/lib/PostHog/Client.php +++ b/lib/PostHog/Client.php @@ -1,14 +1,13 @@ "PostHog_Consumer_Socket", + "socket" => "Socket", "file" => "PostHog_Consumer_File", "fork_curl" => "PostHog_Consumer_ForkCurl", "lib_curl" => "PostHog_Consumer_LibCurl" From 8039fa193445a0b37cc5279268f0440232ae0f73 Mon Sep 17 00:00:00 2001 From: Fabiano Sant'Ana Date: Sat, 11 Jul 2020 01:05:26 -0300 Subject: [PATCH 4/6] PostHog/posthog-php#3: Updates Posthog Consumer to use PSR-4 --- lib/PostHog/Consumer.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/PostHog/Consumer.php b/lib/PostHog/Consumer.php index c660954..3fdaf95 100644 --- a/lib/PostHog/Consumer.php +++ b/lib/PostHog/Consumer.php @@ -1,5 +1,8 @@ Date: Sat, 11 Jul 2020 01:06:07 -0300 Subject: [PATCH 5/6] PostHog/posthog-php#3: Updates Posthog Consumer's children to use PSR-4 --- lib/PostHog/Consumer/File.php | 6 +++++- lib/PostHog/Consumer/ForkCurl.php | 6 +++++- lib/PostHog/Consumer/LibCurl.php | 6 +++++- lib/PostHog/Consumer/Socket.php | 7 +++++-- lib/PostHog/QueueConsumer.php | 4 +++- 5 files changed, 23 insertions(+), 6 deletions(-) diff --git a/lib/PostHog/Consumer/File.php b/lib/PostHog/Consumer/File.php index d283b31..a57269c 100644 --- a/lib/PostHog/Consumer/File.php +++ b/lib/PostHog/Consumer/File.php @@ -1,6 +1,10 @@ Date: Sat, 11 Jul 2020 01:09:05 -0300 Subject: [PATCH 6/6] PostHog/posthog-php#3: Start updating tests --- test/ConsumerFileTest.php | 6 +++--- test/ConsumerForkCurlTest.php | 2 +- test/ConsumerLibCurlTest.php | 2 +- test/ConsumerSocketTest.php | 12 ++++++------ test/PostHogTest.php | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/test/ConsumerFileTest.php b/test/ConsumerFileTest.php index 71ec521..9c44f38 100644 --- a/test/ConsumerFileTest.php +++ b/test/ConsumerFileTest.php @@ -1,6 +1,6 @@ filename()); } - $this->client = new PostHog_Client( + $this->client = new Client( "BrpS4SctoaCCsyjlnlun3OzyNJAafdlv__jUWaaJWXg", array( "consumer" => "file", @@ -78,7 +78,7 @@ public function testSend() public function testProductionProblems() { // Open to a place where we should not have write access. - $client = new PostHog_Client( + $client = new Client( "BrpS4SctoaCCsyjlnlun3OzyNJAafdlv__jUWaaJWXg", array( "consumer" => "file", diff --git a/test/ConsumerForkCurlTest.php b/test/ConsumerForkCurlTest.php index 764c0d6..109295f 100644 --- a/test/ConsumerForkCurlTest.php +++ b/test/ConsumerForkCurlTest.php @@ -9,7 +9,7 @@ class ConsumerForkCurlTest extends PHPUnit\Framework\TestCase public function setUp(): void { date_default_timezone_set("UTC"); - $this->client = new PostHog_Client( + $this->client = new Client( "OnMMoZ6YVozrgSBeZ9FpkC0ixH0ycYZn", array( "consumer" => "fork_curl", diff --git a/test/ConsumerLibCurlTest.php b/test/ConsumerLibCurlTest.php index 8fd1a4b..7d6ec38 100644 --- a/test/ConsumerLibCurlTest.php +++ b/test/ConsumerLibCurlTest.php @@ -9,7 +9,7 @@ class ConsumerLibCurlTest extends PHPUnit\Framework\TestCase public function setUp(): void { date_default_timezone_set("UTC"); - $this->client = new PostHog_Client( + $this->client = new Client( "BrpS4SctoaCCsyjlnlun3OzyNJAafdlv__jUWaaJWXg", array( "consumer" => "lib_curl", diff --git a/test/ConsumerSocketTest.php b/test/ConsumerSocketTest.php index 56d9873..623b4db 100644 --- a/test/ConsumerSocketTest.php +++ b/test/ConsumerSocketTest.php @@ -13,7 +13,7 @@ public function setUp(): void public function testCapture() { - $client = new PostHog_Client( + $client = new Client( "BrpS4SctoaCCsyjlnlun3OzyNJAafdlv__jUWaaJWXg", array( "consumer" => "socket", @@ -28,7 +28,7 @@ public function testCapture() public function testIdentify() { - $client = new PostHog_Client( + $client = new Client( "BrpS4SctoaCCsyjlnlun3OzyNJAafdlv__jUWaaJWXg", array( "consumer" => "socket", @@ -46,7 +46,7 @@ public function testIdentify() public function testShortTimeout() { - $client = new PostHog_Client( + $client = new Client( "BrpS4SctoaCCsyjlnlun3OzyNJAafdlv__jUWaaJWXg", array( "timeout" => 0.01, @@ -69,7 +69,7 @@ public function testShortTimeout() public function testProductionProblems() { - $client = new PostHog_Client("x", + $client = new Client("x", array( "consumer" => "socket", "error_handler" => function () { @@ -92,7 +92,7 @@ public function testLargeMessage() "consumer" => "socket", ); - $client = new PostHog_Client("BrpS4SctoaCCsyjlnlun3OzyNJAafdlv__jUWaaJWXg", $options); + $client = new Client("BrpS4SctoaCCsyjlnlun3OzyNJAafdlv__jUWaaJWXg", $options); $big_property = ""; @@ -112,7 +112,7 @@ public function testLargeMessage() public function testConnectionError() { $this->expectException('RuntimeException'); - $client = new PostHog_Client("x", array( + $client = new Client("x", array( "consumer" => "socket", "host" => "t.posthog.comcomcom", "error_handler" => function ($errno, $errmsg) { diff --git a/test/PostHogTest.php b/test/PostHogTest.php index 5285f08..d687e10 100644 --- a/test/PostHogTest.php +++ b/test/PostHogTest.php @@ -1,6 +1,6 @@