Completed
Push — master ( c60cf3...36f595 )
by Sebastien
07:49
created

HackedFileIgnoreEndingsHasher::fetchLines()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

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