mirror of
https://github.com/Icinga/icingaweb2-module-businessprocess.git
synced 2025-12-20 23:00:16 -05:00
41 lines
790 B
PHP
41 lines
790 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace Icinga\Module\Businessprocess;
|
||
|
|
|
||
|
|
use FineDiff;
|
||
|
|
|
||
|
|
class ConfigDiff
|
||
|
|
{
|
||
|
|
protected $a;
|
||
|
|
|
||
|
|
protected $b;
|
||
|
|
|
||
|
|
protected $diff;
|
||
|
|
protected $opcodes;
|
||
|
|
|
||
|
|
protected function __construct($a, $b)
|
||
|
|
{
|
||
|
|
$this->a = $a;
|
||
|
|
$this->b = $b;
|
||
|
|
require_once dirname(__DIR__) . '/vendor/PHP-FineDiff/finediff.php';
|
||
|
|
$granularity = FineDiff::$paragraphGranularity; // character, word, sentence, paragraph
|
||
|
|
$this->diff = new FineDiff($a, $b, $granularity);
|
||
|
|
}
|
||
|
|
|
||
|
|
public function renderHtml()
|
||
|
|
{
|
||
|
|
return $this->diff->renderDiffToHTML();
|
||
|
|
}
|
||
|
|
|
||
|
|
public function __toString()
|
||
|
|
{
|
||
|
|
return $this->renderHtml();
|
||
|
|
}
|
||
|
|
|
||
|
|
public static function create($a, $b)
|
||
|
|
{
|
||
|
|
$diff = new static($a, $b);
|
||
|
|
return $diff;
|
||
|
|
}
|
||
|
|
}
|