| Total Complexity | 7 |
| Total Lines | 41 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 12 | trait CaseSensitiveTrait |
||
| 13 | { |
||
| 14 | |||
| 15 | /** |
||
| 16 | * @var boolean |
||
| 17 | */ |
||
| 18 | private $caseSensitivity = null; |
||
| 19 | |||
| 20 | private function pushCaseSensitivityToContext(Context $context) |
||
| 21 | { |
||
| 22 | if ($this->caseSensitivity !== null) { |
||
| 23 | $context->pushCaseSensitivity($this->caseSensitivity); |
||
| 24 | } |
||
| 25 | } |
||
| 26 | |||
| 27 | private function popCaseSensitivityFromContext(Context $context) |
||
| 28 | { |
||
| 29 | if ($this->caseSensitivity !== null) { |
||
| 30 | $context->popCaseSensitivity(); |
||
| 31 | } |
||
| 32 | } |
||
| 33 | |||
| 34 | public function setCaseSensitivity(string $preference) |
||
| 35 | { |
||
| 36 | $this->caseSensitivity = $preference; |
||
|
|
|||
| 37 | |||
| 38 | return $this; |
||
| 39 | } |
||
| 40 | |||
| 41 | public function caseSensitive() |
||
| 46 | } |
||
| 47 | |||
| 48 | public function caseInsensitive() |
||
| 53 | } |
||
| 54 | |||
| 55 | } |
||
| 56 |
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.