Completed
Pull Request — devel (#1212)
by Aric
02:57
created

_prepareCollection()   D

Complexity

Conditions 9
Paths 20

Size

Total Lines 29
Code Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
c 1
b 1
f 0
dl 0
loc 29
rs 4.909
cc 9
eloc 17
nc 20
nop 0
1
<?php
2
3
/**
4
 * User: [email protected]
5
 * Date: 08/01/14
6
 */
7
8
class Nexcessnet_Turpentine_Block_Adminhtml_Cache_Grid extends Mage_Adminhtml_Block_Cache_Grid
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
9
{
10
11
    /**
12
     * Prepare grid collection
13
     */
14
    protected function _prepareCollection()
15
    {
16
        parent::_prepareCollection();
17
        $collection = $this->getCollection();
18
        $turpentineEnabled = false;
19
        $fullPageEnabled = false;
20
        foreach ($collection as $key=>$item)
21
        {
22
            if ($item->getStatus() == 1 && ($item->getId() == 'turpentine_pages' || $item->getId() == 'turpentine_esi_blocks'))
23
            {
24
                $turpentineEnabled = true;
25
            }
26
            if ($item->getStatus() == 1 && $item->getId() == 'full_page')
27
            {
28
                $fullPageEnabled = true;
29
            }
30
        }
31
        if ($turpentineEnabled)
32
        {
33
            $collection->removeItemByKey('full_page');
34
        }
35
        if ($fullPageEnabled)
36
        {
37
            $collection->removeItemByKey('turpentine_pages');
38
            $collection->removeItemByKey('turpentine_esi_blocks');
39
        }
40
        $this->setCollection($collection);
41
        return $this;
42
    }
43
44
}
45