public function attr($attr = null, $to_str = false)
    {
        $k = key($this->ids);
        if (null === $k) {
            reset($this->ids);
            $k = key($this->ids);
        }
        return isset($k) ? $this->doc()->get_attr_byId($k, $attr, $to_str) : null;
    }
public function attr($attr = null, $to_str = false)
    {
        $k = key($this->ids);
        if (null === $k) {
            reset($this->ids);
            $k = key($this->ids);
        }
        return isset($k) ? $this->doc()->get_attr_byId($k, $attr, $to_str) : null;
    }
public function attr ( $ attr = null , $ to_str = false ) { $ k = key ( $ this -> ids ) ; if ( null === $ k ) { reset ( $ this -> ids ) ; $ k = key ( $ this -> ids ) ; } return isset ( $ k ) ? $ this -> doc ( ) -> get_attr_byId ( $ k , $ attr , $ to_str ) : null ; }
Get and attribute or all attributes of first element in the collection.

@param  string       $attr   attribute name, or NULL to get all
@param  boolean      $to_str When $attr is NULL, if true, get the list of attributes as string
@return array|string If no $attr, return a list of attributes, or attribute's value otherwise.
Get and attribute or all attributes of first element in the collection .