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

UnfinishedStepsParams::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 0
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 2
rs 10
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