Completed
Pull Request — develop (#891)
by Luke
04:11
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
3
namespace N98\Magento\Command\Indexer;
4
5
use N98\Magento\Command\AbstractMagentoCommand;
6
7
class AbstractMviewIndexerCommand extends AbstractMagentoCommand
8
{
9
    /**
10
     * @return \Enterprise_Mview_Model_Resource_Metadata_Collection
11
     */
12
    public function getMetaDataCollection()
13
    {
14
        $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...
15
        return $collection;
16
    }
17
18
    /**
19
     * @return array[]
20
     */
21
    protected function getIndexers()
22
    {
23
        /** @var \Enterprise_Index_Helper_Data $helper */
24
        $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...
25
26
        $indexers = array();
27
        foreach ($helper->getIndexers(true) as $indexer) {
28
            $indexers[(string) $indexer->index_table] = $indexer;
29
        }
30
31
        foreach ($indexers as $indexerKey => $indexerData) {
32
            if (!isset($indexerData->action_model->changelog)) {
33
                unset($indexers[$indexerKey]);
34
            }
35
        }
36
37
        return $indexers;
38
    }
39
40
    /**
41
     * @return \Enterprise_Mview_Model_Client
42
     */
43
    protected function getMviewClient()
44
    {
45
        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...
46
    }
47
}
48