Completed
Push — master ( 247b53...16b162 )
by Jeroen De
03:24
created

MwImage::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 3
c 0
b 0
f 0
ccs 0
cts 3
cp 0
rs 10
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
declare( strict_types = 1 );
4
5
namespace Maps\DataAccess;
6
7
use File;
8
9
class MwImage implements Image {
10
11
	private $file;
12
13
	public function __construct( File $file ) {
14
		$this->file = $file;
15
	}
16
17
	public function getUrl(): string {
18
		return $this->file->getUrl();
19
	}
20
21
	public function getWidthInPx(): int {
22
		$width = $this->file->getWidth();
23
		return $width === false ? 0 : $width;
24
	}
25
26
	public function getHeightInPx(): int {
27
		$height = $this->file->getHeight();
28
		return $height === false ? 0 : $height;
29
	}
30
31
}
32