PEAR2_Pyrus_Developer › PEAR2_Pyrus_Developer-0.4.0/php/PEAR2/Pyrus/Developer/PackageFile/PEAR2SVN/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
<?php
namespace PEAR2\Pyrus\Developer\PackageFile\PEAR2SVN;
class Filter extends \FilterIterator
{
protected $ignore;
protected $path;
protected $role;
function __construct(array $ignore, $path, $it, $role)
{
$this->ignore = $ignore;
$this->path = $path;
$this->role = $role;
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;
}
foreach ($this->ignore as $testpath => $type) {
if ($type == 'file') {
$test = $path;
} elseif ($type == 'dir') {
$test = dirname($path);
}
if (strpos($test, $testpath) !== false) {
return false;
}
}
switch($this->role) {
case 'test':
return $this->filterTestsDir();
}
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;
}
if ($info['extension'] == 'php'
&& file_exists($info['dirname'].DIRECTORY_SEPARATOR.$info['filename'].'.phpt')) {
// Assume this is the result of a failed .phpt test
return false;
}
return !in_array($info['extension'], $invalid_extensions);
}
}
EOF
