File ElasticaEventSearch.php
has 318 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Gdbots\Pbjx\EventSearch\Elastica;
Method searchEvents
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
final public function searchEvents(Message $request, ParsedQuery $parsedQuery, Message $response, array $curies = [], array $context = []): void
{
$context = $this->enrichContext(__FUNCTION__, $context);
$skipValidation = filter_var($context['skip_validation'] ?? true, FILTER_VALIDATE_BOOLEAN);
$client = $this->getClientForRead($context);
Method indexEvents
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
final public function indexEvents(array $events, array $context = []): void
{
if (empty($events)) {
return;
}
Method deleteEvents
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
final public function deleteEvents(array $eventIds, array $context = []): void
{
if (empty($eventIds)) {
return;
}
Method createStorage
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
final public function createStorage(array $context = []): void
{
$context = $this->enrichContext(__FUNCTION__, $context);
if (isset($context['cluster'])) {
Method describeStorage
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
final public function describeStorage(array $context = []): string
{
$context = $this->enrichContext(__FUNCTION__, $context);
if (isset($context['cluster'])) {
Function describeStorage
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
final public function describeStorage(array $context = []): string
{
$context = $this->enrichContext(__FUNCTION__, $context);
if (isset($context['cluster'])) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function createStorage
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
final public function createStorage(array $context = []): void
{
$context = $this->enrichContext(__FUNCTION__, $context);
if (isset($context['cluster'])) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
ClientManager $clientManager,
EventDispatcher $dispatcher,
IndexManager $indexManager,
?LoggerInterface $logger = null,
?string $timeout = null
Method searchEvents
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
final public function searchEvents(Message $request, ParsedQuery $parsedQuery, Message $response, array $curies = [], array $context = []): void
Function indexEvents
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
final public function indexEvents(array $events, array $context = []): void
{
if (empty($events)) {
return;
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function deleteEvents
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
final public function deleteEvents(array $eventIds, array $context = []): void
{
if (empty($eventIds)) {
return;
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"