Showing 176 of 176 total issues
Function __construct
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
public function __construct($attributes = null)
{
$this->setPackagingType(
new PackagingType(
isset($attributes->PackagingType) ? $attributes->PackagingType : null
- 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
InternationalForms
has 33 functions (exceeds 20 allowed). Consider refactoring. Open
class InternationalForms implements NodeInterface
{
/**
* @var array
*/
ShipmentServiceOptions
has 32 functions (exceeds 20 allowed). Consider refactoring. Open
class ShipmentServiceOptions implements NodeInterface
{
/**
* @var
*/
Function toNode
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
public function toNode(DOMDocument $document = null)
{
if (null === $document) {
$document = new DOMDocument();
}
- 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 __construct
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
public function __construct($response = null)
{
$this->CallTagARS = new CallTagARS();
if (null !== $response) {
- 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
File HazMat.php
has 315 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Ups\Entity;
use DOMDocument;
Function __construct
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
public function __construct(\stdClass $response = null)
{
$this->TransitFrom = new Address();
$this->TransitTo = new Address();
$this->ShipmentWeight = new ShipmentWeight();
- 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
File InternationalForms.php
has 306 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Ups\Entity;
use DateTime;
Package
has 28 functions (exceeds 20 allowed). Consider refactoring. Open
class Package implements NodeInterface
{
const PKG_OVERSIZE1 = '1';
const PKG_OVERSIZE2 = '2';
const PKG_LARGE = '4';
Function toNode
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
public function toNode(DOMDocument $document = null)
{
if (null === $document) {
$document = new DOMDocument();
}
- 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 __construct
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
public function __construct(\stdClass $attributes = null)
{
$this->address = new Address();
if (null !== $attributes) {
- 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 toNode
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function toNode(DOMDocument $document = null)
{
if (null === $document) {
$document = new DOMDocument();
}
Similar blocks of code found in 2 locations. Consider refactoring. Open
public function toNode(DOMDocument $document = null)
{
if (null === $document) {
$document = new DOMDocument();
}
- 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 142.
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 toNode(DOMDocument $document = null)
{
if (null === $document) {
$document = new DOMDocument();
}
- 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 142.
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 __construct
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct($attributes = null)
{
if (null !== $attributes) {
if (isset($attributes->AddressLine1)) {
$this->setAddressLine1($attributes->AddressLine1);
Function __construct
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public function __construct($attributes = null)
{
$this->address = new Address();
if (null !== $attributes) {
- 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 createRequest
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
private function createRequest()
{
$xml = new DOMDocument();
$xml->formatOutput = true;
- 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 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct(\stdClass $response = null)
{
$this->AddressExtendedInformation = [];
if (null !== $response) {
Method request
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function request($access, $request, $endpointurl, $operation = null, $wsdl = null)
{
// Check for operation
if (is_null($operation)) {
throw new \Exception('Operation is required');
Method createRequest
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function createRequest(RateRequest $rateRequest)
{
$shipment = $rateRequest->getShipment();
$document = $xml = new DOMDocument();