modified AutoloadBuilder for test exclusion
This commit is contained in:
@ -17,14 +17,17 @@
|
||||
class AutoloadBuilder
|
||||
{
|
||||
protected $autoload;
|
||||
|
||||
protected $dirs;
|
||||
|
||||
protected $handler;
|
||||
|
||||
protected $regex = '/(class|interface) ([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)/';
|
||||
|
||||
public function __construct($autoload, $dirs = array())
|
||||
{
|
||||
$this->autoload = $autoload;
|
||||
$this->dirs = $dirs;
|
||||
$this->dirs = $dirs;
|
||||
}
|
||||
|
||||
public function build()
|
||||
@ -41,9 +44,9 @@ class AutoloadBuilder
|
||||
foreach ($iterator as $file) {
|
||||
// skip non php files
|
||||
$e = explode('.', $file->getFileName());
|
||||
if ((end($e) !== 'php') || strstr($file->getFileName(), 'test')) {
|
||||
continue;
|
||||
}
|
||||
if ((end($e) !== 'php') || $this->rightSubstr($file->getFileName(), 8) == 'Test.php') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$content = file_get_contents($file->getRealPath());
|
||||
$matches = array();
|
||||
@ -79,11 +82,17 @@ class AutoloadBuilder
|
||||
|
||||
protected function write($string)
|
||||
{
|
||||
if (! $this->handler) {
|
||||
if (! $this->handler = fopen($this->autoload, 'w')) {
|
||||
if (!$this->handler) {
|
||||
if (!$this->handler = fopen($this->autoload, 'w')) {
|
||||
trigger_error("{$this->autoload} is not writable", E_USER_ERROR);
|
||||
}
|
||||
}
|
||||
return (bool) fwrite($this->handler, $string);
|
||||
}
|
||||
|
||||
protected function rightSubstr($string, $nchars)
|
||||
{
|
||||
$right = substr($string, strlen($string) - $nchars, $nchars);
|
||||
return $right;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user