CssRules   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 8
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 8
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A getRule() 0 6 2
1
<?php
2
declare(strict_types=1);
3
/*
4
 * citeproc-php
5
 *
6
 * @link        http://github.com/seboettg/citeproc-php for the source repository
7
 * @copyright   Copyright (c) 2017 Sebastian Böttger.
8
 * @license     https://opensource.org/licenses/MIT
9
 */
10
11
namespace Seboettg\CiteProc\Styles\Css;
12
13
use Seboettg\Collection\Map;
14
15
class CssRules extends Map
16
{
17
    public function getRule(string $rule): CssRule
18
    {
19
        if (!$this->containsKey($rule)) {
20
            $this->put($rule, new CssRule(substr($rule, 1), substr($rule, 0, 1)));
21
        }
22
        return $this->get($rule);
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->get($rule) could return the type null which is incompatible with the type-hinted return Seboettg\CiteProc\Styles\Css\CssRule. Consider adding an additional type-check to rule them out.
Loading history...
23
    }
24
}
25