Issues (138)

src/Renderer/Basic.php (1 issue)

1
<?php
2
3
class Nip_Form_Renderer_Basic extends Nip_Form_Renderer_Table
4
{
5
    /**
6
     * @inheritDoc
7
     */
8
    public function renderElements()
9
    {
10
        $elements = $this->getElements();
11
        if ($elements) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $elements of type array is implicitly converted to a boolean; are you sure this is intended? If so, consider using ! empty($expr) instead to make it clear that you intend to check for an array without elements.

This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.

Consider making the comparison explicit by using empty(..) or ! empty(...) instead.

Loading history...
12
            foreach ($elements as $element) {
13
                if (!$element->isRendered()) {
14
                    $idRow = $element->getUniqueId();
15
                    $this->setRowAttrib($idRow, 'class', "row " . $idRow);
16
                    $this->addCell($idRow, 1, $element, 'label');
17
                    $this->addCell($idRow, 2, $element, 'value');
18
                }
19
            }
20
        }
21
        return parent::renderElements();
22
    }
23
}
24