HippoPHP\Hippo\Checks\Line\ClosingTagCheck::checkFileInternal PHP Method

checkFileInternal() protected method

checkFileInternal(): defined by AbstractCheck.
See also: AbstractCheck::checkFileInternal()
protected checkFileInternal ( CheckContext $checkContext, Config $config )
$checkContext HippoPHP\Hippo\CheckContext
$config HippoPHP\Hippo\Config\Config
    protected function checkFileInternal(CheckContext $checkContext, Config $config)
    {
        $file = $checkContext->getFile();
        $tokens = $checkContext->getTokenList();
        $endToken = $tokens->end()->current();
        if (count($file) > 0) {
            if ($config->get('endwith') && !$endToken->isType(T_CLOSE_TAG)) {
                $this->addViolation($file, $endToken->getLine(), 0, 'Files must end with a closing tag.');
            } elseif (!$config->get('endwith') && $endToken->isType(T_CLOSE_TAG)) {
                $this->addViolation($file, $endToken->getLine(), 0, 'Files must not end with a closing tag.');
            }
        }
    }