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

Image   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 29
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getAllowedExtensions() 0 4 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