Code Duplication    Length = 5-7 lines in 2 locations

src/Yacc/Macro/DollarExpansion.php 2 locations

@@ 144-148 (lines=5) @@
141
    protected function parseDollar(Context $ctx, Token $token, int $nth, int $len, string $type = null): array
142
    {
143
        if ($token->getValue() === '$') {
144
            if ($type) {
145
                $mp = $ctx->macros[self::SEMVAL_LHS_TYPED];
146
            } else {
147
                $mp = $ctx->macros[self::SEMVAL_LHS_UNTYPED];
148
            }
149
        } else {
150
            if ($type) {
151
                $mp = $ctx->macros[self::SEMVAL_RHS_TYPED];
@@ 149-155 (lines=7) @@
146
            } else {
147
                $mp = $ctx->macros[self::SEMVAL_LHS_UNTYPED];
148
            }
149
        } else {
150
            if ($type) {
151
                $mp = $ctx->macros[self::SEMVAL_RHS_TYPED];
152
            } else {
153
                $mp = $ctx->macros[self::SEMVAL_RHS_UNTYPED];
154
            }
155
        }
156
157
        $result = '';
158
        for ($i = 0; $i < \mb_strlen($mp); $i++) {