AbstractFile   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A close() 0 6 2
A __destruct() 0 4 1
1
<?php
2
3
namespace Maketok\DataMigration\Input;
4
5
abstract class AbstractFile implements InputResourceInterface
6
{
7
    /**
8
     * @var \SplFileObject
9
     */
10
    protected $descriptor;
11
12
    /**
13
     * @param string $fileName
14
     * @param string $mode
15
     */
16 12
    public function __construct($fileName, $mode = 'r')
17
    {
18 12
        $this->descriptor = new \SplFileObject($fileName, $mode);
19 12
    }
20
21
    /**
22
     * close file resource
23
     */
24 12
    public function close()
25
    {
26 12
        if (isset($this->descriptor)) {
27 12
            $this->descriptor = null;
28 12
        }
29 12
    }
30
31
    /**
32
     * clean internal pointer
33
     */
34 12
    public function __destruct()
35
    {
36 12
        $this->close();
37 12
    }
38
}
39