Mygento_Yandexdelivery_Model_Source_Attribute   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 0
dl 0
loc 28
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getAllOptions() 0 19 4
A toOptionArray() 0 4 1
1
<?php
2
3
/**
4
 *
5
 *
6
 * @category Mygento
7
 * @package Mygento_Yandexdelivery
8
 * @copyright 2017 NKS LLC. (http://www.mygento.ru)
9
 * @license GPLv2
10
 */
11
class Mygento_Yandexdelivery_Model_Source_Attribute
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...
12
{
13
14
    public function getAllOptions()
15
    {
16
        $attributes = Mage::getModel('eav/config')->getEntityType(Mage_Catalog_Model_Product::ENTITY)->getAttributeCollection();
17
        $attributes->setOrder('frontend_label', 'ASC');
18
19
        $_options = [];
20
        $_options[] = [
21
            'label' => Mage::helper('yandexdelivery')->__('No usage'),
22
            'value' => 0
23
        ];
24
25
        foreach ($attributes as $attr) {
26
            $label = $attr->getStoreLabel() ? $attr->getStoreLabel() : $attr->getFrontendLabel();
27
            if ('' != $label) {
28
                $_options[] = ['label' => $label, 'value' => $attr->getAttributeCode()];
29
            }
30
        }
31
        return $_options;
32
    }
33
34
    public function toOptionArray()
35
    {
36
        return $this->getAllOptions();
37
    }
38
}
39