You are here

public function MockSplFileInfo::__construct in Database Sanitize 7

File

vendor/symfony/finder/Tests/Iterator/MockSplFileInfo.php, line 26

Class

MockSplFileInfo

Namespace

Symfony\Component\Finder\Tests\Iterator

Code

public function __construct($param) {
  if (\is_string($param)) {
    parent::__construct($param);
  }
  elseif (\is_array($param)) {
    $defaults = array(
      'name' => 'file.txt',
      'contents' => null,
      'mode' => null,
      'type' => null,
      'relativePath' => null,
      'relativePathname' => null,
    );
    $defaults = array_merge($defaults, $param);
    parent::__construct($defaults['name']);
    $this
      ->setContents($defaults['contents']);
    $this
      ->setMode($defaults['mode']);
    $this
      ->setType($defaults['type']);
    $this
      ->setRelativePath($defaults['relativePath']);
    $this
      ->setRelativePathname($defaults['relativePathname']);
  }
  else {
    throw new \RuntimeException(sprintf('Incorrect parameter "%s"', $param));
  }
}