Advertisement
Guest User

Untitled

a guest
Apr 21st, 2015
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.89 KB | None | 0 0
  1. public function generate()
  2. {
  3.   $files = $this->getContentFrom($this->directoryInput, true);
  4.  
  5.   foreach($files as & $file)
  6.   {
  7.     if(in_array($file['extension'], $this->extensions))
  8.     {
  9.       $lines = file($file['path']);
  10.  
  11.       $file['lines'] = [];
  12.  
  13.       foreach($lines as $j => & $line)
  14.       {
  15.         $file['lines'][$j] = 0;
  16.  
  17.         for($i = 0; $i < 40; $i++)
  18.         {
  19.           if(isset($line[$i]) && $line[$i] == ' ')
  20.           {
  21.             $file['lines'][$j]++;
  22.           }
  23.           else
  24.           {
  25.             break;
  26.           }
  27.         }
  28.  
  29.         $a = floor($file['lines'][$j] / $this->spacesInput);
  30.        
  31.         if($a >= 1)
  32.         {
  33.           @$line = str_repeat(' ', $this->spacesOutput * $a).str_repeat(' ', $file['lines'][$j] - ($this->spacesInput * $a)).ltrim($line);
  34.         }
  35.       }
  36.  
  37.       var_dump($lines);
  38.     }
  39.   }
  40.  
  41.   var_dump($files);
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement