Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| ZObjectFilterTypeChanged | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
| pass | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * WikiLambda ZObject Authorization Filter: Type has changed |
| 4 | * |
| 5 | * @file |
| 6 | * @ingroup Extensions |
| 7 | * @copyright 2020– Abstract Wikipedia team; see AUTHORS.txt |
| 8 | * @license MIT |
| 9 | */ |
| 10 | |
| 11 | namespace MediaWiki\Extension\WikiLambda\Authorization; |
| 12 | |
| 13 | use MediaWiki\Extension\WikiLambda\ZObjectContent\ZObjectContent; |
| 14 | use MediaWiki\Title\Title; |
| 15 | |
| 16 | class ZObjectFilterTypeChanged implements ZObjectFilter { |
| 17 | |
| 18 | /** |
| 19 | * ZObject filter that checks whether the type of the value has changed. |
| 20 | * |
| 21 | * @param ZObjectContent $fromContent |
| 22 | * @param ZObjectContent $toContent |
| 23 | * @param Title $title |
| 24 | * @param array $args |
| 25 | * @return bool |
| 26 | */ |
| 27 | public static function pass( $fromContent, $toContent, $title, $args = [] ): bool { |
| 28 | $oldType = $fromContent->getZType(); |
| 29 | $newType = $toContent->getZType(); |
| 30 | return $oldType !== $newType; |
| 31 | } |
| 32 | } |