Completed
Pull Request — master (#3)
by Hannes
02:16
created

AbstractGeoTIFFProvider   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A openResource() 0 9 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
    protected function openResource($filename)
23
    {
24
        $resource = fopen($this->PathToFiles.DIRECTORY_SEPARATOR.$filename, 'rb');
25
26
        $this->ResourceReader->setResource($resource);
27
        $this->ResourceReader->readHeader();
28
29
        $this->CurrentFilename = $filename;
30
    }
31
32
    /**
33
     * @param  int      $row
34
     * @param  int      $col
35
     * @return int|bool
36
     */
37
    protected function getElevationFor($row, $col)
38
    {
39
        return $this->ResourceReader->getElevationFor($row, $col);
40
    }
41
}
42