Showing 178 of 178 total issues
AggregateRoot
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
abstract class AggregateRoot extends Entity implements AggregateRootInterface
{
/**
* @var AggregateRootEventList $history
*/
Similar blocks of code found in 3 locations. Consider refactoring. Open
<?php
namespace Honeybee\Common\Error\AggregateRoot;
use Exception;
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 133.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 3 locations. Consider refactoring. Open
<?php
namespace Honeybee\Common\Error\AggregateRoot;
use Exception;
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 133.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 3 locations. Consider refactoring. Open
<?php
namespace Honeybee\Common\Error\AggregateRoot;
use Exception;
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 133.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Function translateFilters
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
protected function translateFilters(CriteriaList $filter_criteria_list)
{
$elasticsearch_filters = [];
foreach ($filter_criteria_list as $criteria) {
if ($criteria instanceof CriteriaContainerInterface) {
- 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 applyEvent
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
protected function applyEvent(AggregateRootEventInterface $event, $auto_commit = true)
{
$this->guardEventPreConditions($event);
if (!$this->setValues($event->getData())) {
$errors = [];
- 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
ProjectionUpdater
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
class ProjectionUpdater extends EventHandler
{
protected $data_access_service;
protected $projection_type_map;
Method createMirroredEntity
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createMirroredEntity(EntityInterface $source_entity, EntityInterface $reference_entity = null)
{
// compile non-list attribute values from the reference entity if available
if ($reference_entity) {
foreach ($this->getAttributes() as $attribute) {
Method connect
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function connect()
{
$base_uri = $this->config->get('base_uri');
if ($this->config->has('transport') && $this->config->has('host') && $this->config->has('port')) {
$base_uri = sprintf(
Method getStatus
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getStatus()
{
if ($this->config->has('fake_status')) {
return new Status($this, $this->config->get('fake_status'));
}
Method getStatus
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getStatus()
{
if ($this->config->has('fake_status')) {
return new Status($this, $this->config->get('fake_status'));
}
Function createMirroredEntity
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function createMirroredEntity(EntityInterface $source_entity, EntityInterface $reference_entity = null)
{
// compile non-list attribute values from the reference entity if available
if ($reference_entity) {
foreach ($this->getAttributes() as $attribute) {
- 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 buildSpatialFilterFor
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function buildSpatialFilterFor(CriteriaInterface $criteria)
{
$attribute_path = $criteria->getAttributePath();
$comparison = $criteria->getComparison();
$geometry = $comparison->getComparand();
Method applyEvent
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function applyEvent(AggregateRootEventInterface $event, $auto_commit = true)
{
$this->guardEventPreConditions($event);
if (!$this->setValues($event->getData())) {
$errors = [];
Function updateMappingsWithReindex
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
protected function updateMappingsWithReindex(MigrationTarget $migration_target)
{
$client = $this->getConnection($migration_target);
$index_api = $client->indices();
$index_name = $this->getIndexName($migration_target);
- 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 executeHandlers
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function executeHandlers($channel_name, EventInterface $event, $subscription_index)
{
if (!$this->channel_map->hasKey($channel_name)) {
throw new RuntimeError(
sprintf(
- 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 translateQueries
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
protected function translateQueries(CriteriaList $criteria_list)
{
if ($criteria_list->isEmpty()) {
return [ 'match_all' => [] ];
} else {
- 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 distribute
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function distribute($channel_name, EventInterface $event)
{
if (!$this->channel_map->hasKey($channel_name)) {
throw new RuntimeError(
sprintf(
Method connect
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function connect()
{
$base_uri = $this->config->get('base_uri');
if ($this->config->has('transport') && $this->config->has('host') && $this->config->has('port')) {
$base_uri = sprintf(
Method updateDesignDoc
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function updateDesignDoc(MigrationTarget $migration_target)
{
$views_directory = $this->getViewsDirectory();
if (!is_dir($views_directory)) {
throw new RuntimeError(sprintf('Given views directory "%s" does not exist.', $views_directory));