Completed
Push — master ( e2e002...b5462c )
by
unknown
09:18 queued 02:12
created

BasicInput::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 1
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace Charcoal\Admin\Property\Input\Tinymce;
4
5
// From 'charcoal-admin'
6
use Charcoal\Admin\Property\Input\TinymceInput;
7
8
/**
9
 * Basic Features for a TinyMCE Rich-Text Input Property
10
 */
11
class BasicInput extends TinymceInput
12
{
13
    /**
14
     * Return a new object property for sports.
15
     *
16
     * @param array $data Dependencies.
17
     */
18
    public function __construct(array $data = null)
19
    {
20
        parent::__construct($data);
21
22
        $defaultData = $this->metadata()->defaultData();
23
        if ($defaultData) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $defaultData 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...
24
            $this->setData($defaultData);
25
        }
26
    }
27
}
28