| Conditions | 2 |
| Paths | 2 |
| Total Lines | 15 |
| Code Lines | 8 |
| Lines | 15 |
| Ratio | 100 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php namespace App\Repositories; |
||
| 35 | View Code Duplication | public function validate(array $data) |
|
| 36 | { |
||
| 37 | $validator = Validator::make($data, |
||
| 38 | [ |
||
| 39 | 'sale_id' => 'required|integer|min:0', |
||
| 40 | 'product_id' => 'required|integer|min:0', |
||
| 41 | 'quantity' => 'required|integer|min:0', |
||
| 42 | 'current_price' => 'required|numeric|min:0' |
||
| 43 | ] |
||
| 44 | ); |
||
| 45 | |||
| 46 | if( $validator->fails() ) { |
||
| 47 | throw new RepositoryException('Sale detail validation failed', RepositoryException::VALIDATION_FAILED); |
||
| 48 | } |
||
| 49 | } |
||
| 50 | |||
| 51 | } |
Since your code implements the magic setter
_set, this function will be called for any write access on an undefined variable. You can add the@propertyannotation to your class or interface to document the existence of this variable.Since the property has write access only, you can use the @property-write 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.