private function _getAllPhpFiles($src, $excludes, $dir = '') {
		$files = array();
		if (!is_dir($src)) {

			// Source is a file
			$isExcluded = false;
			foreach ($excludes as $patternExcluded) {
				if (strstr($src, $patternExcluded)) {
					$isExcluded = true;
				}
			}
			if (!$isExcluded) {
				$files[] = $src;
			}
		} else {
			// Source is a directory
			$root = opendir($src);
			if ($root) {
				while ($file = readdir($root)) {
					if ($this->_inArray($file, $this->ignoredFiles)) {
						continue;
					}

					$fullPath = $src . "/" . $file;
					$isExcluded = false;
					foreach ($excludes as $patternExcluded) {
						if (strstr($fullPath, $patternExcluded)) {
							$isExcluded = true;
						}
					}

					if (!$isExcluded) {
						if (is_dir($src . "/" . $file)) {
							$filesToMerge = $this->_getAllPhpFiles($src . "/" . $file, $excludes, $dir . '/' . $file);
							$files = array_merge($files, $filesToMerge);
						} else {
							$pathParts = pathinfo($file);
							if (array_key_exists('extension', $pathParts)) {
								if (in_array($pathParts['extension'], $this->validExtensions)) {
									$files[] = realpath($src . "/" . $file);
								}
							}
						}
					}
				}
			}
		}

		return $files;
	}
private function _getAllPhpFiles($src, $excludes, $dir = '') {
		$files = array();
		if (!is_dir($src)) {

			// Source is a file
			$isExcluded = false;
			foreach ($excludes as $patternExcluded) {
				if (strstr($src, $patternExcluded)) {
					$isExcluded = true;
				}
			}
			if (!$isExcluded) {
				$files[] = $src;
			}
		} else {
			// Source is a directory
			$root = opendir($src);
			if ($root) {
				while ($file = readdir($root)) {
					if ($this->_inArray($file, $this->ignoredFiles)) {
						continue;
					}

					$fullPath = $src . "/" . $file;
					$isExcluded = false;
					foreach ($excludes as $patternExcluded) {
						if (strstr($fullPath, $patternExcluded)) {
							$isExcluded = true;
						}
					}

					if (!$isExcluded) {
						if (is_dir($src . "/" . $file)) {
							$filesToMerge = $this->_getAllPhpFiles($src . "/" . $file, $excludes, $dir . '/' . $file);
							$files = array_merge($files, $filesToMerge);
						} else {
							$pathParts = pathinfo($file);
							if (array_key_exists('extension', $pathParts)) {
								if (in_array($pathParts['extension'], $this->validExtensions)) {
									$files[] = realpath($src . "/" . $file);
								}
							}
						}
					}
				}
			}
		}

		return $files;
	}
private function _getAllPhpFiles ( $ src , $ excludes , $ dir = '' ) { $ files = array ( ) ; if ( ! is_dir ( $ src ) ) { // Source is a file $ isExcluded = false ; foreach ( $ excludes as $ patternExcluded ) { if ( strstr ( $ src , $ patternExcluded ) ) { $ isExcluded = true ; } } if ( ! $ isExcluded ) { $ files [ ] = $ src ; } } else { // Source is a directory $ root = opendir ( $ src ) ; if ( $ root ) { while ( $ file = readdir ( $ root ) ) { if ( $ this -> _inArray ( $ file , $ this -> ignoredFiles ) ) { continue ; } $ fullPath = $ src . "/" . $ file ; $ isExcluded = false ; foreach ( $ excludes as $ patternExcluded ) { if ( strstr ( $ fullPath , $ patternExcluded ) ) { $ isExcluded = true ; } } if ( ! $ isExcluded ) { if ( is_dir ( $ src . "/" . $ file ) ) { $ filesToMerge = $ this -> _getAllPhpFiles ( $ src . "/" . $ file , $ excludes , $ dir . '/' . $ file ) ; $ files = array_merge ( $ files , $ filesToMerge ) ; } else { $ pathParts = pathinfo ( $ file ) ; if ( array_key_exists ( 'extension' , $ pathParts ) ) { if ( in_array ( $ pathParts [ 'extension' ] , $ this -> validExtensions ) ) { $ files [ ] = realpath ( $ src . "/" . $ file ) ; } } } } } } } return $ files ; }
Go through a directory recursively and get all the
PHP files.
Ignores files or subdirectories that are in the _excludeList

@param String $src
source directory
@param Array[String] $excludes
paths to exclude
@param String $dir
the base directory
@return Array[String] an array of php files
Go through a directory recursively and get all the PHP files . Ignores files or subdirectories that are in the _excludeList