HackedFileIgnoreEndingsHasher   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 25
rs 10
c 0
b 0
f 0
wmc 3
lcom 0
cbo 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A performHash() 0 10 2
A fetchLines() 0 4 1
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