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

AbstractGeoTIFFProvider::openResource()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 2
Bugs 0 Features 1
Metric Value
c 2
b 0
f 1
dl 0
loc 7
ccs 5
cts 5
cp 1
rs 9.4285
cc 1
eloc 4
nc 1
nop 1
crap 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