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

MwImage   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 0%

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getUrl() 0 3 1
A getWidthInPx() 0 4 2
A getHeightInPx() 0 4 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