Completed
Pull Request — master (#1188)
by Pierre
04:04
created

SubResourceMetadata::getProperty()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the API Platform project.
5
 *
6
 * (c) Kévin Dunglas <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace ApiPlatform\Core\Metadata\Resource;
15
16
final class SubResourceMetadata
17
{
18
    private $parent;
19
    private $property;
20
    private $isCollection;
21
    private $parentResourceClass;
22
23
    public function __construct(ResourceMetadata $parent, string $property, bool $isCollection, string $parentResourceClass)
24
    {
25
        $this->parent = $parent;
26
        $this->property = $property;
27
        $this->isCollection = $isCollection;
28
        $this->parentResourceClass = $parentResourceClass;
29
    }
30
31
    /**
32
     * @return ResourceMetadata
33
     */
34
    public function getParent(): ResourceMetadata
35
    {
36
        return $this->parent;
37
    }
38
39
    /**
40
     * @return string
41
     */
42
    public function getProperty(): string
43
    {
44
        return $this->property;
45
    }
46
47
    /**
48
     * @return bool
49
     */
50
    public function isCollection(): bool
51
    {
52
        return $this->isCollection;
53
    }
54
55
    /**
56
     * @return string
57
     */
58
    public function getParentResourceClass(): string
59
    {
60
        return $this->parentResourceClass;
61
    }
62
}
63