File Mapper.php
has 460 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace LogicItLab\Salesforce\MapperBundle;
use DateTime;
Function mapToSalesforceObject
has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring. Open
public function mapToSalesforceObject($model)
{
$sObject = new stdClass;
$sObject->fieldsToNull = array();
- 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
Mapper
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
class Mapper
{
/**
* Salesforce client
*
Function getFields
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
public function getFields($modelClass, $includeRelatedLevels, $ignoreObject = null)
{
$fields = array();
foreach ($this->annotationReader->getSalesforceFields($modelClass) as $field) {
- 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 mapToSalesforceObject
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function mapToSalesforceObject($model)
{
$sObject = new stdClass;
$sObject->fieldsToNull = array();
Function save
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function save($model)
{
if (is_array($model)) {
$models = $model;
} elseif ($model instanceof Traversable) {
- 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 save
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function save($model)
{
if (is_array($model)) {
$models = $model;
} elseif ($model instanceof Traversable) {
Function getQueryWherePart
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private function getQueryWherePart(array $criteria, $model)
{
$whereParts = array();
$object = $this->annotationReader->getSalesforceObject($model);
$fields = $this->annotationReader->getSalesforceFields($model);
- 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 getQueryWherePart
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getQueryWherePart(array $criteria, $model)
{
$whereParts = array();
$object = $this->annotationReader->getSalesforceObject($model);
$fields = $this->annotationReader->getSalesforceFields($model);
Method mapToDomainObject
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function mapToDomainObject($sObject, $modelClass)
{
// Try to find mapped model in unit of work
if ($this->unitOfWork->find($modelClass, $sObject->Id)) {
return $this->unitOfWork->find($modelClass, $sObject->Id);
Method getQuotedWhereValue
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getQuotedWhereValue(
Annotation\Field $field,
$value,
Result\DescribeSObjectResult $description
) {
Function mapToDomainObject
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function mapToDomainObject($sObject, $modelClass)
{
// Try to find mapped model in unit of work
if ($this->unitOfWork->find($modelClass, $sObject->Id)) {
return $this->unitOfWork->find($modelClass, $sObject->Id);
- 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 getFields
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getFields($modelClass, $includeRelatedLevels, $ignoreObject = null)
{
$fields = array();
foreach ($this->annotationReader->getSalesforceFields($modelClass) as $field) {
Method findBy
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
$model,
array $criteria,
array $order = array(),
$related = 1,
$deleted = false,
Method findOneBy
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
$model,
array $criteria,
array $order = array(),
$related = 2,
$deleted = false
Function getOneToManySubqueries
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function getOneToManySubqueries($model, $includeRelatedLevels)
{
$relations = $this->annotationReader->getSalesforceRelations($model);
$object = $this->annotationReader->getSalesforceObject($model);
$subqueries = array();
- 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
Avoid too many return
statements within this method. Open
return "'" . addslashes($value) . "'";
Avoid too many return
statements within this method. Open
return $value;
Avoid too many return
statements within this method. Open
return $value ? 'true' : 'false';
Function getQuotedWhereValue
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function getQuotedWhereValue(
Annotation\Field $field,
$value,
Result\DescribeSObjectResult $description
) {
- 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"