public function get($index = 0)
    {

        if (is_int($index)) {
            if ($index + 1 > $this->count()) {
                return null;
            } else {
                return current(array_slice($this->_items, $index, 1));
            }
        } else {

            if ($index instanceof \MongoId) {
                $index = (string) $index;
            }

            if ($this->has($index)) {
                return $this->_items[$index];
            }
        }

        return null;
    }
public function get($index = 0)
    {

        if (is_int($index)) {
            if ($index + 1 > $this->count()) {
                return null;
            } else {
                return current(array_slice($this->_items, $index, 1));
            }
        } else {

            if ($index instanceof \MongoId) {
                $index = (string) $index;
            }

            if ($this->has($index)) {
                return $this->_items[$index];
            }
        }

        return null;
    }
public function get ( $ index = 0 ) { if ( is_int ( $ index ) ) { if ( $ index + 1 > $ this -> count ( ) ) { return null ; } else { return current ( array_slice ( $ this -> _items , $ index , 1 ) ) ; } } else { if ( $ index instanceof \ MongoId ) { $ index = ( string ) $ index ; } if ( $ this -> has ( $ index ) ) { return $ this -> _items [ $ index ] ; } } return null ; }
Get item by numeric index or MongoId

@param int $index model to get

@return \Purekid\Mongodm\Model
Get item by numeric index or MongoId