Showing 143 of 143 total issues
Method getArgumentList
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
static public function getArgumentList(array $argv) {
$argumentList = [];
/** @noinspection ForeachInvariantsInspection */
for ($i = 0, $j = count($argv); $i < $j; $i++) {
$arg = $argv[$i];
- Create a ticketCreate a ticket
Similar blocks of code found in 2 locations. Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Edde\Common\Schema;
- Read upRead up
- Create a ticketCreate a ticket
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 114.
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
declare(strict_types=1);
namespace Edde\Common\Schema;
- Read upRead up
- Create a ticketCreate a ticket
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 114.
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
public function collection(string $name, IProperty $source, IProperty $target, bool $force = false): ISchema {
if (isset($this->collectionList[$name]) && $force === false) {
throw new SchemaException(sprintf('Schema [%s] already has collection named [%s].', $this->getSchemaName(), $name));
}
$this->collectionList[$name] = new Collection($name, $source, $target);
- Read upRead up
- Create a ticketCreate a ticket
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 113.
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
public function link(string $name, IProperty $source, IProperty $target, bool $force = false): ISchema {
if (isset($this->linkList[$name]) && $force === false) {
throw new SchemaException(sprintf('Schema [%s] already contains link named [%s].', $this->getSchemaName(), $name));
}
$this->linkList[$name] = new Link($name, $source, $target);
- Read upRead up
- Create a ticketCreate a ticket
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 113.
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 createSchema
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function createSchema(INode $node): ISchema {
$schema = new Schema($node->getName(), $node->getAttribute('namespace'));
$schema->setMetaList($node->getMetaList()->array());
$magic = $schema->getMeta('magic', true);
foreach ($this->propertyListNodeQuery->filter($node) as $propertyNode) {
- Read upRead up
- Create a ticketCreate a ticket
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 match
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
protected function match(string $control, string $action) {
$simpleRegexp = '[a-z0-9-]+';
$parameterList = null;
if (($match = StringUtils::match($action, '~^handle=(?<handleHandle>[a-z0-9-]+)$~')) !== null) {
$parameterList['handle'] = $control . '.' . $match['handleHandle'];
- Read upRead up
- Create a ticketCreate a ticket
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 createFactoryList
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
static public function createFactoryList(array $factoryList): array {
$factories = [];
foreach ($factoryList as $name => $factory) {
$current = null;
if ($factory instanceof \stdClass) {
- Create a ticketCreate a ticket
Method node
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function node(INode $node, \Iterator $iterator, ...$parameters) {
$level = $node->getLevel();
$stack = new \SplStack();
/**
* @var $levelTreeTraversal ITreeTraversal
- Create a ticketCreate a ticket
Method store
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function store(ICrate $crate): IStorage {
$this->driver->setup();
$schema = $crate->getSchema();
if ($schema->getMeta('storable', false) === false) {
throw new StorageException(sprintf('Crate [%s] is not marked as storable (in meta data).', $schema->getSchemaName()));
- Create a ticketCreate a ticket
Method upgradeTo
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function upgradeTo(string $version = null): IUpgrade {
if ($version === null) {
end($this->upgradeList);
$version = key($this->upgradeList);
}
- Create a ticketCreate a ticket
Method onEnter
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function onEnter(INode $node, \Iterator $iterator, ...$parameters) {
switch ($node->getName()) {
case 'minify-css':
if ($this->minify) {
throw new MacroException(sprintf('Css minify does not support recursion.'));
- Create a ticketCreate a ticket
Similar blocks of code found in 2 locations. Consider refactoring. Open
protected function formatFrom(INode $node) {
$parameterList = [];
$fromList = [];
foreach ($this->fromNodeQuery->filter($node) as $fromNode) {
$staticQuery = $this->fragment($fromNode);
- Read upRead up
- Create a ticketCreate a ticket
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 109.
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
protected function formatSelect(INode $node) {
$parameterList = [];
$selectList = [];
foreach ($this->selectNodeQuery->filter($node) as $selectNode) {
$staticQuery = $this->fragment($selectNode);
- Read upRead up
- Create a ticketCreate a ticket
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 109.
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 dependency
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function dependency($instance, IDependency $dependency, bool $lazy = true) {
if (is_object($instance) === false) {
return $instance;
}
$class = get_class($instance);
- Read upRead up
- Create a ticketCreate a ticket
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 upgradeTo
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function upgradeTo(string $version = null): IUpgrade {
if ($version === null) {
end($this->upgradeList);
$version = key($this->upgradeList);
}
- Read upRead up
- Create a ticketCreate a ticket
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 query
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function query(Iterator $iterator) {
if ($this->filter === null) {
$this->filter = $this->parse($this->query);
}
/** @var $node INode */
- Read upRead up
- Create a ticketCreate a ticket
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 toNode
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
static public function toNode(\stdClass $stdClass, INode $node = null, string $class = null): INode {
$createNode = function (string $class, string $name = null): INode {
/** @var $node INode */
if (($node = new $class()) instanceof INode === false) {
throw new ClassMismatchException(sprintf('Class specified [%s] is not instance of [%s].', $class, INode::class));
- Create a ticketCreate a ticket
Method onEnter
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function onEnter(INode $node, \Iterator $iterator, ...$parameters) {
switch ($node->getName()) {
case 'minify-js':
if ($this->minify) {
throw new MacroException(sprintf('Js minify does not support recursion.'));
- Create a ticketCreate a ticket
Method node
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function node(\Iterator $iterator) {
$stack = new \SplStack();
$level = -1;
/** @var $node INode */
foreach ($iterator as $node) {
- Create a ticketCreate a ticket