-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update skautis/skautis to 3.0.0-alpha.4 (#33)
- Loading branch information
1 parent
6f6788a
commit 248cf53
Showing
12 changed files
with
139 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Skautis\Nette\Tracy; | ||
|
||
use Psr\EventDispatcher\EventDispatcherInterface; | ||
use Skaut\Skautis\Wsdl\Event\RequestFailEvent; | ||
use Skaut\Skautis\Wsdl\Event\RequestPostEvent; | ||
use Skaut\Skautis\Wsdl\Event\RequestPreEvent; | ||
use stdClass; | ||
|
||
|
||
/** | ||
* Trida pro logovani dotazu. | ||
*/ | ||
class EventDispatcher implements EventDispatcherInterface | ||
{ | ||
/** @var SkautisQuery[] */ | ||
private $queries = []; | ||
|
||
/** | ||
* @param RequestPreEvent|RequestPostEvent|RequestFailEvent $event | ||
*/ | ||
public function dispatch($event): object | ||
{ | ||
switch (true) { | ||
case $event instanceof RequestPreEvent: | ||
// no-op | ||
break; | ||
case $event instanceof RequestPostEvent: | ||
$this->queries[] = SkautisQuery::createFromPostEvent($event); | ||
break; | ||
case $event instanceof RequestFailEvent: | ||
$this->queries[] = SkautisQuery::createFromFailEvent($event); | ||
break; | ||
} | ||
|
||
return $event; | ||
} | ||
|
||
/** @return SkautisQuery[] */ | ||
public function getQueries(): array | ||
{ | ||
return $this->queries; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Skautis\Nette\Tracy; | ||
|
||
use Skaut\Skautis\Wsdl\Event\RequestFailEvent; | ||
use Skaut\Skautis\Wsdl\Event\RequestPostEvent; | ||
|
||
|
||
/** | ||
* Objekt s informacemi o dotazu. | ||
*/ | ||
class SkautisQuery | ||
{ | ||
/** | ||
* Nazev funkce volane pomoci SOAP requestu. | ||
* @var string | ||
*/ | ||
public $fname; | ||
|
||
/** | ||
* Parametry SOAP requestu na server. | ||
* @var array<int|string, mixed> | ||
*/ | ||
public $args; | ||
|
||
/** | ||
* Zasobnik volanych funkci. | ||
* @var array<int, array<string, mixed>> | ||
*/ | ||
public $trace; | ||
|
||
/** | ||
* Doba trvani pozadvku. | ||
* @var float | ||
*/ | ||
public $time; | ||
|
||
/** | ||
* SOAP response. | ||
* @var mixed | ||
*/ | ||
public $result; | ||
|
||
/** | ||
* @param array<int|string, mixed> $args | ||
* @param array<int, array<string, mixed>> $trace | ||
* @param mixed $result | ||
*/ | ||
private function __construct(string $fname, array $args, array $trace, float $time, $result) | ||
{ | ||
$this->fname = $fname; | ||
$this->args = $args; | ||
$this->trace = $trace; | ||
$this->time = $time; | ||
$this->result = $result; | ||
} | ||
|
||
public static function createFromPostEvent(RequestPostEvent $event): SkautisQuery { | ||
return new SkautisQuery($event->getFname(), $event->getArgs(), $event->getTrace(), $event->getDuration(), $event->getResult()); | ||
} | ||
|
||
public static function createFromFailEvent(RequestFailEvent $event): SkautisQuery { | ||
return new SkautisQuery($event->getFname(), $event->getArgs(), $event->getTrace(), $event->getDuration(), null); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters