Completed
Pull Request — develop (#891)
by Luke
03:50
created

AbstractMviewIndexerCommand   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 6
lcom 0
cbo 1
dl 0
loc 41
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getMetaDataCollection() 0 5 1
A getIndexers() 0 18 4
A getMviewClient() 0 4 1
1
<?php
2
namespace N98\Magento\Command\Indexer;
3
4
use N98\Magento\Command\AbstractMagentoCommand;
5
6
class AbstractMviewIndexerCommand extends AbstractMagentoCommand
7
{
8
    /**
9
     * @return \Enterprise_Mview_Model_Resource_Metadata_Collection
10
     */
11
    public function getMetaDataCollection()
12
    {
13
        $collection = $this->_getModel('enterprise_mview/metadata')->getCollection();
0 ignored issues
show
Bug introduced by
The call to _getModel() misses a required argument $mage2class.

This check looks for function calls that miss required arguments.

Loading history...
14
        return $collection;
15
    }
16
17
    /**
18
     * @return array[]
19
     */
20
    protected function getIndexers()
21
    {
22
        /** @var \Enterprise_Index_Helper_Data $helper */
23
        $helper = $this->_getHelper('enterprise_index');
0 ignored issues
show
Bug introduced by
The call to _getHelper() misses a required argument $mage2class.

This check looks for function calls that miss required arguments.

Loading history...
24
25
        $indexers = array();
26
        foreach ($helper->getIndexers(true) as $indexer) {
27
            $indexers[(string) $indexer->index_table] = $indexer;
28
        }
29
30
        foreach ($indexers as $indexerKey => $indexerData) {
31
            if (!isset($indexerData->action_model->changelog)) {
32
                unset($indexers[$indexerKey]);
33
            }
34
        }
35
36
        return $indexers;
37
    }
38
39
    /**
40
     * @return \Enterprise_Mview_Model_Client
41
     */
42
    protected function getMviewClient()
43
    {
44
        return $this->_getModel('enterprise_mview/client');
0 ignored issues
show
Bug introduced by
The call to _getModel() misses a required argument $mage2class.

This check looks for function calls that miss required arguments.

Loading history...
45
    }
46
}
47