コード例 #1
0
 private function getUnindentedSelectedCode()
 {
     $detector = new IndentationDetector($this->selectedCode);
     $lines = array_map(function ($line) use($detector) {
         return substr($line, $detector->getMinIndentation());
     }, iterator_to_array(new ToStringIterator($this->selectedCode->getIterator())));
     return LineCollection::createFromArray($lines);
 }
 /**
  * @param string[] $lines
  *
  * @return string
  */
 private function getIndent(array $lines)
 {
     $detector = new IndentationDetector(LineCollection::createFromArray($lines));
     return str_repeat(' ', $detector->getFirstLineIndentation());
 }