phug-php/phug

View on GitHub
src/Phug/Lexer/Lexer/Scanner/TextBlockScanner.php

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
<?php

/**
 * Call SubScanner and filter indent/outdent tokens.
 */

namespace Phug\Lexer\Scanner;

use Phug\Lexer\ScannerInterface;
use Phug\Lexer\State;
use Phug\Lexer\Token\IndentToken;
use Phug\Lexer\Token\OutdentToken;

class TextBlockScanner implements ScannerInterface
{
    public function scan(State $state)
    {
        foreach ($state->scan(SubScanner::class) as $token) {
            if ($token instanceof IndentToken || $token instanceof OutdentToken) {
                continue;
            }

            yield $token;
        }
    }
}