Compare commits

..

No commits in common. "a552a6675e70201af71a5cc08f147ce14a77b81c" and "4484f1c997ac5497d693b43a7a0b8787428d7d4b" have entirely different histories.

11 changed files with 29 additions and 56 deletions

View File

@ -2,7 +2,6 @@
"name": "mcnd/negundo-client",
"description": "Negundo client which allow sending dump(), error and tasks reports",
"keywords": ["negundo","dev","debug","psr15","middleware"],
"type": "library",
"license": "MIT",
"authors": [
{
@ -14,19 +13,5 @@
"psr-4": {
"Negundo\\Client\\": "src/"
}
},
"require": {
"php": "^8.2",
"ext-curl": "*",
"ext-json": "*"
},
"extra" : {
"lean" : {
"autoload": {
"definitions" : [
"meta/negundo.php"
]
}
}
}
}

View File

@ -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),
];

View File

@ -2,17 +2,17 @@
namespace Negundo\Client {
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)
{

View File

@ -5,21 +5,21 @@ namespace Negundo\Client;
use Closure;
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 /* TransportInterface */ $transport;
protected Util\ExceptionHandler $exceptionHandler;
protected array $sent = [];
protected /* Util\ExceptionHandler */ $exceptionHandler;
public abstract function handleException(\Throwable $ex) : array;
@ -33,7 +33,7 @@ abstract class Handler {
$this->registerHandlers();
}
public function registerHandlers() : void
public function registerHandlers()
{
$this->registerExceptionHandler && set_exception_handler(function(\Throwable $ex) {
$this->pushData($ex);

View File

@ -12,7 +12,7 @@ class NegundoMiddleware extends Handler implements MiddlewareInterface {
protected ServerRequestInterface $request;
public bool $registerExceptionHandler = false;
public $registerExceptionHandler = false;
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler) : ResponseInterface
{

View File

@ -4,9 +4,9 @@ namespace Negundo\Client;
class SoftwareConfig
{
public string $serverUrl;
public /*string*/ $serverUrl;
public string $softwareHash;
public /* string */ $softwareHash;
public function __construct(string $softwareHash, string $serverUrl)
{

View File

@ -4,15 +4,15 @@ namespace Negundo\Client {
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)
{

View File

@ -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.",
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? ",
38 => "LDAP cannot bind. LDAP bind operation failed.",
35 => "LDAP cannot bind. LDAP bind operation failed.",
39 => "LDAP search failed.",
41 => "Function not found. A required zlib function was not found.",
42 => "Aborted by callback. A callback returned \"abort\" to libcurl.",

View File

@ -6,7 +6,7 @@ use Negundo\Client\DataInterface;
class DumpHandler {
public DataInterface $dataManipulator;
public /*DataInterface*/ $dataManipulator;
public function __construct(DataInterface $dataManipulator = null)
{

View File

@ -6,7 +6,7 @@ use Negundo\Client\DataInterface;
class ExceptionHandler {
public ? DataInterface $dataManipulator;
public /*DataInterface*/ $dataManipulator;
public function __construct(DataInterface $dataManipulator = null)
{

View File

@ -6,7 +6,7 @@ use Negundo\Client\DataInterface;
class TaskHandler {
public DataInterface $dataManipulator;
public /*DataInterface*/ $dataManipulator;
public function __construct(DataInterface $dataManipulator = null)
{
@ -20,8 +20,8 @@ class TaskHandler {
array_shift($backtrace);
$trace = $backtrace[0] ?? [
"file" => "unknown",
"line" => -1,
"file" => "unknown",
];
$post = [