Completed
Push — feature-20rc1 ( 008ae2 )
by Rob
16:55
created

Attributes::getExtension()   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 `liip/LiipImagineBundle` project.
5
 *
6
 * (c) https://github.com/liip/LiipImagineBundle/graphs/contributors
7
 *
8
 * For the full copyright and license information, please view the LICENSE.md
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Liip\ImagineBundle\File\Attributes;
13
14
/**
15
 * @author Rob Frawley 2nd <[email protected]>
16
 */
17
final class Attributes
18
{
19
    /**
20
     * @var ContentTypeAttribute
21
     */
22
    private $contentType;
23
24
    /**
25
     * @var ExtensionAttribute
26
     */
27
    private $extension;
28
29
    /**
30
     * @param ContentTypeAttribute|null $contentType
31
     * @param ExtensionAttribute|null   $extension
32
     */
33
    public function __construct(ContentTypeAttribute $contentType = null, ExtensionAttribute $extension = null)
34
    {
35
        $this->contentType = $contentType ?: new ContentTypeAttribute();
36
        $this->extension = $extension ?: new ExtensionAttribute();
37
    }
38
39
    /**
40
     * @return ContentTypeAttribute
41
     */
42
    public function getContentType(): ContentTypeAttribute
43
    {
44
        return $this->contentType;
45
    }
46
47
    /**
48
     * @return ExtensionAttribute
49
     */
50
    public function getExtension(): ExtensionAttribute
51
    {
52
        return $this->extension;
53
    }
54
55
    /**
56
     * @return bool
57
     */
58
    public function isValid(): bool
59
    {
60
        return true === $this->contentType->isValid()
61
            && true === $this->extension->isValid();
62
    }
63
}
64