checkFile
@param array                        $file
@param \League\Flysystem\Filesystem $fileReader
@param                              $type
@return bool
@throws \eig\Configurator\Exceptions\ConfiguratorException
544795
protected function checkFile(array $file, Filesystem $fileReader, $type)
    {
        try {
            $this->checkFileExists($file, $fileReader);
        } catch (\Exception $e) {
            throw new ConfiguratorException("Error: File {$file['source']} did not pass checks", $code = 1, $previous = $e);
        }
        try {
            $this->checkFileType($file, $fileReader, $type);
        } catch (\Exception $e) {
            throw new ConfiguratorException("Error: File {$file['source']} did not pass checks", $code = 1, $previous = $e);
        }
        return true;
    }
390184
public static function ensureConfigFile($path, $type)
    {
        if (!is_file($path)) {
            $content = self::getExampleConfiguration($type);
            file_put_contents($path, $content);
        }
    }
271380
public function validate(File $file, $typeName, $sourceFilePath = null)
	{
		$name = $file->getFileName();
		$fileNameHelper = new Helpers\FileNameValidationHelper();
		$result = $fileNameHelper->validate($name);
		
		if( ! $result) {
			$message = $fileNameHelper->getErrorMessage();
			
			throw new Exception\UploadFilterException(self::EXCEPTION_MESSAGE_KEY, $message);
		}
	}
215334
protected function _check_data($file = null) {
        if (empty($this->file_data)) {
            if (is_null($file)) {
                $file = $this->file;
            }

            return $this->load_data($file);
        }

        return true;
    }
616286
public function validateFile(File $file)
    {
        if (!$this->acceptsExtension($file->getExtension())) {
            throw new Exception\InvalidFileException(sprintf("This definition does not accept files with extension %s", $file->getExtension()));
        }

        if (!$this->acceptsMime($file->getMime())) {
            throw new Exception\InvalidFileException(sprintf("This definition does not accept files with mime of %s", $file->getMime()));
        }

        if (!$this->acceptsMimeType($file->getMimeType())) {
            throw new Exception\InvalidFileException(sprintf("This definition does not accept files with mime type of %s", $file->getMimeType()));
        }

        if (!$this->acceptsMimeEncoding($file->getMimeEncoding())) {
            throw new Exception\InvalidFileException(sprintf("This definition does not accept files with mime encoding of %s", $file->getMimeEncoding()));
        }

        if ($this->getRequiredType()) {
            if ($this->getRequiredType() !== $file->getType()) {
                throw new Exception\InvalidFileException(sprintf("This definition only accept files of type %s", $this->getRequiredType()));
            }
        }

        if (!$this->getAllowDirectory() && $file->isDir()) {
            throw new Exception\InvalidFileException("This definition cannot accept a directory as input");
        }

        return true;
    }
812872
public function check($file)
    {
        $process = new Process('php -lf '.$file);
        $process->run();
        if (0===$process->getExitCode()) {
            return true;
        } else {
            //$this->logger->addFail('Check syntax failed <comment>'.$process->getOutput().'</comment>');
            throw new LinterException($this,$process->getOutput());
            //return false;
        }
    }
1296845
public function insertFile($file)
    {
        if ( ! $this->checkedIndexes) {
            $this->ensureIndexes();
        }

        $this->filesCollection->insertOne($file);
    }
291075
public function scan($file)
    {
        // If no decision is already made about this file
        if (!isset($this->states[$file])) {
            $this->display(' -> Scanning '.$file.'...');
            $this->states[$file] = self::NO_PARSE;
            $entry = $this->metas->get($file);
            $rst = $this->getRST($file);

            if (!$entry || !file_exists($rst) || $entry['ctime'] < filectime($rst)) {
                // File was never seen or changed and thus need to be parsed
                $this->addToParseQueue($file);
            } else {
                // Have a look to the file dependencies to knoww if you need to parse
                // it or not
                $depends = $entry['depends'];

                if (isset($entry['parent'])) {
                    $depends[] = $entry['parent'];
                }

                foreach ($depends as $dependency) {
                    $this->scan($dependency);

                    // If any dependency needs to be parsed, this file needs also to be
                    // parsed
                    if ($this->states[$dependency] == self::PARSE) {
                        $this->addToParseQueue($file);
                    }
                }
            }
        }
    }
