@param  string  $file_path

@return void
10120
public function checkFile($file_path)
    {
        if ($this->debug_output) {
            echo 'Checking ' . $file_path . "\n";
        }

        $this->config->hide_external_errors = $this->config->isInProjectDirs($file_path);

        $this->codebase->addFilesToAnalyze([$file_path => $file_path]);

        $this->file_reference_provider->loadReferenceCache();

        if ($this->output_format === self::TYPE_CONSOLE) {
            echo 'Scanning files...' . "\n";
        }

        $this->config->initializePlugins($this);

        $this->codebase->scanFiles($this->threads);

        $this->config->visitStubFiles($this->codebase, $this->debug_output);

        if ($this->output_format === self::TYPE_CONSOLE) {
            echo 'Analyzing files...' . "\n";
        }

        $this->codebase->analyzer->analyzeFiles($this, $this->threads, $this->codebase->alter_code);
    }
442304
public function cacheFileContents($file_path, $file_contents)
    {
        $root_cache_directory = Config::getInstance()->getCacheDirectory();

        if (!$root_cache_directory) {
            return;
        }

        $file_cache_key = $this->getParserCacheKey(
            $file_path
        );

        $parser_cache_directory = $root_cache_directory . DIRECTORY_SEPARATOR . self::FILE_CONTENTS_CACHE_DIRECTORY;

        $cache_location = $parser_cache_directory . DIRECTORY_SEPARATOR . $file_cache_key;

        if (!is_dir($parser_cache_directory)) {
            mkdir($parser_cache_directory, 0777, true);
        }

        file_put_contents($cache_location, $file_contents);
    }
235232
private function output($save_path)
	{
		if ($this->resource != null)
		{
			switch ($this->image_type)
			{
				case IMAGETYPE_PNG:
					imagepng($this->resource, $save_path);
					break;

				case IMAGETYPE_GIF:
					imagegif($this->resource, $save_path);
					break;

				case IMAGETYPE_JPEG:
					imagejpeg($this->resource, $save_path);
					break;
			}
		}
	}
470625
public function reportTypeStatsForFile($file_path)
    {
        return $this->project_files
            && $this->project_files->allows($file_path)
            && $this->project_files->reportTypeStats($file_path);
    }
354348
public static function delete($file_path)
    {
        $result = false;
        if (self::fileExists($file_path)) {
            $result = unlink($file_path);
        }
        return $result;
    }
1153782
protected function makeDirectory(string $path): void
    {
        if (!$this->filesystem->isDirectory(dirname($path))) {
            $this->filesystem->makeDirectory(dirname($path), 0777, true, true);
        }
    }
1207292
private function deleteUploadedFile($filePath)
    {
        if ($this->getStorageDisk()->exists($filePath)) {
            $this->getStorageDisk()->delete($filePath);
        }
    }
86500
public static function readFile($file_path)
    {
        try {
            $file = fopen($file_path, 'r');
            $content = fread($file, filesize($file_path));
            fclose($file);
            return $content;
        } catch (\Exception $e) {
            return '';
        }
    }
740790
public function SetInput( $file_path ){

		if( $file_path ){
			$this->input = file_get_contents( $file_path );
		}

		$this->pos = $this->furthest = 0;

		// Remove potential UTF Byte Order Mark
		$this->input = preg_replace('/\\G\xEF\xBB\xBF/', '', $this->input);
		$this->input_len = strlen($this->input);


		if( Less_Parser::$options['sourceMap'] && $this->env->currentFileInfo ){
			$uri = $this->env->currentFileInfo['currentUri'];
			Less_Parser::$contentsMap[$uri] = $this->input;
		}

	}
1042060
public function move($file, $filePath)
	{
 		$this->buildDirectory($filePath);
 		$this->moveFile($file, $filePath);
        $this->setPermissions($filePath, $this->attachedFile->override_file_permissions);
	}
692822
public function delete($remote_file_path) {
        //get file string massage
        $remote_file_path = self::winslashes($remote_file_path);
        $this->execute('del "' . $remote_file_path . '"', $output);
        return $output;
    }
52141
public function findRealPath($file_path)
    {
        if (@file_exists($file_path)) {
            return realpath($file_path);
        }
        if (@file_exists($this->web_root_path.$file_path)) {
            return $this->web_root_path.$file_path;
        }
        return null;
    }
