Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
100.00% |
1 / 1 |
|
100.00% |
3 / 3 |
CRAP | |
100.00% |
15 / 15 |
EntitySchema\DataAccess\WatchlistUpdater | |
100.00% |
1 / 1 |
|
100.00% |
3 / 3 |
6 | |
100.00% |
15 / 15 |
__construct | |
100.00% |
1 / 1 |
1 | |
100.00% |
3 / 3 |
|||
optionallyWatchEditedSchema | |
100.00% |
1 / 1 |
2 | |
100.00% |
6 / 6 |
|||
optionallyWatchNewSchema | |
100.00% |
1 / 1 |
3 | |
100.00% |
6 / 6 |
<?php | |
namespace EntitySchema\DataAccess; | |
use Title; | |
use User; | |
use WatchAction; | |
use EntitySchema\Domain\Model\SchemaId; | |
/** | |
* @license GPL-2.0-or-later | |
*/ | |
class WatchlistUpdater { | |
private $user; | |
private $namespace; | |
/** | |
* @param User $user | |
* @param int $namespaceID | |
*/ | |
public function __construct( User $user, $namespaceID ) { | |
$this->user = $user; | |
$this->namespace = $namespaceID; | |
} | |
public function optionallyWatchEditedSchema( SchemaId $schemaID ) { | |
if ( $this->user->getOption( 'watchdefault' ) ) { | |
WatchAction::doWatchOrUnwatch( | |
true, | |
Title::makeTitle( $this->namespace, $schemaID->getId() ), | |
$this->user | |
); | |
} | |
} | |
public function optionallyWatchNewSchema( SchemaId $schemaID ) { | |
if ( $this->user->getOption( 'watchcreations' ) || $this->user->getOption( 'watchdefault' ) ) { | |
WatchAction::doWatchOrUnwatch( | |
true, | |
Title::makeTitle( $this->namespace, $schemaID->getId() ), | |
$this->user | |
); | |
} | |
} | |
} |