PEAR2_Pyrus_Developer › PEAR2_Pyrus_Developer-0.4.0/php/PEAR2/Pyrus/Developer/PackageFile/PECL/Filter.php
- PEAR2_Pyrus_Developer-0.4.0/
- customcommand/
- pear2.php.net/
- PEAR2_Pyrus_Developer/
- pear2.php.net/
- data/
- pear2.php.net/
- PEAR2_Pyrus_Developer/
- pear2.php.net/
- php/
- PEAR2/
- Autoload.php
- Exception.php
- MultiErrors/
- MultiErrors.php
- Pyrus/
- Developer/
- CoverageAnalyzer/
- Creator/
- PackageFile/
- Runphpt/
- Developer/
- PEAR2/
- www/
- pear2.php.net/
- PEAR2_Pyrus_Developer/
- pear2.php.net/
- customcommand/
- package.xml
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<?php
namespace PEAR2\Pyrus\Developer\PackageFile\PECL;
class Filter extends \FilterIterator
{
protected $path;
protected $role;
function __construct($path, $it)
{
$this->path = $path;
parent::__construct($it);
}
public function accept()
{
if ($this->getInnerIterator()->isDot()) {
return false;
}
$path = str_replace('\\', '/', $this->path);
$path = str_replace($path, '', $this->getInnerIterator()->current()->getPathName());
if ($path && $path[0] === DIRECTORY_SEPARATOR) {
$path = substr($path, 1);
}
if (preg_match('@/?\.svn/@', $path)) {
return false;
}
if (preg_match('@/?\.cvsignore/@', $path)) {
return false;
}
if (preg_match('@/?CVS/@', $path)) {
return false;
}
if (preg_match('@\.tgz/@', $path)) {
return false;
}
if (preg_match('@\.tar/@', $path)) {
return false;
}
if (!$this->filterTestsDir()) {
return false;
}
return $this->filterByCvsIgnore();
}
function filterByCvsIgnore()
{
static $cvsignorematches = array();
$cvsignore = dirname($this->getInnerIterator()->current()->getPathName()) . '/.cvsignore';
if (!file_exists($cvsignore)) {
return true;
}
if (isset($cvsignorematches[$cvsignore])) {
$tests = $cvsignorematches[$cvsignore];
} else {
$tests = array();
foreach (new \SplFileObject($cvsignore) as $line) {
if (!$line) {
continue;
}
$line = preg_quote($line, '@');
$tests[] = str_replace(array('\\*', '\\?'), array('.*', '.'), $line);
}
}
$path = $this->getInnerIterator()->current()->getPathName();
foreach ($tests as $ignore) {
if (preg_match("@/?$ignore@", $path)) {
return false;
}
}
return true;
}
function filterTestsDir()
{
if ($this->getInnerIterator()->current()->getBasename() == 'pear2coverage.db') {
return false;
}
$invalid_extensions = array('diff','exp','log','out', 'xdebug');
$info = pathinfo($this->getInnerIterator()->current()->getPathName());
if (!isset($info['extension'])) {
return true;
}
return !in_array($info['extension'], $invalid_extensions);
}
}
EOF
