Function getAddressInformation
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function getAddressInformation($locationData, $locationItem)
{
$country = isset($locationData['country']) ? $locationData['country'] : $locationItem->getCountry();
$address = isset($locationData['address']) ? $locationData['address'] : $locationItem->getAddress();
$city = isset($locationData['city']) ? $locationData['city'] : $locationItem->getCity();
- 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
Consider simplifying this complex logical expression. Open
if((isset($locationData['address']) || isset($locationData['country'])
|| isset($locationData['city']) || isset($locationData['region_id']))
&& (!isset($locationData['lat']) || !isset($locationData['long'])
|| $locationData['lat'] == '' || $locationData['long'] == '')
) {
- Create a ticketCreate a ticket
Method getAddressInformation
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getAddressInformation($locationData, $locationItem)
{
$country = isset($locationData['country']) ? $locationData['country'] : $locationItem->getCountry();
$address = isset($locationData['address']) ? $locationData['address'] : $locationItem->getAddress();
$city = isset($locationData['city']) ? $locationData['city'] : $locationItem->getCity();
- Create a ticketCreate a ticket
Method update
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function update($data)
{
try {
$data = (array) $data;
$locationItem = Mage::getModel('demac_multilocationinventory/location')->load($data['location_id']);
- Create a ticketCreate a ticket
Function update
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function update($data)
{
try {
$data = (array) $data;
$locationItem = Mage::getModel('demac_multilocationinventory/location')->load($data['location_id']);
- 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 items
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function items($filters)
{
$collection = Mage::getResourceModel('demac_multilocationinventory/location_collection')->load();
if(is_array($filters)) {
try {
- 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"