978756
public function lintFileList($file_list) {
    $this->say("Linting twig files...");

    $files = explode("\n", $file_list);

    /** @var \Acquia\Blt\Robo\Filesets\FilesetManager $fileset_manager */
    $fileset_manager = $this->getContainer()->get('filesetManager');
    $fileset_ids = $this->getConfigValue('validate.twig.filesets');
    $filesets = $fileset_manager->getFilesets($fileset_ids, TRUE);
    foreach ($filesets as $fileset_id => $fileset) {
      $filesets[$fileset_id] = $fileset_manager->filterFilesByFileset($files, $fileset);
    }
    $this->executeTwigLintCommandAgainstFilesets($filesets);
  }
161798
public function setPath(File $path) {
		$this->path = $path;
		if ($this->isCreateIfNotExists() && !$path->isFile()) {
			$path->getParent()->mkdir();
			$path->write("");
			$this->setCreateDefault(true);
			if (!$path->isFile()) {
				throw new FileNotFoundException($path);
			}
		}
		$this->content = $path->getContent();
	}
178744
public static function pathModeInfo(string $file_path): int
    {
        /* 如果不存在，则不可读、不可写、不可改 */
        if (!file_exists($file_path)) {
            return false;
        }

        $mark = 0;

        if (0 === stripos(PHP_OS, 'WIN')) {
            /* 测试文件 */
            $test_file = $file_path . '/cf_test.txt';

            /* 如果是目录 */
            if (is_dir($file_path)) {
                /* 检查目录是否可读 */
                $dir = @opendir($file_path);

                //如果目录打开失败，直接返回目录不可修改、不可写、不可读
                if ($dir === false) {
                    return $mark;
                }

                //目录可读 001，目录不可读 000
                if (@readdir($dir) !== false) {
                    $mark ^= 1;
                }

                @closedir($dir);

                /* 检查目录是否可写 */
                $fp = @fopen($test_file, 'wb');

                //如果目录中的文件创建失败，返回不可写。
                if ($fp === false) {
                    return $mark;
                }

                //目录可写可读 011，目录可写不可读 010
                if (@fwrite($fp, 'directory access testing.') !== false) {
                    $mark ^= 2;
                }

                @fclose($fp);
                @unlink($test_file);

                /* 检查目录是否可修改 */
                $fp = @fopen($test_file, 'ab+');
                if ($fp === false) {
                    return $mark;
                }

                if (@fwrite($fp, "modify test.\r\n") !== false) {
                    $mark ^= 4;
                }

                @fclose($fp);

                /* 检查目录下是否有执行rename()函数的权限 */
                if (@rename($test_file, $test_file) !== false) {
                    $mark ^= 8;
                }

                @unlink($test_file);

                /* 如果是文件 */
            } elseif (is_file($file_path)) {
                /* 以读方式打开 */
                $fp = @fopen($file_path, 'rb');
                if ($fp) {
                    $mark ^= 1; //可读 001
                }

                @fclose($fp);

                /* 试着修改文件 */
                $fp = @fopen($file_path, 'ab+');
                if ($fp && @fwrite($fp, '') !== false) {
                    $mark ^= 6; //可修改可写可读 111，不可修改可写可读011...
                }

                @fclose($fp);

                /* 检查目录下是否有执行rename()函数的权限 */
                if (@rename($test_file, $test_file) !== false) {
                    $mark ^= 8;
                }
            }
        } else {
            if (@is_readable($file_path)) {
                $mark ^= 1;
            }

            if (@is_writable($file_path)) {
                $mark ^= 14;
            }
        }

        return $mark;
    }
1280440
public static function write($file_path = null, $content, $type = 'a', $force = false, array &$logs = array())
    {
        if (is_null($file_path)) {
            return null;
        }
        if (!file_exists($file_path)) {
            if (true===$force) {
                self::touch($file_path, $logs);
            } else {
                $logs[] = sprintf('File path "%s" to copy was not found.', $file_path);
                return false;
            }
        }
        if (is_writable($file_path)) {
            $h = fopen($file_path, $type);
            if (false !== fwrite($h, $content)) {
                fclose($h);
                return true;
            }
        }
        $logs[] = sprintf('Can not write in file "%s".', $file_path);
        return false;
    }
574411
public function addFileToDeepScan($file_path)
    {
        $this->files_to_scan[$file_path] = $file_path;
        $this->files_to_deep_scan[$file_path] = $file_path;
    }