public function toArray(): array
    {
        /* Enable extraction of data and priority */
        $this->setExtractFlags(self::EXTR_BOTH);

        /* Prepare output */
        $data = [];

        /* Iterate yourself */
        foreach ($this as $item) {
            $data[] = $item;
        }

        return $data;
    }
public function toArray(): array
    {
        /* Enable extraction of data and priority */
        $this->setExtractFlags(self::EXTR_BOTH);

        /* Prepare output */
        $data = [];

        /* Iterate yourself */
        foreach ($this as $item) {
            $data[] = $item;
        }

        return $data;
    }
public function toArray ( ) : array { /* Enable extraction of data and priority */ $ this -> setExtractFlags ( self :: EXTR_BOTH ) ; /* Prepare output */ $ data = [ ] ; /* Iterate yourself */ foreach ( $ this as $ item ) { $ data [ ] = $ item ; } return $ data ; }
Iterates the queue and returns an array containing each item with
the data and priority set.

@return array The array representation of the queue
Iterates the queue and returns an array containing each item with the data and priority set .