| Conditions | 3 |
| Paths | 3 |
| Total Lines | 12 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 5 |
| CRAP Score | 3.4746 |
| Changes | 0 | ||
| 1 | <?php |
||
| 43 | 1 | public function source($source = null) |
|
| 44 | { |
||
| 45 | 1 | $model = $this->noInitModel; |
|
| 46 | 1 | if (!is_string($model->sourceAttribute)) { |
|
| 47 | return $this; |
||
| 48 | } |
||
| 49 | 1 | if (!is_string($source)) { |
|
| 50 | $modelClass = $this->modelClass; |
||
| 51 | $source = $modelClass::$sourceSelf; |
||
| 52 | } |
||
| 53 | 1 | return $this->andWhere([$model->sourceAttribute => $source]); |
|
| 54 | } |
||
| 55 | } |
||
| 56 |
Since your code implements the magic getter
_get, this function will be called for any read access on an undefined variable. You can add the@propertyannotation to your class or interface to document the existence of this variable.If the property has read access only, you can use the @property-read annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.