src/helpers/NumberHelper.php
public static function word(int $num): string
    {
        $numberWordMap = [
            1 => Yii::t('yuncms', 'One'),
            2 => Yii::t('yuncms', 'Two'),
            3 => Yii::t('yuncms', 'Three'),
            4 => Yii::t('yuncms', 'Four'),
            5 => Yii::t('yuncms', 'Five'),
            6 => Yii::t('yuncms', 'Six'),
            7 => Yii::t('yuncms', 'Seven'),
            8 => Yii::t('yuncms', 'Eight'),
            9 => Yii::t('yuncms', 'Nine')
        ];

        if (isset($numberWordMap[$num])) {
            return $numberWordMap[$num];
        }

        return (string)$num;
    }
public static function word(int $num): string
    {
        $numberWordMap = [
            1 => Yii::t('yuncms', 'One'),
            2 => Yii::t('yuncms', 'Two'),
            3 => Yii::t('yuncms', 'Three'),
            4 => Yii::t('yuncms', 'Four'),
            5 => Yii::t('yuncms', 'Five'),
            6 => Yii::t('yuncms', 'Six'),
            7 => Yii::t('yuncms', 'Seven'),
            8 => Yii::t('yuncms', 'Eight'),
            9 => Yii::t('yuncms', 'Nine')
        ];

        if (isset($numberWordMap[$num])) {
            return $numberWordMap[$num];
        }

        return (string)$num;
    }
public static function word ( int $ num ) : string { $ numberWordMap = [ 1 => Yii :: t ( 'yuncms' , 'One' ) , 2 => Yii :: t ( 'yuncms' , 'Two' ) , 3 => Yii :: t ( 'yuncms' , 'Three' ) , 4 => Yii :: t ( 'yuncms' , 'Four' ) , 5 => Yii :: t ( 'yuncms' , 'Five' ) , 6 => Yii :: t ( 'yuncms' , 'Six' ) , 7 => Yii :: t ( 'yuncms' , 'Seven' ) , 8 => Yii :: t ( 'yuncms' , 'Eight' ) , 9 => Yii :: t ( 'yuncms' , 'Nine' ) ] ; if ( isset ( $ numberWordMap [ $ num ] ) ) { return $ numberWordMap [ $ num ] ; } return ( string ) $ num ; }
Returns the "word" version of a number

@param int $num The number

@return string The number word, or the original number if it's >= 10
Returns the word version of a number