for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php namespace Mbh\Collection;
/**
* MBHFramework
*
* @link https://github.com/MBHFramework/mbh-framework
* @copyright Copyright (c) 2017 Ulises Jeremias Cornejo Fandos
* @license https://github.com/MBHFramework/mbh-framework/blob/master/LICENSE (MIT License)
*/
use Mbh\Collection\Interfaces\Collection as CollectionInterface;
use Mbh\Collection\Interfaces\Sequenceable as SequenceableInterface;
use Mbh\Collection\CallbackHeap;
use Mbh\Iterator\SliceIterator;
use Mbh\Iterator\ConcatIterator;
use SplFixedArray;
use SplHeap;
use SplStack;
use LimitIterator;
use Iterator;
use ArrayAccess;
use Countable;
use CallbackFilterIterator;
use JsonSerializable;
use RuntimeException;
use Traversable;
use ReflectionClass;
* The Fixed Array
* A FixedArray is a sequence of values in a contiguous buffer that grows and
* shrinks automatically. It’s the most efficient sequential structure because
* a value’s index is a direct mapping to its index in the buffer, and the
* growth factor isn't bound to a specific multiple or exponent.
* @package structures
* @author Ulises Jeremias Cornejo Fandos <[email protected]>
class FixedArray implements SequenceableInterface
{
use Traits\Collection;
use Traits\Sequenceable;
use Traits\Functional;
use Traits\Capacity;
const MIN_CAPACITY = 8;
* @inheritDoc
protected function getGrowthFactor(): float
return 1.5;
}
protected function shouldIncreaseCapacity(): bool
return count($this) > $this->capacity;