HackedFileIgnoreEndingsHasher::performHash()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 6
nc 2
nop 1
dl 0
loc 10
rs 9.4285
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