public function get($type = null)
    {
        $result = [];

        foreach ($this->session[$this->prefix] as $offset => $message) {
            if ($type === null || $message['type'] === $type) {
                $result[] = $message;
                unset($this->session[$this->prefix][$offset]);
            }
        }

        return $result;
    }
public function get($type = null)
    {
        $result = [];

        foreach ($this->session[$this->prefix] as $offset => $message) {
            if ($type === null || $message['type'] === $type) {
                $result[] = $message;
                unset($this->session[$this->prefix][$offset]);
            }
        }

        return $result;
    }
public function get ( $ type = null ) { $ result = [ ] ; foreach ( $ this -> session [ $ this -> prefix ] as $ offset => $ message ) { if ( $ type === null || $ message [ 'type' ] === $ type ) { $ result [ ] = $ message ; unset ( $ this -> session [ $ this -> prefix ] [ $ offset ] ) ; } } return $ result ; }
Returns array containing messages of set type

@param null|string $type

@return array
Returns array containing messages of set type