MwImage::getHeightInPx()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
ccs 0
cts 4
cp 0
rs 10
cc 2
nc 2
nop 0
crap 6
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