Completed
Pull Request — master (#47)
by Romain
02:37
created

Image::getAllowedExtensions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Kerox\Messenger\Model\Message\Attachment;
4
5
use Kerox\Messenger\Model\Message\Attachment;
6
7
class Image extends File
8
{
9
10
    /**
11
     * @var array
12
     */
13
    protected $allowedExtensions = ['jpg', 'png', 'gif'];
14
15
    /**
16
     * Image constructor.
17
     *
18
     * @param string $url
19
     * @param bool|null $reusable
20
     */
21 2
    public function __construct(string $url, bool $reusable = null)
22
    {
23 2
        $this->isValidExtension($url, $this->getAllowedExtensions());
24
25 2
        parent::__construct($url, $reusable, Attachment::TYPE_IMAGE);
26 2
    }
27
28
    /**
29
     * @return array
30
     */
31 2
    protected function getAllowedExtensions(): array
32
    {
33 2
        return $this->allowedExtensions;
34
    }
35
}
36