public function search(array $criterias = array(), $limit = null)
    {
        $messages = array();

        foreach ($this->request('GET') as $message) {
            if (isset($this->messages[$message['id']])) {
                $messages[] = $this->messages[$message['id']];
            } else {
                $messages[] = $this->messages[$message['id']] = new Message($this, $message);
            }
        }

        $result = array();
        foreach ($messages as $message) {
            if (null !== $limit && count($result) >= $limit) {
                break;
            }
            if ($message->match($criterias)) {
                $result[] = $message;
            }
        }

        return $result;
    }
public function search(array $criterias = array(), $limit = null)
    {
        $messages = array();

        foreach ($this->request('GET') as $message) {
            if (isset($this->messages[$message['id']])) {
                $messages[] = $this->messages[$message['id']];
            } else {
                $messages[] = $this->messages[$message['id']] = new Message($this, $message);
            }
        }

        $result = array();
        foreach ($messages as $message) {
            if (null !== $limit && count($result) >= $limit) {
                break;
            }
            if ($message->match($criterias)) {
                $result[] = $message;
            }
        }

        return $result;
    }
public function search ( array $ criterias = array ( ) , $ limit = null ) { $ messages = array ( ) ; foreach ( $ this -> request ( 'GET' ) as $ message ) { if ( isset ( $ this -> messages [ $ message [ 'id' ] ] ) ) { $ messages [ ] = $ this -> messages [ $ message [ 'id' ] ] ; } else { $ messages [ ] = $ this -> messages [ $ message [ 'id' ] ] = new Message ( $ this , $ message ) ; } } $ result = array ( ) ; foreach ( $ messages as $ message ) { if ( null !== $ limit && count ( $ result ) >= $ limit ) { break ; } if ( $ message -> match ( $ criterias ) ) { $ result [ ] = $ message ; } } return $ result ; }
Searches for messages on the server.

See method `Method::match` for more informations on criterias.

@param array $criterias an array of criterias
@param int   $limit     maximum number of elements to fetch. Null means no limit

@return array a list of messages
Searches for messages on the server .