PHP library providing SortedLinkedList (linked list that keeps values sorted). SortedLinkedList can hold string or int values, but not both together.
composer require novak-ji/sorted-linked-list
<?php
use Novakji\SortedLinkedList\Node\NodeFactory;
use Novakji\SortedLinkedList\SortedLinkedList;
$nodeFactory = new NodeFactory();
$sortedLinkedList = new SortedLinkedList($nodeFactory);
$sortedLinkedList->insertValue('beta'); //beta
$sortedLinkedList->insertValue('alfa'); //alfa -> beta
$sortedLinkedList->insertValue('aaa'); //aaa -> alfa -> beta
$sortedLinkedList->removeValue('alfa'); //aaa -> beta
$sortedLinkedList->hasValue('aaa'); //true
$sortedLinkedList->hasValue('alfa'); //falseSortedLinkedList implementing Iterator and Countable interfaces
<?php
$sortedLinkedList->count(); //int
/** @var string|int $value */
foreach ($sortedLinkedList as $value) {
}PHP Linter
composer phplintPHP_CodeSniffer
composer phpcscomposer phpcbfPHPStan
composer phpstanPHPUnit - unit tests
composer test-unitRun all checks
composer check