src/Datastructure/Stackqueue/CircularBuffer.php
public function enqueue($data): bool {
        if (null === $data) {
            return false;
        }
        if ($this->isFull()) {
            return false;
        }
        $this->head = $this->head % $this->size;
        $this->elements[$this->head] = $data;
        $this->head++;
        return true;
    }
public function enqueue($data): bool {
        if (null === $data) {
            return false;
        }
        if ($this->isFull()) {
            return false;
        }
        $this->head = $this->head % $this->size;
        $this->elements[$this->head] = $data;
        $this->head++;
        return true;
    }
public function enqueue ( $ data ) : bool { if ( null === $ data ) { return false ; } if ( $ this -> isFull ( ) ) { return false ; } $ this -> head = $ this -> head % $ this -> size ; $ this -> elements [ $ this -> head ] = $ data ; $ this -> head ++ ; return true ; }
enqueues a data at the head of the circular buffer.
If the buffer is full, the method will insert the
data at the "beginning" without warning.

important notice: this method wastes one slot in order to differentiate
between full and empty.

This wasting is not necessary, but requires an addition boolean flag which
(in my mind) uglifies the code.

@param $data
@return bool
enqueues a data at the head of the circular buffer . If the buffer is full the method will insert the data at the beginning without warning .