Example #1
0
 public function getDiff()
 {
     $fromFileFullPath = $this->_comparison->getMagentoVersion()->getBaseDir() . '/' . $this->getFileName();
     $toFileFullPath = $this->_comparison->getMagentoInstanceRootDirectory() . '/' . $this->getFileName();
     $context = $this->_comparison->getLinesOfContext();
     $lines = $this->_executeShellCommand(sprintf('LANG=en_US diff -U%s -w %s %s', $context, $fromFileFullPath, $toFileFullPath));
     foreach ($lines as &$line) {
         $comparisonItemLine = new \KJ\Magento\Util\Comparison\Item\Line($line);
         if ($comparisonItemLine->isAdditionLine()) {
             $line = "<info>" . $line . "</info>";
             $this->_numberOfDifferences++;
         }
         if ($comparisonItemLine->isRemovalLine()) {
             $line = "<comment>" . $line . "</comment>";
             $this->_numberOfDifferences++;
         }
     }
     return $lines;
 }
 public function getDiff()
 {
     if ($this->_diffResult !== null) {
         return $this->_diffResult;
     }
     $fromFileFullPath = $this->_getAbsoluteFilePathToCompareAgainst();
     $toFileFullPath = $this->_getAbsoluteFilePath();
     $context = $this->_comparison->getLinesOfContext();
     $additionalParameters = $this->_comparison->getAdditionalParameters();
     $lines = $this->_executeShellCommand(sprintf('diff -U%s %s -w %s %s', $context, $additionalParameters, $fromFileFullPath, $toFileFullPath));
     foreach ($lines as &$line) {
         $comparisonItemLine = new \KJ\Magento\Util\Comparison\Item\Line($line);
         if ($comparisonItemLine->isAdditionLine()) {
             $line = "<info>" . $line . "</info>";
             $this->_numberOfDifferences++;
         }
         if ($comparisonItemLine->isRemovalLine()) {
             $line = "<comment>" . $line . "</comment>";
             $this->_numberOfDifferences++;
         }
     }
     $this->_diffResult = $lines;
     return $lines;
 }