HackedFileIgnoreEndingsHasher::fetchLines()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Cerbere\Model\Hacked;
4
5
class HackedFileIgnoreEndingsHasher extends HackedFileHasher
6
{
7
    /**
8
     * Ignores file line endings.
9
     * @inheritdoc
10
     */
11
    public function performHash($filename)
12
    {
13
        if (!HackedFileGroup::isBinary($filename)) {
14
            $file = file($filename, FILE_IGNORE_NEW_LINES);
15
16
            return sha1(serialize($file));
17
        } else {
18
            return sha1_file($filename);
19
        }
20
    }
21
22
    /**
23
     * @inheritdoc
24
     */
25
    public function fetchLines($filename)
26
    {
27
        return file($filename, FILE_IGNORE_NEW_LINES);
28
    }
29
}
30