| Conditions | 2 |
| Paths | 2 |
| Total Lines | 19 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 6 |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 26 | public function builders($builders, $formId) |
||
| 27 | { |
||
| 28 | $data = array(); |
||
| 29 | foreach ($builders as $builder) { |
||
| 30 | $data[$builder->getProductId()] = array_values($builder->getSelected()); |
||
| 31 | } |
||
| 32 | $builderJson = json_encode($data); |
||
| 33 | |||
| 34 | $script = <<<js |
||
| 35 | var builders = {$builderJson}; |
||
| 36 | jQuery('document').ready(function(){ |
||
| 37 | uomBuilders(jQuery('form#{$formId}'), builders); |
||
| 38 | }); |
||
| 39 | js; |
||
| 40 | |||
| 41 | $this->getView()->headScript() |
||
| 42 | ->appendFile('/js/configure-buy.js') |
||
| 43 | ->appendScript($script); |
||
| 44 | } |
||
| 45 | } |
||
| 46 |
If you access a property on an interface, you most likely code against a concrete implementation of the interface.
Available Fixes
Adding an additional type check:
Changing the type hint: