ConceptBundle   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 3
dl 0
loc 24
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A jsonLDSerialize() 0 8 4
1
<?php declare(strict_types = 1);
2
3
namespace JSKOS;
4
5
use JSKOS\PrettyJsonSerializable;
6
7
/**
8
 * A JSKOS Concept Bundle to be used as part of Mappings.
9
 *
10
 * @see https://gbv.github.io/jskos/jskos.html#concept-bundles
11
 */
12
class ConceptBundle extends PrettyJsonSerializable
13
{
14
    const FIELDS = [
15
        'memberSet' => ['Set', 'Concept'],
16
        'memberList' => ['Set', 'Concept'], // FIXME
17
        'memberChoice' => ['Set', 'Concept'],
18
    ];
19
20
    use ConceptBundleTrait;
21
22
    /**
23
     * Returns data which should be serialized to JSON.
24
     * @param string $context
25
     * @param bool $types
26
     */
27
    public function jsonLDSerialize(string $context = self::DEFAULT_CONTEXT, bool $types = null)
28
    {
29
        if (!$this->memberSet && !$this->memberList && !$this->memberChoice) {
30
            $this->memberSet = new Set();
31
        }
32
33
        return parent::jsonLDSerialize($context, $types);
34
    }
35
}
36