Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
9 / 9
100.00% covered (success)
100.00%
7 / 7
CRAP
100.00% covered (success)
100.00%
1 / 1
Parameters
100.00% covered (success)
100.00%
9 / 9
100.00% covered (success)
100.00%
7 / 7
7
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
1 / 1
1
 getFilter
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getIsGlobalFilter
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getActionSpecifier
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getUser
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getTarget
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getAction
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3namespace MediaWiki\Extension\AbuseFilter\Consequences;
4
5use MediaWiki\Extension\AbuseFilter\ActionSpecifier;
6use MediaWiki\Extension\AbuseFilter\Filter\ExistingFilter;
7use MediaWiki\Linker\LinkTarget;
8use MediaWiki\User\UserIdentity;
9
10/**
11 * Immutable value object that provides "base" parameters to Consequence objects
12 */
13class Parameters {
14    /** @var ExistingFilter */
15    private $filter;
16
17    /** @var bool */
18    private $isGlobalFilter;
19
20    /** @var ActionSpecifier */
21    private $specifier;
22
23    /**
24     * @param ExistingFilter $filter
25     * @param bool $isGlobalFilter
26     * @param ActionSpecifier $specifier
27     */
28    public function __construct(
29        ExistingFilter $filter,
30        bool $isGlobalFilter,
31        ActionSpecifier $specifier
32    ) {
33        $this->filter = $filter;
34        $this->isGlobalFilter = $isGlobalFilter;
35        $this->specifier = $specifier;
36    }
37
38    /**
39     * @return ExistingFilter
40     */
41    public function getFilter(): ExistingFilter {
42        return $this->filter;
43    }
44
45    /**
46     * @return bool
47     */
48    public function getIsGlobalFilter(): bool {
49        return $this->isGlobalFilter;
50    }
51
52    /**
53     * @return ActionSpecifier
54     */
55    public function getActionSpecifier(): ActionSpecifier {
56        return $this->specifier;
57    }
58
59    /**
60     * @return UserIdentity
61     */
62    public function getUser(): UserIdentity {
63        return $this->specifier->getUser();
64    }
65
66    /**
67     * @return LinkTarget
68     */
69    public function getTarget(): LinkTarget {
70        return $this->specifier->getTitle();
71    }
72
73    /**
74     * @return string
75     */
76    public function getAction(): string {
77        return $this->specifier->getAction();
78    }
79}