Skip to content

Commit

Permalink
close #83
Browse files Browse the repository at this point in the history
  • Loading branch information
rodber committed Feb 21, 2024
1 parent c256045 commit 9881656
Show file tree
Hide file tree
Showing 39 changed files with 107 additions and 113 deletions.
6 changes: 3 additions & 3 deletions .vscode/test.code-snippets
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"body": [
"<?php",
"",
"namespace Chevere\\Xr\\Tests\\\\${TM_DIRECTORY/.*tests\\/(([^\\/]*)(\\/)?)|(\\/)([^\\/]*)/$2${3:+\\\\}${5:+\\\\}$5/g};",
"namespace Chevere\\xrDebug\\PHP\\Tests\\\\${TM_DIRECTORY/.*tests\\/(([^\\/]*)(\\/)?)|(\\/)([^\\/]*)/$2${3:+\\\\}${5:+\\\\}$5/g};",
"",
"use PHPUnit\\Framework\\TestCase;",
"",
Expand All @@ -31,12 +31,12 @@
"body": [
"<?php",
"",
"namespace Chevere\\Xr\\Tests\\\\${TM_DIRECTORY/.*tests\\/(([^\\/]*)(\\/)?)|(\\/)([^\\/]*)/$2${3:+\\\\}${5:+\\\\}$5/g};",
"namespace Chevere\\xrDebug\\PHP\\Tests\\\\${TM_DIRECTORY/.*tests\\/(([^\\/]*)(\\/)?)|(\\/)([^\\/]*)/$2${3:+\\\\}${5:+\\\\}$5/g};",
"",
"final class $TM_FILENAME_BASE",
"{",
"\t$0",
"}"
]
},
}
}
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ Use `registerThrowableHandler` to enable xrDebug throwable handling.

```php

use Chevere\Xr\registerThrowableHandler;
use Chevere\xrDebug\PHP\registerThrowableHandler;

// True append xrDebug to your existing handler
// False use only xrDebug handler
Expand All @@ -187,7 +187,7 @@ registerThrowableHandler(true);
Use `throwableHandler` in any existing exception handler logic:

```php
use Chevere\Xr\throwableHandler;
use Chevere\xrDebug\PHP\throwableHandler;

