private function filterAndDecode($str)
    {
        $ret = str_replace("\r", '', $str);
        $ret = preg_replace('/[^\x21-\xf5`\n]/', '`', $ret);
        if ($this->position === 0) {
            $matches = [];
            if (preg_match('/^\s*begin\s+[^\s+]\s+([^\r\n]+)\s*$/im', $ret, $matches)) {
                $this->filename = $matches[1];
            }
            $ret = preg_replace('/^\s*begin[^\r\n]+\s*$/im', '', $ret);
        } else {
            $ret = preg_replace('/^\s*end\s*$/im', '', $ret);
        }
        return convert_uudecode(trim($ret));
    }
private function filterAndDecode($str)
    {
        $ret = str_replace("\r", '', $str);
        $ret = preg_replace('/[^\x21-\xf5`\n]/', '`', $ret);
        if ($this->position === 0) {
            $matches = [];
            if (preg_match('/^\s*begin\s+[^\s+]\s+([^\r\n]+)\s*$/im', $ret, $matches)) {
                $this->filename = $matches[1];
            }
            $ret = preg_replace('/^\s*begin[^\r\n]+\s*$/im', '', $ret);
        } else {
            $ret = preg_replace('/^\s*end\s*$/im', '', $ret);
        }
        return convert_uudecode(trim($ret));
    }
private function filterAndDecode ( $ str ) { $ ret = str_replace ( "\r" , '' , $ str ) ; $ ret = preg_replace ( '/[^\x21-\xf5`\n]/' , '`' , $ ret ) ; if ( $ this -> position === 0 ) { $ matches = [ ] ; if ( preg_match ( '/^\s*begin\s+[^\s+]\s+([^\r\n]+)\s*$/im' , $ ret , $ matches ) ) { $ this -> filename = $ matches [ 1 ] ; } $ ret = preg_replace ( '/^\s*begin[^\r\n]+\s*$/im' , '' , $ ret ) ; } else { $ ret = preg_replace ( '/^\s*end\s*$/im' , '' , $ ret ) ; } return convert_uudecode ( trim ( $ ret ) ) ; }
Removes invalid characters from a uuencoded string, and 'BEGIN' and 'END'
line headers and footers from the passed string before returning it.

@param string $str
@return string
Removes invalid characters from a uuencoded string and BEGIN and END line headers and footers from the passed string before returning it .