/usr/share/php/TheSeer/Autoload/PathComparator.php is in phpab 1.24.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | <?php
namespace TheSeer\Autoload {
class PathComparator {
/**
* @var string[]
*/
private $directories = array();
/**
* PathComparator constructor.
*
* @param array $directories
*/
public function __construct(array $directories) {
foreach($directories as $dir) {
$this->directories[] = realpath($dir).'/';
}
}
public function getCommonBase() {
if (count($this->directories) == 0) {
return '/';
}
$result = $this->directories[0];
foreach($this->directories as $dir) {
$result = substr($dir, 0, $this->commonPrefix($result, $dir));
}
return ($result ?: '/');
}
private function commonPrefix( $s1, $s2 ) {
$l1 = strlen($s1);
$l2 = strlen($s2);
$i=0;
while($i < $l1 && $i < $l2 && $s1[$i] == $s2[$i]) {
$i++;
}
return strrpos(substr($s1, 0, $i), '/');
}
}
}
|