Completed
Push — master ( f12f85...ac41f4 )
by Hannes
02:45
created

AbstractGeoTIFFProvider   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 2
c 2
b 0
f 1
lcom 1
cbo 2
dl 0
loc 24
ccs 7
cts 7
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A openResource() 0 7 1
A getElevationFor() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of the Runalyze DEM Reader.
5
 *
6
 * (c) RUNALYZE <[email protected]>
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace Runalyze\DEM\Provider\GeoTIFF;
13
14
use Runalyze\DEM\Provider\AbstractFileProvider;
15
16
abstract class AbstractGeoTIFFProvider extends AbstractFileProvider
17
{
18
    /**
19
     * @param  string            $filename
20
     * @throws \RuntimeException
21
     */
22 6
    protected function openResource($filename)
23
    {
24 6
        $this->ResourceReader->setResource(fopen($this->PathToFiles.DIRECTORY_SEPARATOR.$filename, 'rb'));
25 6
        $this->ResourceReader->readHeader();
26
27 6
        $this->CurrentFilename = $filename;
28 6
    }
29
30
    /**
31
     * @param  int      $row
32
     * @param  int      $col
33
     * @return int|bool
34
     */
35 6
    protected function getElevationFor($row, $col)
36
    {
37 6
        return $this->ResourceReader->getElevationFor($row, $col);
38
    }
39
}
40