Showing 49 of 49 total issues
Method importMultiLocationInventory
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function importMultiLocationInventory(Varien_Event_Observer $observer)
{
/** @var Mage_ImportExport_Model_Import_Entity_Product $adapter */
$adapter = $observer->getData('adapter');
if(!$adapter) {
- Create a ticketCreate a ticket
Method _locationStockIterate
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _locationStockIterate($args)
{
$quoteItemId = $args['quote_item_id'];
$productId = $args['product_id'];
$requestedQty = $this->checkoutProducts[$quoteItemId];
- Create a ticketCreate a ticket
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 _getSearchableProducts
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function _getSearchableProducts($storeId, array $staticFields, $productIds = null, $lastProductId = 0,
$limit = 100)
{
$websiteId = Mage::app()->getStore($storeId)->getWebsiteId();
$writeAdapter = $this->_getWriteAdapter();
- Create a ticketCreate a ticket
Function checkoutAllSubmitAfter
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function checkoutAllSubmitAfter($observer)
{
if(Mage::getStoreConfig('cataloginventory/options/can_subtract')) {
$order = $observer->getEvent()->getOrder();
- 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 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 create
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function create($data)
{
try {
$data = (array) $data;
- Create a ticketCreate a ticket
Method cancelOrderItem
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function cancelOrderItem($observer)
{
$item = $observer->getEvent()->getItem();
$children = $item->getChildrenItems();
- Create a ticketCreate a ticket
Function saveAction
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function saveAction()
{
if($postData = $this->getRequest()->getPost()) {
$locationModel = Mage::getSingleton('demac_multilocationinventory/location');
if($id = $this->getRequest()->getParam('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 refundOrderInventory
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function refundOrderInventory($observer)
{
/* @var $creditmemo Mage_Sales_Model_Order_Creditmemo */
$creditmemo = $observer->getEvent()->getCreditmemo();
$items = array();
- 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 walk
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function walk($query, array $callbacks, array $args = array(), $adapter = null)
{
$stmt = $this->_getStatement($query, $adapter);
$args['idx'] = 0;
while ($row = $stmt->fetch()) {
- 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 _loopCancelItem
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _loopCancelItem($args)
{
$productId = $args['product_id'];
$row = $args['row'];
- Create a ticketCreate a ticket
Method getPrioritizedLocationsForOrderQuoteItem
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getPrioritizedLocationsForOrderQuoteItem($orderId, $quoteItemId)
{
//get storeview id from order id.
$storeId = Mage::getModel('sales/order')->load($orderId)->getStoreId();
- 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 multiLocationInventoryProductSave
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function multiLocationInventoryProductSave($observer)
{
$productId = $observer->getEvent()->getProduct()->getId();
$this->inputData = Mage::app()->getRequest()->getPost('multilocationinventory');
if($productId) {
- 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 checkQty
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function checkQty($qty)
{
if (!$this->getManageStock() || Mage::app()->getStore()->isAdmin()) {
return true;
}
- 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 getRegions
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function getRegions($countryCode)
{
$options = array();
$notAvailableOption = array(
'value' => 'N/A',
- 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 _locationStockIterate
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function _locationStockIterate($args)
{
$quoteItemId = $args['quote_item_id'];
$productId = $args['product_id'];
$requestedQty = $this->checkoutProducts[$quoteItemId];
- 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 _getSearchableProducts
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
protected function _getSearchableProducts($storeId, array $staticFields, $productIds = null, $lastProductId = 0,
$limit = 100)
- Create a ticketCreate a ticket
Function items
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function items($locationId, $filters)
{
$collection = Mage::getResourceModel('demac_multilocationinventory/stock_collection');
if(isset($locationId) && !is_null($locationId)) {
$collection->addFieldToFilter('location_id', $locationId);
- 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"