Compare commits
No commits in common. "a552a6675e70201af71a5cc08f147ce14a77b81c" and "4484f1c997ac5497d693b43a7a0b8787428d7d4b" have entirely different histories.
a552a6675e
...
4484f1c997
@ -2,7 +2,6 @@
|
|||||||
"name": "mcnd/negundo-client",
|
"name": "mcnd/negundo-client",
|
||||||
"description": "Negundo client which allow sending dump(), error and tasks reports",
|
"description": "Negundo client which allow sending dump(), error and tasks reports",
|
||||||
"keywords": ["negundo","dev","debug","psr15","middleware"],
|
"keywords": ["negundo","dev","debug","psr15","middleware"],
|
||||||
"type": "library",
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
@ -14,19 +13,5 @@
|
|||||||
"psr-4": {
|
"psr-4": {
|
||||||
"Negundo\\Client\\": "src/"
|
"Negundo\\Client\\": "src/"
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"require": {
|
|
||||||
"php": "^8.2",
|
|
||||||
"ext-curl": "*",
|
|
||||||
"ext-json": "*"
|
|
||||||
},
|
|
||||||
"extra" : {
|
|
||||||
"lean" : {
|
|
||||||
"autoload": {
|
|
||||||
"definitions" : [
|
|
||||||
"meta/negundo.php"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,12 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
use function DI\autowire, DI\create, DI\get;
|
|
||||||
|
|
||||||
use Negundo\Client\{ SoftwareConfig, Dump, Task, NegundoMiddleware };
|
|
||||||
|
|
||||||
return [
|
|
||||||
SoftwareConfig::class => create(SoftwareConfig::class)->constructor(getenv('NEGUNDO_HASH'), getenv('NEGUNDO_SERVER')),
|
|
||||||
NegundoMiddleware::class => autowire(NegundoMiddleware::class),
|
|
||||||
Dump::class => autowire(Dump::class),
|
|
||||||
Task::class => autowire(Task::class),
|
|
||||||
];
|
|
12
src/Dump.php
12
src/Dump.php
@ -2,17 +2,17 @@
|
|||||||
|
|
||||||
namespace Negundo\Client {
|
namespace Negundo\Client {
|
||||||
class Dump {
|
class Dump {
|
||||||
public static array $instances = [];
|
public static /* array */ $instances = [];
|
||||||
|
|
||||||
# public string $serverUrl = "http://dev.cslsj.qc.ca/debug/dump/report/%s";
|
# public /*string*/ $serverUrl = "http://dev.cslsj.qc.ca/debug/dump/report/%s";
|
||||||
|
|
||||||
protected SoftwareConfig $config;
|
protected /* SoftwareConfig */ $config;
|
||||||
|
|
||||||
protected array $sent = [];
|
protected /*array*/ $sent = [];
|
||||||
|
|
||||||
protected Transport\TransportInterface $transport;
|
protected /* TransportInterface */ $transport;
|
||||||
|
|
||||||
protected Util\DumpHandler $dumpHandler;
|
protected /* Util\DumpHandler */ $dumpHandler;
|
||||||
|
|
||||||
public function __construct(SoftwareConfig $config, ? DataInterface $dataManipulator = null, Transport\TransportInterface $transport = null)
|
public function __construct(SoftwareConfig $config, ? DataInterface $dataManipulator = null, Transport\TransportInterface $transport = null)
|
||||||
{
|
{
|
||||||
|
@ -5,21 +5,21 @@ namespace Negundo\Client;
|
|||||||
use Closure;
|
use Closure;
|
||||||
|
|
||||||
abstract class Handler {
|
abstract class Handler {
|
||||||
protected SoftwareConfig $config;
|
protected /* SoftwareConfig */ $config;
|
||||||
|
|
||||||
public bool $registerErrorHandler = true;
|
public /* bool */ $registerErrorHandler = true;
|
||||||
|
|
||||||
public bool $registerExceptionHandler = true;
|
public /* bool */ $registerExceptionHandler = true;
|
||||||
|
|
||||||
public bool $registerFatalErrorHandler = true;
|
public /* bool */ $registerFatalErrorHandler = true;
|
||||||
|
|
||||||
protected Closure $callback;
|
protected /*Closure*/ $callback;
|
||||||
|
|
||||||
protected Transport\TransportInterface $transport;
|
protected /*array*/ $sent = [];
|
||||||
|
|
||||||
protected Util\ExceptionHandler $exceptionHandler;
|
protected /* TransportInterface */ $transport;
|
||||||
|
|
||||||
protected array $sent = [];
|
protected /* Util\ExceptionHandler */ $exceptionHandler;
|
||||||
|
|
||||||
public abstract function handleException(\Throwable $ex) : array;
|
public abstract function handleException(\Throwable $ex) : array;
|
||||||
|
|
||||||
@ -33,7 +33,7 @@ abstract class Handler {
|
|||||||
$this->registerHandlers();
|
$this->registerHandlers();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function registerHandlers() : void
|
public function registerHandlers()
|
||||||
{
|
{
|
||||||
$this->registerExceptionHandler && set_exception_handler(function(\Throwable $ex) {
|
$this->registerExceptionHandler && set_exception_handler(function(\Throwable $ex) {
|
||||||
$this->pushData($ex);
|
$this->pushData($ex);
|
||||||
|
@ -12,7 +12,7 @@ class NegundoMiddleware extends Handler implements MiddlewareInterface {
|
|||||||
|
|
||||||
protected ServerRequestInterface $request;
|
protected ServerRequestInterface $request;
|
||||||
|
|
||||||
public bool $registerExceptionHandler = false;
|
public $registerExceptionHandler = false;
|
||||||
|
|
||||||
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler) : ResponseInterface
|
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler) : ResponseInterface
|
||||||
{
|
{
|
||||||
|
@ -4,9 +4,9 @@ namespace Negundo\Client;
|
|||||||
|
|
||||||
class SoftwareConfig
|
class SoftwareConfig
|
||||||
{
|
{
|
||||||
public string $serverUrl;
|
public /*string*/ $serverUrl;
|
||||||
|
|
||||||
public string $softwareHash;
|
public /* string */ $softwareHash;
|
||||||
|
|
||||||
public function __construct(string $softwareHash, string $serverUrl)
|
public function __construct(string $softwareHash, string $serverUrl)
|
||||||
{
|
{
|
||||||
|
10
src/Task.php
10
src/Task.php
@ -4,15 +4,15 @@ namespace Negundo\Client {
|
|||||||
|
|
||||||
class Task {
|
class Task {
|
||||||
|
|
||||||
public static array $instances = [];
|
public static /* array */ $instances = [];
|
||||||
|
|
||||||
protected array $sent = [];
|
protected /*array*/ $sent = [];
|
||||||
|
|
||||||
protected Transport\TransportInterface $transport;
|
protected /* TransportInterface */ $transport;
|
||||||
|
|
||||||
protected Util\TaskHandler $taskHandler;
|
protected /* Util\TaskHandler */ $taskHandler;
|
||||||
|
|
||||||
protected SoftwareConfig $config;
|
protected /* SoftwareConfig */ $config;
|
||||||
|
|
||||||
public function __construct(SoftwareConfig $config, ? DataInterface $dataManipulator = null, Transport\TransportInterface $transport = null)
|
public function __construct(SoftwareConfig $config, ? DataInterface $dataManipulator = null, Transport\TransportInterface $transport = null)
|
||||||
{
|
{
|
||||||
|
@ -161,7 +161,7 @@ class Curl implements TransportInterface {
|
|||||||
35 => "A problem occurred somewhere in the SSL/TLS handshake. You really want the error buffer and read the message there as it pinpoints the problem slightly more. Could be certificates (file formats, paths, permissions), passwords, and others.",
|
35 => "A problem occurred somewhere in the SSL/TLS handshake. You really want the error buffer and read the message there as it pinpoints the problem slightly more. Could be certificates (file formats, paths, permissions), passwords, and others.",
|
||||||
36 => "The download could not be resumed because the specified offset was out of the file boundary.",
|
36 => "The download could not be resumed because the specified offset was out of the file boundary.",
|
||||||
37 => "A file given with FILE:// couldn't be opened. Most likely because the file path doesn't identify an existing file. Did you check file permissions? ",
|
37 => "A file given with FILE:// couldn't be opened. Most likely because the file path doesn't identify an existing file. Did you check file permissions? ",
|
||||||
38 => "LDAP cannot bind. LDAP bind operation failed.",
|
35 => "LDAP cannot bind. LDAP bind operation failed.",
|
||||||
39 => "LDAP search failed.",
|
39 => "LDAP search failed.",
|
||||||
41 => "Function not found. A required zlib function was not found.",
|
41 => "Function not found. A required zlib function was not found.",
|
||||||
42 => "Aborted by callback. A callback returned \"abort\" to libcurl.",
|
42 => "Aborted by callback. A callback returned \"abort\" to libcurl.",
|
||||||
|
@ -6,7 +6,7 @@ use Negundo\Client\DataInterface;
|
|||||||
|
|
||||||
class DumpHandler {
|
class DumpHandler {
|
||||||
|
|
||||||
public DataInterface $dataManipulator;
|
public /*DataInterface*/ $dataManipulator;
|
||||||
|
|
||||||
public function __construct(DataInterface $dataManipulator = null)
|
public function __construct(DataInterface $dataManipulator = null)
|
||||||
{
|
{
|
||||||
|
@ -6,7 +6,7 @@ use Negundo\Client\DataInterface;
|
|||||||
|
|
||||||
class ExceptionHandler {
|
class ExceptionHandler {
|
||||||
|
|
||||||
public ? DataInterface $dataManipulator;
|
public /*DataInterface*/ $dataManipulator;
|
||||||
|
|
||||||
public function __construct(DataInterface $dataManipulator = null)
|
public function __construct(DataInterface $dataManipulator = null)
|
||||||
{
|
{
|
||||||
|
@ -6,7 +6,7 @@ use Negundo\Client\DataInterface;
|
|||||||
|
|
||||||
class TaskHandler {
|
class TaskHandler {
|
||||||
|
|
||||||
public DataInterface $dataManipulator;
|
public /*DataInterface*/ $dataManipulator;
|
||||||
|
|
||||||
public function __construct(DataInterface $dataManipulator = null)
|
public function __construct(DataInterface $dataManipulator = null)
|
||||||
{
|
{
|
||||||
@ -20,8 +20,8 @@ class TaskHandler {
|
|||||||
array_shift($backtrace);
|
array_shift($backtrace);
|
||||||
|
|
||||||
$trace = $backtrace[0] ?? [
|
$trace = $backtrace[0] ?? [
|
||||||
"file" => "unknown",
|
|
||||||
"line" => -1,
|
"line" => -1,
|
||||||
|
"file" => "unknown",
|
||||||
];
|
];
|
||||||
|
|
||||||
$post = [
|
$post = [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user