Completed
Push — master ( 8b1d39...e6cddd )
by Jakob
01:31
created

LanguageMapOfStrings::jsonLDSerialize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Importance

Changes 0
Metric Value
dl 4
loc 4
rs 10
c 0
b 0
f 0
nc 1
cc 1
eloc 2
nop 1
1
<?php declare(strict_types = 1);
2
3
namespace JSKOS;
4
5
use InvalidArgumentException;
6
7
/**
8
 * Language map of strings for prefLabel.
9
 */
10 View Code Duplication
class LanguageMapOfStrings extends LanguageMap
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
11
{
12
    protected static function checkMember($value)
13
    {
14
        if (is_scalar($value)) {
15
            return "$value";
16
        } else {
17
            throw new InvalidArgumentException(
18
                'JSKOS\LanguageMapOfStrings may only contain strings'
19
            );
20
        }
21
    }
22
    
23
    public function contains($member): bool
24
    {
25
        return in_array($member, $this->members);
26
    }
27
28
    /**
29
     * Return a data structure to serialize this container as JSON.
30
     */
31
    public function jsonLDSerialize(string $context = self::DEFAULT_CONTEXT)
32
    {
33
        return (object)$this->members;
34
    }
35
}
36