Showing 30 of 34 total issues
Method install
has 157 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
{
$installer = $setup;
$installer->startSetup();
Method install
has 104 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
{
$storeId = $this->storeManager->getStore()->getId();
Method setUp
has 83 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function setUp()
{
$this->context = $this->getMockBuilder(Context::class)
->disableOriginalConstructor()
->getMock();
Function performAfterLoad
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
Open
public function performAfterLoad($tableName, $linkField)
{
$linkedIds = $this->getColumnValues($linkField);
if (!empty($linkedIds)) {
- 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 execute
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
Open
public function execute()
{
$data = $this->getRequest()->getPostValue();
/** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
$resultRedirect = $this->resultRedirectFactory->create();
- 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 config
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function config($templateModel)
{
$ori = $templateModel->getTemplatePaperOri();
$orientation = $this->templatePaperOrientation->getAvailable();
$finalOri = $orientation[$ori][0];
Method execute
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function execute()
{
$data = $this->getRequest()->getPostValue();
/** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
$resultRedirect = $this->resultRedirectFactory->create();
Method __construct
has 13 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
EntityFactoryInterface $entityFactory,
LoggerInterface $logger,
FetchStrategyInterface $fetchStrategy,
ManagerInterface $eventManager,
StoreManagerInterface $storeManager,
Method execute
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function execute()
{
$template = $this->_initTemplate();
Method testTemplate2Pdf
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function testTemplate2Pdf()
{
$this->pdfGeneratorMock = $this->getMockBuilder(Pdfgenerator::class)
->setMethods(['getTemplateCustomForm'])
Method __construct
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
Context $context,
Registry $coreRegistry,
Config $emailConfig,
JsonFactory $resultJsonFactory,
Pdf $helper,
Method performAfterLoad
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function performAfterLoad($tableName, $linkField)
{
$linkedIds = $this->getColumnValues($linkField);
if (!empty($linkedIds)) {
Method execute
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function execute()
{
$templateId = $this->getRequest()->getParam('template_id');
Method __construct
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
Context $context,
Renderer $addressRenderer,
PaymentHelper $paymentHelper,
InvoiceIdentity $identityContainer,
Processor $templateFactory,
Method testGetTemplateStatus
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function testGetTemplateStatus()
{
$invoiceMock = $this->getMockBuilder(Invoice::class)
->disableOriginalConstructor()
Method setUp
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function setUp()
{
$this->context = $this->getMockBuilder(Context::class)
->setMethods(['getScopeConfig'])
->disableOriginalConstructor()
Method saveStoreRelation
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function saveStoreRelation(AbstractModel $template)
{
$oldStores = $this->lookupStoreIds($template->getId());
$newStores = (array)$template->getStoreId();
if (empty($newStores)) {
Method prepareDataSource
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function prepareDataSource(array $dataSource)
{
if (isset($dataSource['data']['items'])) {
foreach ($dataSource['data']['items'] as & $item) {
$name = $this->getData('name');
Method execute
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function execute()
{
$id = $this->getRequest()->getParam('template_id');
if ($id) {
Method __construct
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
Context $context,
Registry $coreRegistry,
Config $emailConfig,
JsonFactory $resultJsonFactory,
JsonHelperData $jsonHelperData,