Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php namespace EasyWeChat\Tests\Kernel\HttpClient; use EasyWeChat\Kernel\HttpClient\Requ..

Decoded Output download

<?php
 namespace EasyWeChat\Tests\Kernel\HttpClient; use EasyWeChat\Kernel\HttpClient\RequestWithPresets; use PHPUnit\Framework\TestCase; class RequestWithPresetsTest extends TestCase { public function test_it_can_with_key_value() { $client = new DummyClassForRequestWithPresetsTest(); $client->with("foo", "bar")->with("bar")->with(array("appid" => "wx123456", "secret"))->with(array("age" => 12, "name" => "overtrue"))->with("items", array("foo", "bar")); $this->assertSame(array("foo" => "bar", "bar" => null, "appid" => "wx123456", "secret" => null, "age" => 12, "name" => "overtrue", "items" => array("foo", "bar")), $client->getPrependsParts()); $client->with("foo", "baz"); $this->assertSame(array("foo" => "baz", "bar" => null, "appid" => "wx123456", "secret" => null, "age" => 12, "name" => "overtrue", "items" => array("foo", "bar")), $client->getPrependsParts()); } public function test_it_can_with_key_of_presets() { $client = new DummyClassForRequestWithPresetsTest(); $client->setPresets(array("appid" => "wx123456", "secret" => "helloworld", "bar" => "baz")); $client->with("foo", "bar")->with("bar")->with(array("appid", "secret")); $this->assertSame(array("foo" => "bar", "bar" => "baz", "appid" => "wx123456", "secret" => "helloworld"), $client->getPrependsParts()); } public function test_it_can_with_use_magic_call() { $client = new DummyClassForRequestWithPresetsTest(); $client->setPresets(array("appid" => "wx123456", "secret" => "helloworld", "bar" => "balabala", "name" => "w7corp")); $client->with("foo", "bar")->with("bar")->withAppid()->withSecret()->withBarAs("baz")->withName("overtrue"); $this->assertSame(array("foo" => "bar", "bar" => "balabala", "appid" => "wx123456", "secret" => "helloworld", "baz" => "balabala", "name" => "overtrue"), $client->getPrependsParts()); } public function test_it_can_merge_to_options() { $client = new DummyClassForRequestWithPresetsTest(); $client->setPresets(array("appid" => "wx123456", "secret" => "helloworld", "bar" => "balabala", "name" => "w7corp")); $this->assertSame(array(), $client->mergeThenResetPrepends(array())); $client->withAppid()->withSecret(); $this->assertSame(array("query" => array("appid" => "wx123456", "secret" => "helloworld")), $client->mergeThenResetPrepends(array())); $client->withAppid()->withSecret(); $this->assertSame(array("query" => array("appid" => "wx123456", "secret" => "helloworld")), $client->mergeThenResetPrepends(array(), "HEAD")); $client->withAppid()->withSecret(); $this->assertSame(array("query" => array("appid" => "wx123456", "secret" => "helloworld")), $client->mergeThenResetPrepends(array(), "DELETE")); $client->withAppid()->withSecret(); $this->assertSame(array("body" => array("appid" => "wx123456", "secret" => "helloworld")), $client->mergeThenResetPrepends(array(), "POST")); $client->withAppid()->withSecret(); $this->assertSame(array("body" => array("appid" => "wx123456", "secret" => "helloworld")), $client->mergeThenResetPrepends(array(), "PUT")); $client->withAppid()->withSecret(); $this->assertSame(array("body" => array("appid" => "wx123456", "secret" => "helloworld")), $client->mergeThenResetPrepends(array(), "PATCH")); $client->withAppid(); $this->assertSame(array("query" => array("appid" => "wx123456", "name" => "1234")), $client->mergeThenResetPrepends(array("query" => array("name" => "1234")))); $client->withAppid(); $this->assertSame(array("body" => array("appid" => "wx123456", "name" => "1234")), $client->mergeThenResetPrepends(array("body" => array("name" => "1234")), "POST")); $client->withAppid(); $this->assertSame(array("xml" => array("appid" => "wx123456", "name" => "1234")), $client->mergeThenResetPrepends(array("xml" => array("name" => "1234")), "POST")); $client->withAppid(); $this->assertSame(array("headers" => array("content-type" => "text/xml"), "xml" => array("appid" => "wx123456")), $client->mergeThenResetPrepends(array("headers" => array("content-type" => "text/xml")), "POST")); $client->withAppid(); $this->assertSame(array("json" => array("appid" => "wx123456", "name" => "1234")), $client->mergeThenResetPrepends(array("json" => array("name" => "1234")), "POST")); $client->withAppid(); $this->assertSame(array("headers" => array("content-type" => "application/json"), "json" => array("appid" => "wx123456")), $client->mergeThenResetPrepends(array("headers" => array("content-type" => "application/json")), "POST")); $client->withAppid()->withHeader("X-foo", "bar"); $this->assertSame(array("headers" => array("X-foo" => "bar", "content-type" => "application/json"), "json" => array("appid" => "wx123456")), $client->mergeThenResetPrepends(array("headers" => array("content-type" => "application/json")), "POST")); $client->setPresets(array("app_id" => "wx123456", "secret" => "helloworld", "bar" => "balabala", "name" => "w7corp")); $client->withAppId()->withSecret(); $this->assertSame(array("query" => array("app_id" => "wx123456", "secret" => "helloworld")), $client->mergeThenResetPrepends(array())); $client->withAppId()->withSecret(); $this->assertSame(array("query" => array("app_id" => "wx123456", "secret" => "helloworld")), $client->mergeThenResetPrepends(array(), "HEAD")); $client->withAppId()->withSecret(); $this->assertSame(array("query" => array("app_id" => "wx123456", "secret" => "helloworld")), $client->mergeThenResetPrepends(array(), "DELETE")); $client->withAppId()->withSecret(); $this->assertSame(array("body" => array("app_id" => "wx123456", "secret" => "helloworld")), $client->mergeThenResetPrepends(array(), "POST")); $client->withAppId()->withSecret(); $this->assertSame(array("body" => array("app_id" => "wx123456", "secret" => "helloworld")), $client->mergeThenResetPrepends(array(), "PUT")); $client->withAppId()->withSecret(); $this->assertSame(array("body" => array("app_id" => "wx123456", "secret" => "helloworld")), $client->mergeThenResetPrepends(array(), "PATCH")); $client->withAppIdAs("test")->withSecret(); $this->assertSame(array("query" => array("test" => "wx123456", "secret" => "helloworld")), $client->mergeThenResetPrepends(array())); $client->withAppId("test")->withSecret(); $this->assertSame(array("query" => array("app_id" => "test", "secret" => "helloworld")), $client->mergeThenResetPrepends(array())); } public function test_it_can_with_headers() { $client = new DummyClassForRequestWithPresetsTest(); $client->withHeaders(array("content-type" => "application/xml"))->withHeader("accept", "application/json"); $this->assertSame(array("content-type" => "application/xml", "accept" => "application/json"), $client->getPrependsHeaders()); $client->withHeaders(array("content-type" => "text/xml")); $this->assertSame(array("content-type" => "text/xml", "accept" => "application/json"), $client->getPrependsHeaders()); } } class DummyClassForRequestWithPresetsTest { use RequestWithPresets; public function getPrependsParts() : array { return $this->prependParts; } public function getPrependsHeaders() : array { return $this->prependHeaders; } public function __call(string $name, array $arguments) { if (\str_starts_with($name, "with")) { return $this->handleMagicWithCall($name, $arguments[0] ?? null); } throw new \BadMethodCallException("Call to undefined method " . __CLASS__ . "::" . $name . "()"); } } ?>

