NoDataDocument::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
declare(strict_types = 1);
3
4
namespace Mikemirten\Component\JsonApi\Document;
5
6
/**
7
 * No data document
8
 *
9
 * @see http://jsonapi.org/format/#document-structure
10
 *
11
 * @package Mikemirten\Component\JsonApi\Document
12
 */
13
class NoDataDocument extends AbstractDocument
14
{
15
    /**
16
     * NoDataDocument constructor.
17
     *
18
     * @param array $metadata
19
     */
20 19
    public function __construct(array $metadata = [])
21
    {
22 19
        $this->metadata = $metadata;
23 19
    }
24
25
    /**
26
     * Cast to a string
27
     *
28
     * @return string
29
     */
30 5
    public function __toString(): string
31
    {
32 5
        return 'Document with no data';
33
    }
34
}