Showing 38 of 38 total issues
Function pack
has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring. Open
public static function pack(Framework\ParticleInterface $particle): AbstractLoader
{
$obj = new OutgoingEdgeLoader($particle->getRegisteredOutgoingEdges());
foreach ($obj->cargo->classes as $class) {
$class = str_replace("ObjectOut", "ObjOut", $class); // for backwards-compatibility.
- 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 pack
has 94 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function pack(Framework\ParticleInterface $particle): AbstractLoader
{
$obj = new OutgoingEdgeLoader($particle->getRegisteredOutgoingEdges());
foreach ($obj->cargo->classes as $class) {
$class = str_replace("ObjectOut", "ObjOut", $class); // for backwards-compatibility.
Function probe
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public function probe(): void
{
if(!isset($this->settings["constraints"]))
return;
$constraints = $this->settings["constraints"];
- 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 probe
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function probe(): void
{
if(!isset($this->settings["constraints"]))
return;
$constraints = $this->settings["constraints"];
Function header
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
protected static function header(EntityInterface $entity): array
{
error_log("calculating headers: ");
error_log(get_class($entity));
$first_hex = 11;
- 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 pack
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public static function pack(ParticleInterface $particle): AbstractLoader
{
$obj = new IncomingEdgeLoader($particle->getRegisteredIncomingEdges());
foreach($obj->cargo->classes as $class) {
$class = str_replace("ObjectOut", "ObjOut", $class); // for backwards-compatibility.
- 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 handle
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function handle(
ParticleInterface $particle,
array $pack,
string $name,
array $args // no use -yet-
Function in
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function in(ContextInterface $context): bool
{
/*
// would speed up, but not good for testing.
if($context instanceof Space)
- 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 pack
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function pack(ParticleInterface $particle): AbstractLoader
{
$obj = new IncomingEdgeLoader($particle->getRegisteredIncomingEdges());
foreach($obj->cargo->classes as $class) {
$class = str_replace("ObjectOut", "ObjOut", $class); // for backwards-compatibility.
Method fill
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function fill(array $args): AbstractEdge
{
if( count($this->fields)<=0 ) {
return $this;
}
Similar blocks of code found in 2 locations. Consider refactoring. Open
<?php
/*
* This file is part of the Pho package.
*
- 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 104.
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 2 locations. Consider refactoring. Open
<?php
/*
* This file is part of the Pho package.
*
- 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 104.
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
Method switch
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function switch(string $name, array $args) /*: \Pho\Lib\Graph\EntityInterface*/
{
$method = function(string $key) {
return $this->adapters[$key] . "::handle";
};
Method header
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected static function header(EntityInterface $entity): array
{
error_log("calculating headers: ");
error_log(get_class($entity));
$first_hex = 11;
Function handle
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public static function handle(
ParticleInterface $particle,
array $pack,
string $name,
array $args // no use -yet-
- 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 setup
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function setup(string $type = "all"): AbstractEdge
{
$fields = function(): AbstractEdge
{
$this->fields = Loaders\FieldsLoader::fetchArray($this);
Similar blocks of code found in 2 locations. Consider refactoring. Open
if($class_ref->hasConstant("HEAD_CALLABLE_LABELS")) {
$callable = $class_ref->getConstant("HEAD_CALLABLE_LABELS");
$obj->cargo->callable_edge_labels[] = \Stringy\StaticStringy::camelize($callable);
$obj->cargo->callable_edge_label_class_pairs[$callable] = $class;
- 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 97.
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 2 locations. Consider refactoring. Open
if($check) {
$method = $class_ref->getConstant("TAIL_LABELS");
$obj->cargo->labels[] = \Stringy\StaticStringy::camelize($method);
$obj->cargo->label_class_pairs[$method] = $class;
- 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 97.
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 switch
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function switch(string $name, array $args) /*: \Pho\Lib\Graph\EntityInterface*/
{
$method = function(string $key) {
return $this->adapters[$key] . "::handle";
};
- 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 getEdgeItself
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
ParticleInterface $particle,
array $pack,
string $name,
Direction $direction,
bool $singular = false