final public function output(string $name = null)
    {
        $result = implode(static::EOL, $this->registries) . static::EOL
            . static::EOF;

        if ($name === null) {
            return $result;
        }

        Utils::checkOutput(pathinfo($name)['extension'] ?? '');

        header('Content-Type: text/plain');
        header('Content-Length: ' . strlen($result));
        header('Content-Disposition: attachment; filename="' . $name . '"');
        echo $result;
    }
final public function output(string $name = null)
    {
        $result = implode(static::EOL, $this->registries) . static::EOL
            . static::EOF;

        if ($name === null) {
            return $result;
        }

        Utils::checkOutput(pathinfo($name)['extension'] ?? '');

        header('Content-Type: text/plain');
        header('Content-Length: ' . strlen($result));
        header('Content-Disposition: attachment; filename="' . $name . '"');
        echo $result;
    }
final public function output ( string $ name = null ) { $ result = implode ( static :: EOL , $ this -> registries ) . static :: EOL . static :: EOF ; if ( $ name === null ) { return $ result ; } Utils :: checkOutput ( pathinfo ( $ name ) [ 'extension' ] ?? '' ) ; header ( 'Content-Type: text/plain' ) ; header ( 'Content-Length: ' . strlen ( $ result ) ) ; header ( 'Content-Disposition: attachment; filename="' . $ name . '"' ) ; echo $ result ; }
Outputs the file contents in a multiline string

@param string $name File name

@return string If no name is passed
@return null   If a name is passed (result is printed with header)
Outputs the file contents in a multiline string