set_exception_handler(
function(Throwable $throwable) {
Expand All @@ -210,8 +210,8 @@ For code below, `myDump` defines a method that will stream data from your applic
```php
<?php

use Chevere\Xr\Inspector\Traits\XrInspectorTrait;
use Chevere\Xr\Interfaces\XrInspectorInterface;
use Chevere\xrDebug\PHP\Inspector\Traits\XrInspectorTrait;
use Chevere\xrDebug\PHP\Interfaces\XrInspectorInterface;

class MyInspector implements XrInspectorInterface
{
Expand Down Expand Up @@ -264,8 +264,8 @@ A null inspector is required to void any inspection call **if xrDebug is disable
```php
<?php

use Chevere\Xr\Inspector\Traits\XrInspectorNullTrait;
use Chevere\Xr\Interfaces\XrInspectorInterface;
use Chevere\xrDebug\PHP\Inspector\Traits\XrInspectorNullTrait;
use Chevere\xrDebug\PHP\Interfaces\XrInspectorInterface;

class MyInspectorNull implements XrInspectorInterface
{
Expand All @@ -288,8 +288,8 @@ class MyInspectorNull implements XrInspectorInterface
### Helper function for custom inspector

```php
use Chevere\Xr\Inspector\XrInspectorInstance;
use Chevere\Xr\Interfaces\XrInspectorInterface;
use Chevere\xrDebug\PHP\Inspector\XrInspectorInstance;
use Chevere\xrDebug\PHP\Interfaces\XrInspectorInterface;
use LogicException;
use MyInspector;
use MyInspectorNull;
Expand Down Expand Up @@ -324,7 +324,7 @@ Documentation available at [docs.xrdebug.com](https://docs.xrdebug.com/).

## License

Copyright 2023 [Rodolfo Berrios A.](https://rodolfoberrios.com/)
Copyright [Rodolfo Berrios A.](https://rodolfoberrios.com/)

xrDebug is licensed under the Apache License, Version 2.0. See [LICENSE](LICENSE) for the full license text.

Expand Down
4 changes: 1 addition & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,10 @@
"ext-curl": "*",
"ext-json": "*",
"chevere/filesystem": "^1.0.x-dev",
"chevere/http": "^0.4.x-dev",
"chevere/message": "^1.0.0",
"chevere/throwable-handler": "^0.12.x-dev",
"chevere/trace": "^1.0.0",
"chevere/var-dump": "^1.0.0",
"chevere/writer": "^1.0.1",
"phpseclib/phpseclib": "~3.0",
"ramsey/uuid": "^4.7"
},
Expand All @@ -41,7 +39,7 @@
"src/functions.php"
],
"psr-4": {
"Chevere\\Xr\\": "src/"
"Chevere\\xrDebug\\PHP\\": "src/"
}
},
"autoload-dev": {
Expand Down
2 changes: 1 addition & 1 deletion demo/demo-throwable.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
use Chevere\Writer\WritersInstance;
use RuntimeException;
use function Chevere\Writer\streamFor;
use function Chevere\Xr\registerThrowableHandler;
use function Chevere\xrDebug\PHP\registerThrowableHandler;

foreach (['/../', '/../../../../'] as $path) {
$autoload = __DIR__ . $path . 'vendor/autoload.php';
Expand Down
6 changes: 3 additions & 3 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@

declare(strict_types=1);

namespace Chevere\Xr;
namespace Chevere\xrDebug\PHP;

use Chevere\Xr\Interfaces\ClientInterface;
use Chevere\Xr\Traits\ClientTrait;
use Chevere\xrDebug\PHP\Interfaces\ClientInterface;
use Chevere\xrDebug\PHP\Traits\ClientTrait;

final class Client implements ClientInterface
{
Expand Down
6 changes: 3 additions & 3 deletions src/Curl.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@

declare(strict_types=1);

namespace Chevere\Xr;
namespace Chevere\xrDebug\PHP;

use Chevere\Xr\Interfaces\CurlInterface;
use Chevere\Xr\Traits\CurlTrait;
use Chevere\xrDebug\PHP\Interfaces\CurlInterface;
use Chevere\xrDebug\PHP\Traits\CurlTrait;

final class Curl implements CurlInterface
{
Expand Down
2 changes: 1 addition & 1 deletion src/Exceptions/StopException.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

declare(strict_types=1);

namespace Chevere\Xr\Exceptions;
namespace Chevere\xrDebug\PHP\Exceptions;

use Exception;

Expand Down
6 changes: 3 additions & 3 deletions src/Inspector/Inspector.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@

declare(strict_types=1);

namespace Chevere\Xr\Inspector;
namespace Chevere\xrDebug\PHP\Inspector;

use Chevere\Xr\Inspector\Traits\InspectorTrait;
use Chevere\Xr\Interfaces\InspectorInterface;
use Chevere\xrDebug\PHP\Inspector\Traits\InspectorTrait;
use Chevere\xrDebug\PHP\Interfaces\InspectorInterface;

final class Inspector implements InspectorInterface
{
Expand Down
4 changes: 2 additions & 2 deletions src/Inspector/InspectorInstance.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@

declare(strict_types=1);

namespace Chevere\Xr\Inspector;
namespace Chevere\xrDebug\PHP\Inspector;

use Chevere\Xr\Interfaces\InspectorInterface;
use Chevere\xrDebug\PHP\Interfaces\InspectorInterface;
use LogicException;
use function Chevere\Message\message;

Expand Down
6 changes: 3 additions & 3 deletions src/Inspector/InspectorNull.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@

declare(strict_types=1);

namespace Chevere\Xr\Inspector;
namespace Chevere\xrDebug\PHP\Inspector;

use Chevere\Xr\Inspector\Traits\InspectorNullTrait;
use Chevere\Xr\Interfaces\InspectorInterface;
use Chevere\xrDebug\PHP\Inspector\Traits\InspectorNullTrait;
use Chevere\xrDebug\PHP\Interfaces\InspectorInterface;

final class InspectorNull implements InspectorInterface
{
Expand Down
2 changes: 1 addition & 1 deletion src/Inspector/Traits/InspectorNullTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

declare(strict_types=1);

namespace Chevere\Xr\Inspector\Traits;
namespace Chevere\xrDebug\PHP\Inspector\Traits;

/**
* @infection-ignore-all
Expand Down
6 changes: 3 additions & 3 deletions src/Inspector/Traits/InspectorTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@

declare(strict_types=1);

namespace Chevere\Xr\Inspector\Traits;
namespace Chevere\xrDebug\PHP\Inspector\Traits;

use Chevere\Xr\Interfaces\ClientInterface;
use Chevere\Xr\Message;
use Chevere\xrDebug\PHP\Interfaces\ClientInterface;
use Chevere\xrDebug\PHP\Message;
use Throwable;

trait InspectorTrait
Expand Down
2 changes: 1 addition & 1 deletion src/Interfaces/ClientInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

declare(strict_types=1);

namespace Chevere\Xr\Interfaces;
namespace Chevere\xrDebug\PHP\Interfaces;

/**
* Describes the component in charge of defining the client.
Expand Down
2 changes: 1 addition & 1 deletion src/Interfaces/CurlInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

declare(strict_types=1);

namespace Chevere\Xr\Interfaces;
namespace Chevere\xrDebug\PHP\Interfaces;

use CurlHandle;

Expand Down
2 changes: 1 addition & 1 deletion src/Interfaces/InspectorInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

declare(strict_types=1);

namespace Chevere\Xr\Interfaces;
namespace Chevere\xrDebug\PHP\Interfaces;

/**
* Describes the component in charge of defining the XR inspector default interface.
Expand Down
2 changes: 1 addition & 1 deletion src/Interfaces/MessageInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

declare(strict_types=1);

namespace Chevere\Xr\Interfaces;
namespace Chevere\xrDebug\PHP\Interfaces;

use Chevere\Writer\Interfaces\WriterInterface;

Expand Down
2 changes: 1 addition & 1 deletion src/Interfaces/XrInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

declare(strict_types=1);

namespace Chevere\Xr\Interfaces;
namespace Chevere\xrDebug\PHP\Interfaces;

use Chevere\Filesystem\Interfaces\DirectoryInterface;

Expand Down
6 changes: 3 additions & 3 deletions src/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@

declare(strict_types=1);

namespace Chevere\Xr;
namespace Chevere\xrDebug\PHP;

use Chevere\ThrowableHandler\Formats\HtmlFormat as ThrowableHandlerHtmlFormat;
use Chevere\Trace\Trace;
use Chevere\VarDump\Formats\HtmlFormat as VarDumpHtmlFormat;
use Chevere\VarDump\VarDump;
use Chevere\Writer\Interfaces\WriterInterface;
use Chevere\Writer\NullWriter;
use Chevere\Xr\Interfaces\MessageInterface;
use Chevere\Xr\VarDump\Output\XrVarDumpHtmlOutput;
use Chevere\xrDebug\PHP\Interfaces\MessageInterface;
use Chevere\xrDebug\PHP\VarDump\Output\XrVarDumpHtmlOutput;
use Ramsey\Uuid\Provider\Node\RandomNodeProvider;
use Ramsey\Uuid\Uuid;

Expand Down
2 changes: 1 addition & 1 deletion src/ThrowableParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

declare(strict_types=1);

namespace Chevere\Xr;
namespace Chevere\xrDebug\PHP;

use Chevere\ThrowableHandler\Formats\HtmlFormat;
use Chevere\ThrowableHandler\Interfaces\FormatInterface;
Expand Down
27 changes: 12 additions & 15 deletions src/Traits/ClientTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,15 @@

declare(strict_types=1);

namespace Chevere\Xr\Traits;

use Chevere\Http\Interfaces\MethodInterface;
use Chevere\Http\Methods\GetMethod;
use Chevere\Http\Methods\PostMethod;
use Chevere\Xr\Curl;
use Chevere\Xr\Exceptions\StopException;
use Chevere\Xr\Interfaces\CurlInterface;
use Chevere\Xr\Interfaces\MessageInterface;
namespace Chevere\xrDebug\PHP\Traits;

use Chevere\xrDebug\PHP\Curl;
use Chevere\xrDebug\PHP\Exceptions\StopException;
use Chevere\xrDebug\PHP\Interfaces\CurlInterface;
use Chevere\xrDebug\PHP\Interfaces\MessageInterface;
use phpseclib3\Crypt\EC\PrivateKey;
use function Chevere\Message\message;
use function Chevere\Xr\sign;
use function Chevere\xrDebug\PHP\sign;

trait ClientTrait
{
Expand Down Expand Up @@ -69,7 +66,7 @@ public function sendMessage(MessageInterface $message): void
{
try {
$curl = $this->getCurlHandle(
new PostMethod(),
'POST',
'messages',
$message->toArray()
);
Expand All @@ -83,7 +80,7 @@ public function sendPause(MessageInterface $message): void
{
try {
$curl = $this->getCurlHandle(
new PostMethod(),
'POST',
'pauses',
$message->toArray(),
);
Expand All @@ -103,7 +100,7 @@ public function isPaused(string $id): bool
{
try {
$curl = $this->getCurlHandle(
new GetMethod(),
'GET',
'pauses/' . $id,
[]
);
Expand Down Expand Up @@ -144,14 +141,14 @@ public function exit(int $exitCode = 0): void
/**
* @param array<string, string> $data
*/
private function getCurlHandle(MethodInterface $method, string $url, array $data): CurlInterface
private function getCurlHandle(string $method, string $url, array $data): CurlInterface
{
$this->options = [
CURLINFO_HEADER_OUT => true,
CURLOPT_ENCODING => '',
CURLOPT_FAILONERROR => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => $method::name(),
CURLOPT_CUSTOMREQUEST => $method,
CURLOPT_POSTFIELDS => http_build_query($data),
CURLOPT_RETURNTRANSFER => true,
CURLOPT_SSL_VERIFYPEER => true,
Expand Down
2 changes: 1 addition & 1 deletion src/Traits/CurlTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

declare(strict_types=1);

namespace Chevere\Xr\Traits;
namespace Chevere\xrDebug\PHP\Traits;

use CurlHandle;
use LogicException;
Expand Down
2 changes: 1 addition & 1 deletion src/VarDump/Output/XrVarDumpHtmlOutput.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

declare(strict_types=1);

namespace Chevere\Xr\VarDump\Output;
namespace Chevere\xrDebug\PHP\VarDump\Output;

use Chevere\VarDump\Interfaces\FormatInterface as VarDumpFormatInterface;
use Chevere\VarDump\Outputs\Output;
Expand Down
2 changes: 1 addition & 1 deletion src/WriterInstance.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

declare(strict_types=1);

namespace Chevere\Xr;
namespace Chevere\xrDebug\PHP;

use Chevere\Writer\Interfaces\WriterInterface;
use LogicException;
Expand Down
Loading

0 comments on commit 9881656

Please sign in to comment.