| Conditions | 4 |
| Paths | 3 |
| Total Lines | 14 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 4 |
| Changes | 1 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php namespace Propaganistas\LaravelTranslatableBootForms\Form; |
||
| 39 | 6 | protected function getBoundValue($name, $default) |
|
| 40 | { |
||
| 41 | 6 | $inputName = preg_split('/[\[\]]+/', $name, - 1, PREG_SPLIT_NO_EMPTY); |
|
| 42 | 6 | if (count($inputName) == 2 && in_array($inputName[0], $this->locales)) { |
|
| 43 | 3 | list($lang, $name) = $inputName; |
|
| 44 | 3 | $value = isset($this->boundData->data()->translate($lang)->{$name}) |
|
| 45 | 3 | ? $this->boundData->data()->translate($lang)->{$name} |
|
| 46 | 3 | : ''; |
|
| 47 | |||
| 48 | 3 | return $this->escape($value); |
|
| 49 | } |
||
| 50 | |||
| 51 | 3 | return $this->escape($this->boundData->get($name, $default)); |
|
| 52 | } |
||
| 53 | } |
||
| 54 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: