GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Push — hypernext ( 670104...c80301 )
by Nico
14:24
created

ContentParams::getExtra()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
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\Exceptions\ImproperActionException;
13
use Elabftw\Interfaces\ContentParamsInterface;
14
use Elabftw\Services\Filter;
15
16
class ContentParams implements ContentParamsInterface
17
{
18
    protected const MIN_CONTENT_SIZE = 1;
19
20
    public function __construct(protected string $content = '', protected string $target = '', protected ?array $extra = null)
21
    {
22
    }
23
24
    public function getTarget(): string
25
    {
26
        return $this->target;
27
    }
28
29
    public function getContent(): string
30
    {
31
        // check for length
32
        $c = Filter::sanitize($this->content);
33
        if (mb_strlen($c) < self::MIN_CONTENT_SIZE) {
34
            throw new ImproperActionException(sprintf(_('Input is too short! (minimum: %d)'), 2));
35
        }
36
        return $c;
37
    }
38
39
    public function getBody(): string
40
    {
41
        return Filter::body($this->content);
42
    }
43
44
    public function getExtra(string $key): string
45
    {
46
        return Filter::sanitize($this->extra[$key] ?? '');
47
    }
48
}
49