Showing 22 of 262 total issues
Function sign
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
private function sign($data, $method)
{
$data['client_id'] = $this->getConfigData('client_id');
$secretKey = '';
- 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 Carrier.php
has 288 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
*
*
Method getOrderData
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getOrderData($order) {
if (Mage::getStoreConfig('carriers/' . $this->_name . '/onlyone')) {
$weight = round(Mage::getStoreConfig('carriers/' . $this->_name . '/oneweight') * 1000 / Mage::getStoreConfig('carriers/' . $this->_name . '/weightunit'), 3);
$dimensions = Mage::helper($this->_name)->getStandardSizes();
Method collectRates
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function collectRates(Mage_Shipping_Model_Rate_Request $request)
{
Varien_Profiler::start($this->_name . '_collect_rate');
if (!$this->getType()) {
Function autocomp
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
function autocomp(name)
{
jQuery('input[name="' + name + '[city]"]').autocomplete({
source: function (request, response) {
jQuery.ajax({
Mygento_Yandexdelivery_Model_Carrier
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
class Mygento_Yandexdelivery_Model_Carrier {
private $_name = 'yandexdelivery';
private $_url = 'https://delivery.yandex.ru/api/last/';
Method sendAction
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function sendAction()
{
if (!$this->getRequest()->isPost()) {
Mage::getSingleton('adminhtml/session')->addError('Sending error');
Method getAjaxButton
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getAjaxButton($name, $title, $url)
{
$html = $this->getLayout()->createBlock('adminhtml/widget_button')
->setData([
'label' => Mage::helper('yandexdelivery')->__($title),
Method processType
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function processType($response, $type, $request, $result)
{
foreach ($response->data as $carrier_offer) {
$price = $request->getFreeShipping() ? 0 : $carrier_offer->cost;
Function getSizes
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function getSizes($items, $is_quote)
{
$temporary_dimensions = [];
$weight = 0;
- 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 getTable
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getTable()
{
//таблица с статусами заказа
if (!$this->hasYdId()) {
Method processApiIds
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function processApiIds($data_string) {
$json = json_decode(trim($data_string));
$res = Mage::getSingleton('core/resource');
Method sign
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function sign($data, $method)
{
$data['client_id'] = $this->getConfigData('client_id');
$secretKey = '';
Function getOrderData
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected function getOrderData($order) {
if (Mage::getStoreConfig('carriers/' . $this->_name . '/onlyone')) {
$weight = round(Mage::getStoreConfig('carriers/' . $this->_name . '/oneweight') * 1000 / Mage::getStoreConfig('carriers/' . $this->_name . '/weightunit'), 3);
$dimensions = Mage::helper($this->_name)->getStandardSizes();
- 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 confirmOrder
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private function confirmOrder($ydId, $senderId, $type, $showAdmin = true)
{
$result = Mage::getModel('yandexdelivery/carrier')->confirmOrders($ydId, $senderId, $type);
- 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 getSizes
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getSizes($items, $is_quote)
{
$temporary_dimensions = [];
$weight = 0;
Method createOrder
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
public function createOrder($orderId, $warehouseId, $senderId, $requisiteId, $date, $street, $house) {
Function processType
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function processType($response, $type, $request, $result)
{
foreach ($response->data as $carrier_offer) {
$price = $request->getFreeShipping() ? 0 : $carrier_offer->cost;
- 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 collectRates
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function collectRates(Mage_Shipping_Model_Rate_Request $request)
{
Varien_Profiler::start($this->_name . '_collect_rate');
if (!$this->getType()) {
- 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 isValidDimensionArr
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function isValidDimensionArr($arr)
{
if (is_array($arr) and 3 == sizeof($arr)) {
foreach ($arr as $a) {
if ((!is_int($a) and ! is_float($a)) or $a < 0.1) {
- 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"