ProductQuestion_OrderExtension   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 1
dl 0
loc 19
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A updateSubmitErrors() 0 11 4
1
<?php
2
3
/**
4
 * adds functionality to OrderItems
5
 *
6
 *
7
 *
8
 */
9
10
class ProductQuestion_OrderExtension extends DataExtension
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...
11
{
12
13
    /**
14
     *
15
     * @return null | array
0 ignored issues
show
Documentation introduced by
Should the return type not be array|null?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
16
     */
17
    public function updateSubmitErrors()
18
    {
19
        $array = array();
20
        foreach ($this->owner->OrderItems() as $item) {
21
            if (!$item->AllRequiredQuestionsAnswered()) {
22
                $txt = _t("ProductQuestion.PROVIDE_MORE_INFORMATION", "Please answer question in relation to:");
23
                $array[$item->ID] = $txt." <em>".$item->getTableTitle()."</em>";
24
            }
25
        }
26
        return count($array) ? $array : null;
27
    }
28
}
29