Version 1
[yaffs-website] / web / modules / contrib / hacked / src / hackedFileIgnoreEndingsHasher.php
1 <?php
2
3 /**
4  * @file
5  * Contains \Drupal\hacked\hackedFileIgnoreEndingsHasher.
6  */
7
8 namespace Drupal\hacked;
9
10 /**
11  * Class hackedFileIgnoreEndingsHasher
12  * @package Drupal\hacked
13  */
14 class hackedFileIgnoreEndingsHasher extends hackedFileHasher {
15   /**
16    * Returns a hash of the given filename.
17    *
18    * Ignores file line endings.
19    */
20   function perform_hash($filename) {
21     if (!hacked_file_is_binary($filename)) {
22       $file = file($filename, FILE_IGNORE_NEW_LINES);
23       return sha1(serialize($file));
24     }
25     else {
26       return sha1_file($filename);
27     }
28   }
29
30   function fetch_lines($filename) {
31     return file($filename, FILE_IGNORE_NEW_LINES);
32   }
33 }