splitbrain /
dokuwiki
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | |||
| 3 | namespace dokuwiki\Form; |
||
| 4 | |||
| 5 | /** |
||
| 6 | * Class ValueElement |
||
| 7 | * |
||
| 8 | * Just like an Element but it's value is not part of its attributes |
||
| 9 | * |
||
| 10 | * What the value is (tag name, content, etc) is defined by the actual implementations |
||
| 11 | * |
||
| 12 | * @package dokuwiki\Form |
||
| 13 | */ |
||
| 14 | abstract class ValueElement extends Element { |
||
| 15 | |||
| 16 | /** |
||
| 17 | * @var string holds the element's value |
||
| 18 | */ |
||
| 19 | protected $value = ''; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * @param string $type |
||
| 23 | * @param array|string $value |
||
| 24 | * @param array $attributes |
||
| 25 | */ |
||
| 26 | public function __construct($type, $value, $attributes = array()) { |
||
| 27 | parent::__construct($type, $attributes); |
||
| 28 | $this->val($value); |
||
|
0 ignored issues
–
show
|
|||
| 29 | } |
||
| 30 | |||
| 31 | /** |
||
| 32 | * Get or set the element's value |
||
| 33 | * |
||
| 34 | * @param null|string $value |
||
| 35 | * @return string|$this |
||
| 36 | */ |
||
| 37 | public function val($value = null) { |
||
| 38 | if($value !== null) { |
||
| 39 | $this->value = $value; |
||
| 40 | return $this; |
||
| 41 | } |
||
| 42 | return $this->value; |
||
| 43 | } |
||
| 44 | |||
| 45 | } |
||
| 46 |
This check looks at variables that have been passed in as parameters and are passed out again to other methods.
If the outgoing method call has stricter type requirements than the method itself, an issue is raised.
An additional type check may prevent trouble.