Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
9 / 9
100.00% covered (success)
100.00%
4 / 4
CRAP
100.00% covered (success)
100.00%
1 / 1
StaticProfileOverride
100.00% covered (success)
100.00%
9 / 9
100.00% covered (success)
100.00%
4 / 4
4
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getOverriddenName
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 priority
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 explain
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3namespace CirrusSearch\Profile;
4
5class StaticProfileOverride implements SearchProfileOverride {
6
7    /**
8     * @var string
9     */
10    private $name;
11
12    /**
13     * @var int
14     */
15    private $priority;
16
17    /**
18     * @param string $name
19     * @param int $priority
20     */
21    public function __construct( $name, $priority ) {
22        $this->name = $name;
23        $this->priority = $priority;
24    }
25
26    /**
27     * Get the overridden name or null if it cannot be overridden.
28     * @param string[] $contextParams
29     * @return string|null
30     */
31    public function getOverriddenName( array $contextParams ) {
32        return $this->name;
33    }
34
35    /**
36     * The priority of this override, lower wins
37     * @return int
38     */
39    public function priority() {
40        return $this->priority;
41    }
42
43    /**
44     * @return array
45     */
46    public function explain(): array {
47        return [
48            'type' => 'static',
49            'priority' => $this->priority(),
50            'value' => $this->name,
51        ];
52    }
53}