- md5
- 10c7784ea51a461707929a250766b51a
- sha1
- 99508fc3cb2ad62eacf77fe4afc8ea67c5011b48
- sha256
- ed2e22c637c6d051ccfcb539c8c77bb27b45c991e05c252f5a1d800e56868331
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
<?php
declare(strict_types=1);
namespace Jfcherng\Diff\Renderer\Html\LineRenderer;
use Jfcherng\Diff\SequenceMatcher;
/**
* Base renderer for rendering HTML-based line diffs.
*/
abstract class AbstractLineRenderer implements LineRendererInterface
{
/**
* @var SequenceMatcher the sequence matcher
*/
protected $sequenceMatcher;
/**
* @var array the differ options
*/
protected $differOptions = [];
/**
* @var array the renderer options
*/
protected $rendererOptions = [];
/**
* The constructor.
*
* @param array $differOptions the differ options
* @param array $rendererOptions the renderer options
*/
public function __construct(array $differOptions, array $rendererOptions)
{
$this->sequenceMatcher = new SequenceMatcher([], []);
$this
->setDifferOptions($differOptions)
->setRendererOptions($rendererOptions);
}
/**
* Set the differ options.
*
* @param array $differOptions the differ options
*
* @return static
*/
public function setDifferOptions(array $differOptions): self
{
$this->differOptions = $differOptions;
$this->sequenceMatcher->setOptions($differOptions);
return $this;
}
/**
* Set the renderer options.
*
* @param array $rendererOptions the renderer options
*
* @return static
*/
public function setRendererOptions(array $rendererOptions): self
{
$this->rendererOptions = $rendererOptions;
return $this;
}
/**
* Gets the differ options.
*
* @return array the differ options
*/
public function getDifferOptions(): array
{
return $this->differOptions;
}
/**
* Gets the renderer options.
*
* @return array the renderer options
*/
public function getRendererOptions(): array
{
return $this->rendererOptions;
}
/**
* Get the changed extent segments.
*
* @param string[] $old the old array
* @param string[] $new the new array
*
* @return int[][] the changed extent segments
*/
protected function getChangedExtentSegments(array $old, array $new): array
{
return $this->sequenceMatcher->setSequences($old, $new)->getOpcodes();
}
}
The same content is in 56 releases, Joomla 4.3.0-alpha1 to 4.4.14. See them all, or every version of this file.