updateSubmitErrors()   A
last analyzed

Complexity

Conditions 4
Paths 6

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.9
c 0
b 0
f 0
cc 4
nc 6
nop 0
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