Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. FileList.php

function FileList::addFile

Add a file to the list.

If a file object has already been created, it can be passed here. If it is left NULL, it will be created when accessed.

Parameters

string $path The path to the file being added.:

\PHP_CodeSniffer\Files\File $file The file being added.:

Return value

void

1 call to FileList::addFile()
FileList::__construct in vendor/squizlabs/php_codesniffer/src/Files/FileList.php
Constructs a file list and loads in an array of file paths to process.

File

vendor/squizlabs/php_codesniffer/src/Files/FileList.php, line 118

Class

FileList

Namespace

PHP_CodeSniffer\Files

Code

public function addFile($path, $file = null) {
    // No filtering is done for STDIN when the filename
    // has not been specified.
    if ($path === 'STDIN') {
        $this->files[$path] = $file;
        $this->numFiles++;
        return;
    }
    $filterClass = $this->getFilterClass();
    $di = new RecursiveArrayIterator([
        $path,
    ]);
    $filter = new $filterClass($di, $path, $this->config, $this->ruleset);
    $iterator = new RecursiveIteratorIterator($filter);
    foreach ($iterator as $path) {
        $this->files[$path] = $file;
        $this->numFiles++;
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal