public function show(string $name, string $group = null, array $opts = []): int
    {
        $opts = array_merge([
            'type'   => '',
            'indent' => 2,
            'style'  => '',
        ], $opts);

        $type = $opts['type'];
        $pfxType = $type ? '_' . $type : '';

        $txt = '';
        $group = trim($group);
        $group = $group ?: self::DEFAULT_GROUP;
        $longKey = $group . '.' . $name . $pfxType;

        if (isset($this->fontContents[$longKey])) {
            $txt = $this->fontContents[$longKey];
        } elseif (isset($this->fonts[$group][$name])) {
            $font = sprintf($this->fonts[$group][$name], $pfxType);

            if (is_file($font)) {
                $txt = file_get_contents($font);
            }
        } elseif (isset($this->groups[$group])) {
            $font = $this->groups[$group] . $name . $pfxType . '.txt';

            if (\is_file($font)) {
                $txt = \file_get_contents($font);
            }
        }

        // var_dump($txt, $this);
        if ($txt) {
            return Console::write(ColorTag::wrap($txt, $opts['style']));
        }

        return 0;
    }
public function show(string $name, string $group = null, array $opts = []): int
    {
        $opts = array_merge([
            'type'   => '',
            'indent' => 2,
            'style'  => '',
        ], $opts);

        $type = $opts['type'];
        $pfxType = $type ? '_' . $type : '';

        $txt = '';
        $group = trim($group);
        $group = $group ?: self::DEFAULT_GROUP;
        $longKey = $group . '.' . $name . $pfxType;

        if (isset($this->fontContents[$longKey])) {
            $txt = $this->fontContents[$longKey];
        } elseif (isset($this->fonts[$group][$name])) {
            $font = sprintf($this->fonts[$group][$name], $pfxType);

            if (is_file($font)) {
                $txt = file_get_contents($font);
            }
        } elseif (isset($this->groups[$group])) {
            $font = $this->groups[$group] . $name . $pfxType . '.txt';

            if (\is_file($font)) {
                $txt = \file_get_contents($font);
            }
        }

        // var_dump($txt, $this);
        if ($txt) {
            return Console::write(ColorTag::wrap($txt, $opts['style']));
        }

        return 0;
    }
public function show ( string $ name , string $ group = null , array $ opts = [ ] ) : int { $ opts = array_merge ( [ 'type' => '' , 'indent' => 2 , 'style' => '' , ] , $ opts ) ; $ type = $ opts [ 'type' ] ; $ pfxType = $ type ? '_' . $ type : '' ; $ txt = '' ; $ group = trim ( $ group ) ; $ group = $ group ? : self :: DEFAULT_GROUP ; $ longKey = $ group . '.' . $ name . $ pfxType ; if ( isset ( $ this -> fontContents [ $ longKey ] ) ) { $ txt = $ this -> fontContents [ $ longKey ] ; } elseif ( isset ( $ this -> fonts [ $ group ] [ $ name ] ) ) { $ font = sprintf ( $ this -> fonts [ $ group ] [ $ name ] , $ pfxType ) ; if ( is_file ( $ font ) ) { $ txt = file_get_contents ( $ font ) ; } } elseif ( isset ( $ this -> groups [ $ group ] ) ) { $ font = $ this -> groups [ $ group ] . $ name . $ pfxType . '.txt' ; if ( \ is_file ( $ font ) ) { $ txt = \ file_get_contents ( $ font ) ; } } // var_dump($txt, $this); if ( $ txt ) { return Console :: write ( ColorTag :: wrap ( $ txt , $ opts [ 'style' ] ) ) ; } return 0 ; }
display the art font
@param string $name
@param string $group
@param array  $opts
contains:
- type => '', // 'italic'
- indent => 2,
- style => '', // 'info' 'error'
@return int
display the art font