Did this file decode correctly?

Original Code

<?php
 namespace EasyWeChat\Tests\Kernel\HttpClient; use EasyWeChat\Kernel\HttpClient\RequestWithPresets; use PHPUnit\Framework\TestCase; class RequestWithPresetsTest extends TestCase { public function test_it_can_with_key_value() { $client = new DummyClassForRequestWithPresetsTest(); $client->with("\146\x6f\x6f", "\x62\x61\x72")->with("\142\141\x72")->with(array("\141\160\160\151\144" => "\x77\x78\61\62\x33\64\x35\66", "\x73\x65\143\x72\x65\164"))->with(array("\141\x67\145" => 12, "\156\141\155\x65" => "\157\x76\145\x72\x74\162\x75\x65"))->with("\x69\x74\145\x6d\x73", array("\x66\x6f\157", "\x62\x61\x72")); $this->assertSame(array("\x66\x6f\157" => "\142\x61\x72", "\142\x61\162" => null, "\x61\160\160\151\144" => "\x77\170\61\x32\x33\64\x35\x36", "\x73\x65\143\x72\x65\164" => null, "\141\x67\145" => 12, "\156\x61\x6d\145" => "\157\166\145\x72\x74\162\x75\145", "\x69\164\145\x6d\163" => array("\x66\157\157", "\x62\x61\162")), $client->getPrependsParts()); $client->with("\146\x6f\x6f", "\142\141\172"); $this->assertSame(array("\146\157\x6f" => "\142\141\172", "\142\141\162" => null, "\x61\160\160\151\144" => "\167\x78\x31\x32\x33\64\65\x36", "\163\145\143\x72\145\164" => null, "\x61\147\145" => 12, "\x6e\141\155\145" => "\157\x76\145\162\164\162\x75\x65", "\151\x74\x65\x6d\x73" => array("\146\x6f\x6f", "\x62\141\x72")), $client->getPrependsParts()); } public function test_it_can_with_key_of_presets() { $client = new DummyClassForRequestWithPresetsTest(); $client->setPresets(array("\x61\x70\x70\x69\x64" => "\x77\170\x31\62\63\x34\x35\66", "\x73\x65\x63\x72\x65\164" => "\x68\x65\x6c\x6c\157\167\x6f\162\x6c\144", "\142\141\162" => "\142\x61\172")); $client->with("\146\157\157", "\142\x61\162")->with("\x62\x61\162")->with(array("\141\160\x70\x69\144", "\163\x65\143\162\x65\x74")); $this->assertSame(array("\146\157\157" => "\x62\x61\162", "\142\141\162" => "\142\141\172", "\x61\x70\160\x69\x64" => "\167\170\x31\62\x33\64\x35\x36", "\163\x65\x63\x72\x65\164" => "\x68\145\x6c\x6c\157\167\157\x72\x6c\144"), $client->getPrependsParts()); } public function test_it_can_with_use_magic_call() { $client = new DummyClassForRequestWithPresetsTest(); $client->setPresets(array("\141\160\160\151\144" => "\x77\170\61\62\x33\x34\65\x36", "\x73\x65\x63\162\145\164" => "\150\145\x6c\x6c\x6f\167\157\x72\154\144", "\142\x61\x72" => "\x62\141\154\141\x62\x61\154\x61", "\156\141\x6d\145" => "\167\x37\x63\x6f\162\x70")); $client->with("\x66\x6f\157", "\142\x61\x72")->with("\x62\x61\162")->withAppid()->withSecret()->withBarAs("\142\141\x7a")->withName("\157\166\x65\x72\x74\x72\165\x65"); $this->assertSame(array("\146\x6f\x6f" => "\x62\141\x72", "\x62\x61\162" => "\x62\x61\154\141\x62\x61\x6c\x61", "\141\x70\x70\x69\144" => "\167\170\x31\x32\63\x34\65\x36", "\163\145\143\x72\145\x74" => "\x68\x65\154\x6c\x6f\167\x6f\162\x6c\x64", "\x62\141\x7a" => "\x62\141\154\x61\x62\141\154\141", "\156\x61\155\x65" => "\x6f\x76\145\162\164\x72\165\x65"), $client->getPrependsParts()); } public function test_it_can_merge_to_options() { $client = new DummyClassForRequestWithPresetsTest(); $client->setPresets(array("\141\x70\x70\x69\144" => "\x77\170\61\62\63\x34\65\66", "\x73\x65\143\x72\x65\164" => "\150\145\154\154\x6f\x77\x6f\x72\154\144", "\x62\x61\x72" => "\x62\x61\x6c\x61\x62\141\x6c\141", "\156\x61\x6d\x65" => "\x77\67\x63\x6f\162\x70")); $this->assertSame(array(), $client->mergeThenResetPrepends(array())); $client->withAppid()->withSecret(); $this->assertSame(array("\161\165\x65\162\171" => array("\141\x70\160\x69\x64" => "\167\x78\61\x32\63\x34\x35\x36", "\x73\145\143\x72\x65\x74" => "\x68\145\154\x6c\x6f\x77\x6f\162\154\x64")), $client->mergeThenResetPrepends(array())); $client->withAppid()->withSecret(); $this->assertSame(array("\x71\165\x65\x72\x79" => array("\x61\x70\160\x69\x64" => "\167\170\x31\62\63\x34\65\x36", "\x73\x65\143\x72\145\x74" => "\150\145\x6c\154\x6f\167\157\x72\154\x64")), $client->mergeThenResetPrepends(array(), "\x48\x45\101\104")); $client->withAppid()->withSecret(); $this->assertSame(array("\161\165\x65\162\x79" => array("\x61\x70\160\151\144" => "\167\170\x31\x32\63\x34\x35\x36", "\163\x65\x63\162\x65\x74" => "\150\145\x6c\x6c\157\167\x6f\x72\x6c\x64")), $client->mergeThenResetPrepends(array(), "\104\x45\114\x45\124\105")); $client->withAppid()->withSecret(); $this->assertSame(array("\142\157\x64\x79" => array("\x61\x70\x70\x69\144" => "\x77\170\61\x32\x33\x34\65\66", "\x73\x65\x63\162\145\x74" => "\x68\145\x6c\154\157\x77\157\x72\x6c\x64")), $client->mergeThenResetPrepends(array(), "\120\x4f\x53\124")); $client->withAppid()->withSecret(); $this->assertSame(array("\142\157\x64\171" => array("\141\160\160\151\144" => "\167\x78\x31\x32\63\x34\65\66", "\x73\x65\x63\x72\145\164" => "\x68\145\x6c\x6c\x6f\167\x6f\162\x6c\144")), $client->mergeThenResetPrepends(array(), "\120\x55\124")); $client->withAppid()->withSecret(); $this->assertSame(array("\x62\x6f\x64\171" => array("\x61\160\160\x69\144" => "\167\x78\61\x32\63\x34\x35\x36", "\163\145\143\162\145\x74" => "\150\145\x6c\154\157\x77\157\x72\x6c\x64")), $client->mergeThenResetPrepends(array(), "\x50\101\124\x43\x48")); $client->withAppid(); $this->assertSame(array("\x71\165\145\x72\x79" => array("\141\160\160\x69\x64" => "\x77\170\x31\62\x33\x34\65\x36", "\x6e\x61\155\145" => "\61\x32\x33\x34")), $client->mergeThenResetPrepends(array("\161\165\x65\162\x79" => array("\156\x61\x6d\145" => "\61\62\x33\64")))); $client->withAppid(); $this->assertSame(array("\142\x6f\144\x79" => array("\x61\160\160\x69\144" => "\167\170\x31\x32\63\64\x35\x36", "\x6e\141\x6d\145" => "\61\62\x33\x34")), $client->mergeThenResetPrepends(array("\142\157\x64\171" => array("\156\141\155\145" => "\61\x32\63\x34")), "\x50\x4f\x53\124")); $client->withAppid(); $this->assertSame(array("\170\155\154" => array("\x61\x70\160\151\x64" => "\167\170\x31\x32\x33\64\65\x36", "\156\141\155\145" => "\x31\62\x33\64")), $client->mergeThenResetPrepends(array("\170\155\154" => array("\156\x61\155\x65" => "\61\x32\63\x34")), "\x50\117\x53\124")); $client->withAppid(); $this->assertSame(array("\x68\145\x61\144\x65\x72\x73" => array("\x63\157\156\x74\x65\156\164\x2d\x74\171\x70\x65" => "\x74\x65\x78\x74\57\x78\155\x6c"), "\x78\x6d\x6c" => array("\x61\x70\160\151\x64" => "\167\170\61\62\x33\x34\x35\66")), $client->mergeThenResetPrepends(array("\150\x65\x61\x64\145\x72\x73" => array("\x63\x6f\x6e\164\x65\156\164\55\164\171\160\x65" => "\x74\145\170\164\x2f\170\x6d\154")), "\x50\117\x53\124")); $client->withAppid(); $this->assertSame(array("\x6a\x73\x6f\156" => array("\141\x70\x70\151\144" => "\167\170\x31\x32\x33\64\65\66", "\x6e\x61\155\145" => "\x31\x32\63\64")), $client->mergeThenResetPrepends(array("\x6a\163\157\x6e" => array("\156\141\x6d\x65" => "\61\x32\63\x34")), "\120\x4f\x53\124")); $client->withAppid(); $this->assertSame(array("\x68\x65\141\144\145\x72\163" => array("\143\x6f\156\x74\145\x6e\164\55\164\171\x70\x65" => "\x61\160\160\x6c\x69\143\x61\x74\x69\157\x6e\x2f\x6a\x73\157\156"), "\152\x73\157\156" => array("\x61\x70\160\x69\x64" => "\167\170\x31\x32\63\64\x35\66")), $client->mergeThenResetPrepends(array("\150\x65\x61\144\x65\162\163" => array("\x63\157\x6e\164\x65\x6e\x74\x2d\164\x79\x70\x65" => "\141\x70\160\154\151\143\x61\164\151\x6f\156\x2f\x6a\x73\x6f\156")), "\120\x4f\123\x54")); $client->withAppid()->withHeader("\x58\55\146\157\157", "\x62\x61\162"); $this->assertSame(array("\150\x65\141\144\x65\162\x73" => array("\130\55\146\x6f\x6f" => "\x62\x61\x72", "\x63\x6f\156\164\x65\x6e\x74\x2d\x74\x79\x70\x65" => "\141\x70\160\x6c\151\143\141\164\151\157\x6e\x2f\152\x73\157\x6e"), "\x6a\163\157\x6e" => array("\x61\x70\160\x69\x64" => "\x77\170\x31\62\63\64\65\x36")), $client->mergeThenResetPrepends(array("\150\x65\141\x64\145\162\x73" => array("\x63\157\156\164\x65\x6e\x74\55\164\x79\x70\145" => "\141\160\x70\154\151\143\141\164\151\x6f\156\x2f\152\163\157\x6e")), "\x50\117\x53\124")); $client->setPresets(array("\x61\x70\160\x5f\x69\144" => "\x77\x78\61\x32\63\x34\65\x36", "\x73\x65\143\162\145\x74" => "\150\x65\x6c\154\157\x77\x6f\x72\154\144", "\x62\141\162" => "\x62\141\x6c\141\142\141\x6c\x61", "\x6e\141\x6d\x65" => "\167\67\x63\x6f\162\x70")); $client->withAppId()->withSecret(); $this->assertSame(array("\x71\165\145\162\171" => array("\141\160\160\x5f\151\144" => "\x77\x78\61\62\x33\x34\x35\x36", "\163\x65\143\162\x65\x74" => "\x68\x65\154\x6c\157\167\x6f\x72\154\144")), $client->mergeThenResetPrepends(array())); $client->withAppId()->withSecret(); $this->assertSame(array("\x71\165\145\x72\x79" => array("\x61\x70\160\137\x69\144" => "\167\170\61\x32\x33\x34\x35\x36", "\163\x65\143\162\145\164" => "\x68\145\154\x6c\x6f\167\157\162\x6c\x64")), $client->mergeThenResetPrepends(array(), "\110\x45\x41\104")); $client->withAppId()->withSecret(); $this->assertSame(array("\161\165\145\162\x79" => array("\141\x70\x70\137\151\144" => "\167\170\x31\62\63\x34\65\x36", "\163\x65\143\x72\145\164" => "\x68\145\x6c\x6c\x6f\x77\x6f\162\154\144")), $client->mergeThenResetPrepends(array(), "\x44\x45\x4c\x45\x54\105")); $client->withAppId()->withSecret(); $this->assertSame(array("\142\x6f\x64\x79" => array("\141\160\160\x5f\151\144" => "\167\x78\61\62\x33\64\65\x36", "\163\145\143\162\145\x74" => "\x68\145\154\x6c\x6f\167\157\162\x6c\x64")), $client->mergeThenResetPrepends(array(), "\120\117\x53\124")); $client->withAppId()->withSecret(); $this->assertSame(array("\142\157\144\171" => array("\141\x70\160\137\x69\144" => "\167\x78\x31\62\63\64\65\66", "\x73\145\143\162\145\164" => "\x68\145\154\154\157\x77\157\162\x6c\x64")), $client->mergeThenResetPrepends(array(), "\x50\x55\x54")); $client->withAppId()->withSecret(); $this->assertSame(array("\x62\x6f\x64\x79" => array("\141\x70\x70\x5f\151\144" => "\x77\170\x31\x32\63\x34\65\66", "\163\x65\x63\x72\145\x74" => "\x68\x65\154\154\157\167\x6f\162\x6c\x64")), $client->mergeThenResetPrepends(array(), "\120\101\x54\x43\x48")); $client->withAppIdAs("\164\145\x73\x74")->withSecret(); $this->assertSame(array("\161\165\145\x72\x79" => array("\164\x65\x73\x74" => "\167\x78\61\62\63\64\x35\66", "\163\145\x63\162\x65\164" => "\150\x65\154\x6c\157\x77\x6f\162\154\x64")), $client->mergeThenResetPrepends(array())); $client->withAppId("\164\x65\163\164")->withSecret(); $this->assertSame(array("\161\x75\x65\x72\171" => array("\141\160\x70\137\x69\x64" => "\x74\145\163\164", "\x73\x65\x63\x72\145\164" => "\x68\145\154\154\x6f\167\157\162\154\144")), $client->mergeThenResetPrepends(array())); } public function test_it_can_with_headers() { $client = new DummyClassForRequestWithPresetsTest(); $client->withHeaders(array("\143\157\156\164\x65\156\164\x2d\x74\x79\160\145" => "\141\x70\x70\x6c\151\x63\141\x74\x69\157\x6e\x2f\170\x6d\x6c"))->withHeader("\x61\143\143\x65\160\x74", "\141\x70\x70\x6c\151\143\141\164\151\157\x6e\57\x6a\163\157\156"); $this->assertSame(array("\x63\157\x6e\x74\145\156\x74\x2d\x74\171\160\x65" => "\141\x70\x70\154\x69\x63\141\164\x69\157\x6e\x2f\x78\155\x6c", "\x61\143\x63\145\x70\x74" => "\141\x70\160\x6c\x69\x63\141\x74\x69\157\x6e\57\152\163\x6f\x6e"), $client->getPrependsHeaders()); $client->withHeaders(array("\143\x6f\156\x74\x65\x6e\x74\x2d\x74\x79\160\145" => "\164\145\170\x74\57\x78\x6d\154")); $this->assertSame(array("\x63\x6f\156\x74\145\x6e\x74\55\164\x79\160\145" => "\x74\145\170\164\x2f\x78\x6d\x6c", "\x61\x63\143\x65\160\164" => "\141\160\160\154\x69\143\x61\164\151\157\x6e\57\x6a\163\x6f\x6e"), $client->getPrependsHeaders()); } } class DummyClassForRequestWithPresetsTest { use RequestWithPresets; public function getPrependsParts() : array { return $this->prependParts; } public function getPrependsHeaders() : array { return $this->prependHeaders; } public function __call(string $name, array $arguments) { if (\str_starts_with($name, "\x77\x69\164\x68")) { return $this->handleMagicWithCall($name, $arguments[0] ?? null); } throw new \BadMethodCallException("\103\141\154\154\40\x74\x6f\x20\x75\156\144\145\x66\x69\x6e\145\144\x20\155\x65\164\150\x6f\x64\40" . __CLASS__ . "\72\72" . $name . "\x28\51"); } }

Function Calls

None

Variables

None

Stats

MD5 bfa53254f43e7aa80d1cabc27d126680
Eval Count 0
Decode Time 143 ms