Passed
Push — hypernext ( 670104...c80301 )
by Nico
14:24
created

UnfinishedStepsParams   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 15
rs 10
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getExtra() 0 9 3
A __construct() 0 2 1
1
<?php declare(strict_types=1);
2
/**
3
 * @author Nicolas CARPi <[email protected]>
4
 * @copyright 2012 Nicolas CARPi
5
 * @see https://www.elabftw.net Official website
6
 * @license AGPL-3.0
7
 * @package elabftw
8
 */
9
10
namespace Elabftw\Elabftw;
11
12
use Elabftw\Interfaces\ContentParamsInterface;
13
use Elabftw\Services\Filter;
14
15
final class UnfinishedStepsParams extends ContentParams implements ContentParamsInterface
16
{
17
    public function __construct(protected ?array $extra = null)
18
    {
19
    }
20
21
    public function getExtra(string $key): string
22
    {
23
        $scope = Filter::sanitize($this->extra[$key] ?? 'user');
24
25
        if (!($scope === 'user' || $scope === 'team')) {
26
            $scope = 'user';
27
        }
28
29
        return $scope;
30
    }
31
}
32