Ui/DataProvider/Product/Form/Modifier/Plan.php
File Plan.php
has 469 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
Method fillMeta
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function fillMeta()
{
return [
'id' => $this->getTextColumn('id', true, __('ID'), 10),
'thumbnail' => [
Method getButtonSet
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function getButtonSet()
{
return [
'arguments' => [
'data' => [
Method modifyQtyAndStockStatus
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function modifyQtyAndStockStatus(array $meta)
{
if ($groupCode = $this->getGroupCodeByField($meta, 'container_' . self::$codeQuantityAndStockStatus)) {
$parentChildren = &$meta[$groupCode]['children'];
if (!empty($parentChildren['container_' . self::$codeQuantityAndStockStatus])) {
Method getListing
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function getListing()
{
return [
'arguments' => [
'data' => [
Method getModal
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function getModal()
{
return [
'arguments' => [
'data' => [
Method getGrid
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function getGrid()
{
$grid = [
'arguments' => [
'data' => [
Method __construct
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
LocatorInterface $locator,
UrlInterface $urlBuilder,
ProductLinkRepositoryInterface $productLinkRepository,
ProductRepositoryInterface $productRepository,
ImageHelper $imageHelper,
Method modifyMeta
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function modifyMeta(array $meta)
{
if ($this->locator->getProduct()->getTypeId() === GroupedProductType::TYPE_CODE) {
$meta = array_replace_recursive(
$meta,
Function modifyData
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
public function modifyData(array $data)
{
/** @var \Magento\Catalog\Model\Product $product */
$product = $this->locator->getProduct();
$modelId = $product->getId();
- 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 modifyQtyAndStockStatus
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
protected function modifyQtyAndStockStatus(array $meta)
{
if ($groupCode = $this->getGroupCodeByField($meta, 'container_' . self::$codeQuantityAndStockStatus)) {
$parentChildren = &$meta[$groupCode]['children'];
if (!empty($parentChildren['container_' . self::$codeQuantityAndStockStatus])) {
- 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"