Sames as peek(), but clears the list of messages.

@param string $type type of messages to get
@return array messages to be displayed
550828
public function get($type = FALSE)
  {
    $result = $this->peek($type);
	
    $this->clear($type);
	
    return $result;
  }
968314
public function gatherElementsFromType( $type )
	{
		if ( is_string( $type ) )
		{
			$type = $this->getType( $type );
		}

		if ( ! is_array( $type ) ) return false;

		$elements = array();

		foreach ( array( 'elements', 'sequence', 'choice', 'group' ) as $typeComponent )
		{
			if ( ! isset( $type[ $typeComponent ] ) )
			{
				continue;
			}

			foreach ( $type[ $typeComponent ] as $id => $element )
			{
				if ( $id == 'restrictionType')
				{
					continue;
				}

				if ( $id == 'elements' )
				{
					$elements += $element;
					continue;
				}

				$result = $this->gatherElementsFromType( $element );
				if ( ! $result )
				{
					$elements[ "{$element['prefix']}:{$element['name']}" ] = $element;
				}

				$elements += $result;
			}

		}

		return $elements;
	}
318355
public function clear($type = null)
    {
        if (!$type) {
            $this->messages = [];
        } elseif (isset($this->messages[$type])) {
            unset($this->messages[$type]);
        }

        $this->writeToSession();
        return $this;
    }
94079
protected function getMessagesForRender($type = null)
    {
        if (is_null($type)) {
            if (count($this->groupForRender) > 0) {
                $messages = array();

                foreach ($this->groupForRender as $typeToRender) {
                    $messages = array_merge($messages, $this->get($typeToRender)->all());
                }

                return new Collection($messages);
            }

            return $this->all();
        }
        return $this->get($type);
    }
297300
public function get(string $type): array
    {
        if (!isset($this->values[$type])) {
            return [];
        }

        return $this->values[$type];
    }
1131638
public function hasType($type)
    {
        if ($type instanceof Type) {
            $type = $type->getName();
        }

        return \in_array($type, $this->_types);
    }
614613
private function resolveTypes($type)
    {
        $batchTypes = [];

        do {
            $batchTypes[] = $batchType = $this->batchRegistry[$type];
        } while (($type = $batchType->getParent()) !== null);

        return $batchTypes;
    }
206873
public function fetchAll($type = parent::FETCH_TYPE_NUM)
    {
        return array_map($this->_callback, $this->_statement->fetchAll($type));
    }
1137531
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;
    }
1037585
public function getPacket($type = [])
    {

        $packets = [];


        // We want an array of packets back
        if (is_array($type) && !empty($type)) {
            // Loop the packets
            foreach ($this->packets as $packet_type => $packet_data) {
                // We want this packet
                if (in_array($packet_type, $type)) {
                    $packets[$packet_type] = $packet_data;
                }
            }
        } elseif ($type == '!challenge') {
            // Loop the packets
            foreach ($this->packets as $packet_type => $packet_data) {
                // Dont want challenge packets
                if ($packet_type != self::PACKET_CHALLENGE) {
                    $packets[$packet_type] = $packet_data;
                }
            }
        } elseif (is_string($type)) {
            // Return specific packet type
            $packets = $this->packets[$type];
        } else {
            // Return all packets
            $packets = $this->packets;
        }

        // Return the packets
        return $packets;
    }
329256
private function getTypeList($type)
    {
        $typeList = [];

        $counter = 1;
        while ($type !== 0) {
            if (($type & $counter) !== 0) {
                $typeList[] = $counter;
            }
            $type &= ~$counter;
            $counter <<= 1;
        }
        if (0 === count($typeList)) {
            $typeList[] = HolidayType::OTHER;
        }

        return $typeList;
    }
1158502
protected function bareMessage($type)
	{
		$m = [
			'MessageType' => $type,
			'Event' => null,
			'RequestId' => null,
			'ReplyClientId' => null,
			'RequestClientId' => null,
			'Payload' => [],
			'Error' => null,
		];

		return (object) $m;
	}
700277
public function get_type( $type ) {
		$tokens = [];

		foreach ( $this->text as $index => $token ) {
			if ( $token->type === $type ) {
				$tokens[ $index ] = $token;
			}
		}

		return $tokens;
	}
1227816
public function get_chunks($type) {
        if (!isset($this->_chunks[$type]) || $this->_chunks[$type] === null)
            return null;

        $chunks = array ();

        foreach ($this->_chunks[$type] as $chunk) {
            if ($chunk['size'] > 0) {
                fseek($this->_fp, $chunk['offset'], SEEK_SET);
                $chunks[] = fread($this->_fp, $chunk['size']);
            } else {
                $chunks[] = '';
            }
        }

        return $chunks;
    }
797679
public static function getFilter(string $type): array
    {
        return isset(self::$filters[$type]) ? self::$filters[$type] : [];
    }
56789
public function clear($type)
    {
        if ($type == self::TYPE_ALL) {
            $indexes = $this->getAllIndexes();
        } else {
            $indexes = $this->getIndexes($type);
        }

        foreach ($indexes as $index) {
            $index->clear();
        }
    }
766750
public function output( $type = null )
	{
		$session = $this->_di->getService( "session" );

        /**
         * Get the messages from the session
         */
		$messages = $session->get( "__flash__" );

		/**
		 * If there are no messages to output -> exit early
		 */
        if ( $messages == null )
        {
        	return;
        }

        /**
         * If a type is specified -> implode and return the type messages
         */
        if ( isset($type) )
        {
            /**
             * Get the messages of the type
             */
        	$messages_type = implode( $messages[$type] );

            /**
             * Clear the type messages in the flash session
             */
        	$messages[$type] = array();

			$session->set( "__flash__", $messages );

    	    return $messages_type;
        }

        /**
         * Create a string with all messages
         */
        $all_messages_str = "";

        foreach ( $messages as $messages_type )
        {
        	$all_messages_str .= implode( $messages_type );
        }

        /**
         * When all the messages have been output -> clear all the messages in the flash session
         */
		$session->set( "__flash__", array() );

        return $all_messages_str;
	}