public static function match($dir, $ext, $match, $returnMatch = false)
 {
     if (!isset(self::$listOfFiles)) {
         self::$listOfFiles = self::read($dir, $ext);
     }
     $result = array();
     foreach (self::$listOfFiles as $file) {
         if (is_readable($file)) {
             $handle = fopen($file, 'r');
             if ($handle) {
                 $result[$file] = array();
                 $i = 0;
                 while (false !== ($buffer = fgets($handle, 4096))) {
                     $i++;
                     $buffer = trim($buffer);
                     $m = array();
                     if (preg_match('/' . $match . '/', $buffer, $m)) {
                         if (!$returnMatch) {
                             $result[$file][$i] = $buffer;
                         } else {
                             $result[$file][$i] = $m;
                         }
                     }
                 }
                 if (count($result[$file]) < 1) {
                     unset($result[$file]);
                 }
                 fclose($handle);
             }
         }
     }
     return $result;
 }
Beispiel #2
0
 private function _ouputBody($directory)
 {
     $result = '<body>' . PHP_EOL;
     echo $result;
     $data = MapClassesSearch::classesCalls($directory);
     $this->_outputScript($data);
 }