@param $file

@return \Doctrine\Common\Reflection\ClassFinderInterface
558508
protected function getFileFinder($file) {
    return new class($file) implements ClassFinderInterface {

      protected $file;

      public function __construct($file) {
        $this->file = $file;
      }

      public function findFile($class) {
        return $this->file;
      }
    };
  }
1060732
public static function getMimeType($file)
    {
        $mimeType = new MimeTypeGuesser();
        $extension = self::getExtension($file);

        return $mimeType->getTypeByExtension($file);
    }
32697
public function load($file)
    {
        $dir = $this->getDir();

        if (!$this->filesystem->exists($dir . $file)) {
            throw new NotFoundException('File not found.');
        }

        return file_get_contents($dir . $file);
    }
1182859
public static function fromFile(string $file) : DOMDocument
    {
        if (!is_file($file)) {
            throw new InvalidArgumentException(sprintf('Path "%s" is not a file', $file));
        }

        if (!is_readable($file)) {
            throw new InvalidArgumentException(sprintf('File "%s" is not readable', $file));
        }

        // libxml_disable_entity_loader(true) disables \DOMDocument::load() method
        // so we need to read the content and use \DOMDocument::loadXML()
        $xml = file_get_contents($file);
        if ($xml === false) {
            throw new RuntimeException(sprintf(
                'Contents of readable file "%s" could not be gotten',
                $file
            ));
        }

        if (trim($xml) === '') {
            throw new RuntimeException(sprintf('File "%s" does not have content', $file));
        }

        return static::fromString($xml);
    }
1246808
public static function loadFromFile($file)
    {
        if (file_exists($file) === false) {
            throw new FileNotFoundException($file);
        }

        if (preg_match('/(\.toml)$/', $file) !== 1) {
            throw new NotSupportFileTypeException($file);
        }

        $values = Toml::parse($file);
        $values = (is_array($values) === true) ? $values : [];

        $config = new Config($values);
        $config->merge(new Config([
            self::CONFIG_FILE_KEY => $file,
            self::CONFIG_DIRECTORY_KEY => dirname(realpath($file)) . DIRECTORY_SEPARATOR
        ]));

        return new BuilderConfiguration($config);
    }
588309
protected function inferClassName(File $file) {
    return Code::mapFileToClass($file, $this->classPath->up(), $this->underscoreStyle ? '_' : '\\');
  }
351010
protected function setFileToLoad(string $file) : ModularParser
    {
        if (file_exists($file)) {
            $spl = new SplFileInfo($file);
            // check if is as a symlink
            if ($spl->isLink()) {
                throw new InvalidArgumentException(
                    "Argument that given could not as a symlink path.",
                    E_WARNING
                );
            }
            // check if as a file
            if (!$spl->isFile()) {
                throw new InvalidArgumentException(
                    "Argument that given is not a file.",
                    E_WARNING
                );
            }

            if (strtolower($spl->getExtension()) !== 'php') {
                throw new InvalidArgumentException(
                    sprintf(
                        "%s file has invalid extension. ExtensionParser must be as `php`",
                        $this->getName()
                    ),
                    E_WARNING
                );
            }

            $this->file = $spl->getRealPath();
            unset($spl);
            return $this;
        }

        throw new InvalidArgumentException(
            sprintf(
                "Invalid file %s to read.",
                $this->getName()
            ),
            E_WARNING
        );
    }
1047321
public static function loadClassFile($file) {
		$before = array_merge(get_declared_classes(), get_declared_interfaces());
		require_once $file;
		$after = array_merge(get_declared_classes(), get_declared_interfaces());

		$diff = array_diff($after, $before);

		#class was maybe already loaded
		if(!$diff) {
			foreach(array_merge(get_declared_classes(), get_declared_interfaces()) as $class) {
				$reflector = new \ReflectionClass($class);
				if($reflector->getFileName() == realpath($file)) {
					$result = $class;
					break;
				}
			}
			if(!isset($result))
				throw new \Exception('File '.$file.' does not contain any class.');
		}
		else
			$result = array_values($diff)[count($diff)-1];

		return $result;
	}
506659
protected function parseFile($file)
    {
        $stmts = $this->phpParser->parse(file_get_contents($file));

        $visitor = new RefVisitor($file);
        $this->traverser->addVisitor($visitor);
        $this->traverser->traverse($stmts);
        $this->traverser->removeVisitor($visitor);

        return $visitor->getClasses();
    }
1166272
public function setFile($file) {
        if (!file_exists($file) || !is_readable($file)) {
            throw new InvalidArgumentException("The file '{$file}' cannot be opened.");
        }
        $this->file = $file;
        return $this;
    }
1287644
protected function ensureEloquentFile($file)
    {

        if (!$file instanceof EloquentFile) {
            throw new TypeException("File has to be EloquentFile not " . Type::of($file));
        }

        if ($this->urlMapper) {
            $file->setUrlMapper($this->urlMapper);
        }

        return $file;

    }
1038361
public function current($file = null)
    {
        $splFileInfo = $file ?: parent::current();

        return $this->transformer->transform($splFileInfo);
    }
191212
public function load($file)
    {
        if (!is_file($file)) {
            if (!$found = $this->findFile($file)) {
                $paths = array_values(iterator_to_array(clone $this->paths));

                $paths = implode(" / ", $paths);

                throw new \RuntimeException(sprintf('Language file: %s not found. Paths in queue: %s', $file, $paths));
            }
        } else {
            $found = $file;
        }

        return file_get_contents($found);
    }
547642
protected function prepareSeedClass($file)
    {
        $extension = $file->getExtension();
        if ($extension !== 'php') {
            return null;
        }
        return '\\' . str_replace('.' . $extension, '', $file->getFilename());
    }
784127
public static function deserializeFromFile($file)
  {
    if (file_exists($file))
    {
      $serialized_data = file_get_contents($file);
      return unserialize($serialized_data);
    }
    else return null;
  }
384588
protected function loadFile($file)
    {
        if (class_exists('Symfony\Component\Config\Util\XmlUtils')) {
            $dom = XmlUtils::loadFile($file);
            $this->validate($dom);

            return $dom;
        }

        return parent::loadFile($file);
    }
657936
public function load($file) {
		$this->_origin = $file;
		if(!is_null($file)) {
			if(file_exists($file)) {
				if (is_null($this->_name)) {
					$bits = explode('/', $file);
					$this->_name = preg_replace('~\.tmpl~', '', array_pop($bits));
				}
				$this->_contents = file_get_contents($file);
				$this->_dir = dirname($file);
			}
			else {
				throw new \InvalidArgumentException("file does not exist (". $file .")");
			}
		}
		return $this;
	}