2020-10-11 21:17:41 +00:00
|
|
|
<?php
|
|
|
|
|
2020-12-18 14:05:33 +00:00
|
|
|
namespace MediaWiki\Extension\AbuseFilter\Consequences;
|
2020-10-11 21:17:41 +00:00
|
|
|
|
2021-01-07 20:10:52 +00:00
|
|
|
use MediaWiki\Extension\AbuseFilter\Filter\ExistingFilter;
|
2020-10-11 21:17:41 +00:00
|
|
|
use MediaWiki\Linker\LinkTarget;
|
|
|
|
use MediaWiki\User\UserIdentity;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Immutable value object that provides "base" parameters to Consequence objects
|
2021-02-28 15:31:24 +00:00
|
|
|
* @todo Should use ActionSpecifier
|
2020-10-11 21:17:41 +00:00
|
|
|
*/
|
|
|
|
class Parameters {
|
2021-01-07 20:10:52 +00:00
|
|
|
/** @var ExistingFilter */
|
2020-10-11 21:17:41 +00:00
|
|
|
private $filter;
|
|
|
|
|
|
|
|
/** @var bool */
|
|
|
|
private $isGlobalFilter;
|
|
|
|
|
|
|
|
/** @var UserIdentity */
|
|
|
|
private $user;
|
|
|
|
|
|
|
|
/** @var LinkTarget */
|
|
|
|
private $target;
|
|
|
|
|
|
|
|
/** @var string */
|
|
|
|
private $action;
|
|
|
|
|
|
|
|
/**
|
2021-01-07 20:10:52 +00:00
|
|
|
* @param ExistingFilter $filter
|
2020-10-11 21:17:41 +00:00
|
|
|
* @param bool $isGlobalFilter
|
|
|
|
* @param UserIdentity $user
|
|
|
|
* @param LinkTarget $target
|
|
|
|
* @param string $action
|
|
|
|
*/
|
|
|
|
public function __construct(
|
2021-01-07 20:10:52 +00:00
|
|
|
ExistingFilter $filter,
|
2020-10-11 21:17:41 +00:00
|
|
|
bool $isGlobalFilter,
|
|
|
|
UserIdentity $user,
|
|
|
|
LinkTarget $target,
|
|
|
|
string $action
|
|
|
|
) {
|
|
|
|
$this->filter = $filter;
|
|
|
|
$this->isGlobalFilter = $isGlobalFilter;
|
|
|
|
$this->user = $user;
|
|
|
|
$this->target = $target;
|
|
|
|
$this->action = $action;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2021-01-07 20:10:52 +00:00
|
|
|
* @return ExistingFilter
|
2020-10-11 21:17:41 +00:00
|
|
|
*/
|
2021-01-07 20:10:52 +00:00
|
|
|
public function getFilter(): ExistingFilter {
|
2020-10-11 21:17:41 +00:00
|
|
|
return $this->filter;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
public function getIsGlobalFilter(): bool {
|
|
|
|
return $this->isGlobalFilter;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return UserIdentity
|
|
|
|
*/
|
|
|
|
public function getUser(): UserIdentity {
|
|
|
|
return $this->user;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return LinkTarget
|
|
|
|
*/
|
|
|
|
public function getTarget(): LinkTarget {
|
|
|
|
return $this->target;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function getAction(): string {
|
|
|
|
return $this->action;
|
|
|
|
}
|
|
|
|
}
|