| Conditions | 4 |
| Paths | 15 |
| Total Lines | 27 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 28 | public function run($request) |
||
| 29 | { |
||
| 30 | $dateOneWeekAgo = date('Y-m-d', strtotime('-1 week')); |
||
| 31 | |||
| 32 | $addons = Addon::get()->filter('LastUpdated:LessThan', $dateOneWeekAgo); |
||
| 33 | |||
| 34 | foreach ($addons as $addon) { |
||
| 35 | /** @var Addon $addon */ |
||
| 36 | try { |
||
| 37 | $addon->Keywords()->removeAll(); |
||
|
|
|||
| 38 | $addon->Screenshots()->removeAll(); |
||
| 39 | $addon->CompatibleVersions()->removeAll(); |
||
| 40 | |||
| 41 | foreach ($addon->Versions() as $version) { |
||
| 42 | /** @var AddonVersion $version */ |
||
| 43 | $version->Authors()->removeAll(); |
||
| 44 | $version->Keywords()->removeAll(); |
||
| 45 | $version->CompatibleVersions()->removeAll(); |
||
| 46 | $version->delete(); |
||
| 47 | } |
||
| 48 | |||
| 49 | $addon->delete(); |
||
| 50 | } catch (NotFoundException $e) { |
||
| 51 | // no-op |
||
| 52 | } |
||
| 53 | } |
||
| 54 | } |
||
| 55 | } |
||
| 56 |
If you implement
__calland you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.This is often the case, when
__callis implemented by a parent class and only the child class knows which methods exist: