| Conditions | 4 |
| Paths | 3 |
| Total Lines | 45 |
| Code Lines | 24 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 21 | public static function simulate($matchId) |
||
| 22 | { |
||
| 23 | $result = MatchResult::complete() |
||
| 24 | ->where( |
||
| 25 | [ |
||
| 26 | 'id' => $matchId |
||
| 27 | ] |
||
| 28 | )->first(); |
||
| 29 | |||
| 30 | if (!empty($result) && !$result->simulated) { |
||
| 31 | //simulate match |
||
| 32 | $match = Match::fromArray( |
||
| 33 | \App\Lib\DsManager\Models\Orm\Match::complete() |
||
|
|
|||
| 34 | ->where( |
||
| 35 | [ |
||
| 36 | 'id' => $matchId |
||
| 37 | ] |
||
| 38 | )->first()->toArray() |
||
| 39 | ); |
||
| 40 | |||
| 41 | $matchResult = $match->simulate()->toArray(); |
||
| 42 | |||
| 43 | $result = MatchResult::where( |
||
| 44 | [ |
||
| 45 | 'id' => $matchId |
||
| 46 | ] |
||
| 47 | )->update( |
||
| 48 | MatchResult::resolveAttributes( |
||
| 49 | $matchResult, |
||
| 50 | $matchId |
||
| 51 | ) |
||
| 52 | ); |
||
| 53 | if ($result === 1) { |
||
| 54 | $result = MatchResult::complete() |
||
| 55 | ->where( |
||
| 56 | [ |
||
| 57 | 'id' => $matchId |
||
| 58 | ] |
||
| 59 | )->first(); |
||
| 60 | } |
||
| 61 | |||
| 62 | } |
||
| 63 | |||
| 64 | return $result; |
||
| 65 | } |
||
| 66 | } |
This check marks calls to methods that do not seem to exist on an object.
This is most likely the result of a method being renamed without all references to it being renamed likewise.