Same name in other branches
  1. 5.0.x advagg_validator/src/Form/CssW3Form.php \Drupal\advagg_validator\Form\CssW3Form::testFiles()
  2. 8.x-2.x advagg_validator/src/Form/CssW3Form.php \Drupal\advagg_validator\Form\CssW3Form::testFiles()
  3. 8.x-3.x advagg_validator/src/Form/CssW3Form.php \Drupal\advagg_validator\Form\CssW3Form::testFiles()
  4. 8.x-4.x advagg_validator/src/Form/CssW3Form.php \Drupal\advagg_validator\Form\CssW3Form::testFiles()

Overrides BaseValidatorForm::testFiles

2 calls to CssW3Form::testFiles()
CssW3Form::submitCheckAll dans advagg_validator/src/Form/CssW3Form.php
CssW3Form::submitCheckDirectory dans advagg_validator/src/Form/CssW3Form.php

Fichier

advagg_validator/src/Form/CssW3Form.php, line 133

Classe

CssW3Form
Configure form for W3C validation of CSS files.

Namespace

Drupal\advagg_validator\Form

Code

protected function testFiles(array $files, array $options = []) {
    $output = [];
    foreach ($files as $filename) {
        // Skip missing files.
        if (!file_exists($filename)) {
            continue;
        }
        $lines = file($filename);
        // Run jigsaw.w3.org validator.
        $output[$filename]['jigsaw.w3.org'] = $this->testW3C($filename, $options);
        // Get extra context for errors.
        if (!empty($output[$filename]['jigsaw.w3.org']['errors'])) {
            foreach ($output[$filename]['jigsaw.w3.org']['errors'] as &$value) {
                if (isset($value['line'])) {
                    $value['linedata'] = $lines[$value['line'] - 1];
                    if (strlen($value['linedata']) > 512) {
                        unset($value['linedata']);
                    }
                }
            }
            unset($value);
        }
        if (!empty($output[$filename]['jigsaw.w3.org']['warnings'])) {
            foreach ($output[$filename]['jigsaw.w3.org']['warnings'] as &$value) {
                if (isset($value['line'])) {
                    $value['linedata'] = $lines[$value['line'] - 1];
                    if (strlen($value['linedata']) > 512) {
                        unset($value['linedata']);
                    }
                }
            }
            unset($value);
        }
    }
    return $output;
}