1300354
public function write($file, $content, $type='sandbox')
	{
		$url = 'https://api-content.dropbox.com/1/files_put/';
		$result = $this->doOAuthCall($url,'PUT',null,$type,$file,$content);
		$result_body = json_decode($result['body'],true);
		if (!array_key_exists('error', $result_body)) {
			return $result_body;
		} else {
			trigger_error(sprintf(self::E_APIERROR, $result_body['error']));
			return false;
		}
	}
912957
protected function checkFile($path, $type, $file)
    {
        $filePath = implode('/', [$path, $type, $file]);

        if (is_file($filePath)) {
            return $filePath;
        } else {
            return false;
        }
    }
810472
public function isFile($file)
	{
		$file = Util::normalizePath($file);

		return (bool) $this->adapter->isFile($file);
	}
351848
public static function create( $file, $type = null ) 
	{
		// when no type is given use the file extension
		if ( is_null( $type ) ) 
		{
			$type = CCStr::extension( $file );

			// validate type
			if ( !in_array( $type, static::$available_image_types ) )
			{
				$type = null;
			}
		}

		$image_data = getimagesize( $file );

		if ( $image_data === false ) 
		{
			return false;
		}

		$image = null;

		switch( $image_data['mime'] ) 
		{
			case 'image/gif':
				$image = imagecreatefromgif( $file );
			break;

			case 'image/jpeg';
				$image = imagecreatefromjpeg( $file );
			break;

			case 'image/png':
				$image = imagecreatefrompng( $file );
			break;

			default:
				// we dont support other image types
				return false;
			break;
		}

		// when the image type is still null we are going to use 
		// the mime type of the image 
		if ( is_null( $type ) )
		{
			$type = CCStr::suffix( $image_data['mime'], '/' );
		}

		return new static( $image, $type );
	}
322143
public static function require(String $file, String $type = 'require')
    {
        $file = Info::rpath($file);

        if( ! is_file($file) )
        {
            throw new Exception\FileNotFoundException(NULL, $file);
        }

        switch( $type )
        {
            case 'require'     : return require      $file;
            case 'require_once': return require_once $file;
            case 'include'     : return include      $file;
            case 'include_once': return include_once $file;
        }
    }
1218566
public function readImage( $file, $type) {
		switch ($type) {
			case 2:	//JPEG
			return(ImageCreateFromJPEG($file));
			break;
			
			case 3:	//PNG
			return(ImageCreateFromPNG($file));
			break;
			
			default:
			$this->errorMsg="File format not supported.";
			return(false);
		}
	}
365506
private function shouldSkipFile(File $file): bool
    {
        if (Strings::contains($file->getFilename(), '/tests/')
            && ! Strings::contains($file->getFilename(), 'CodingStandard/tests/')
        ) {
            return true;
        }

        $classWrapper = $this->sniffClassWrapperFactory->createFromFirstClassInFile($file);
        if ($classWrapper === null) {
            return true;
        }

        return $classWrapper->implementsInterface() || $classWrapper->extends();
    }
1128881
public function load($file, $type = null)
    {
        $path = $this->locator->locate($file);

        $xml = $this->parseFile($path);
        $xml->registerXPathNamespace('config', 'http://thelia.net/schema/dic/config');

        $this->removeScope($xml);

        $this->container->addResource(new FileResource($path));

        $this->parseLoops($xml);

        $this->parseFilters($xml);

        $this->parseTemplateDirectives($xml);

        $this->parseParameters($xml);

        $this->parseCommands($xml);

        $this->parseForms($xml);

        $this->parseDefinitions($xml, $path);

        $this->parseHooks($xml, $path, $type);

        $this->propelOnlyRun(
            [$this, "parseExportCategories"],
            $xml
        );

        $this->propelOnlyRun(
            [$this, "parseExports"],
            $xml
        );

        $this->propelOnlyRun(
            [$this, "parseImportCategories"],
            $xml
        );

        $this->propelOnlyRun(
            [$this, "parseImports"],
            $xml
        );
    }
1256601
public function finalFile($file, $type = 'images') {
		return isset($this->oss[$type]) ? $this->putFileToOss($file['name'], $file['tmp'], $type) : $file['src'];
	}