@param string|\coverallskit\entity\SourceFile $source

@return bool
774773
public function has($source)
    {
        $path = (gettype($source) === 'string')
            ? realpath($source) : $source->getName();

        return $this->sources->containsKey($path);
    }
1195727
protected function fileExists(Smarty_Template_Source $source, $file)
    {
        $source->timestamp = @filemtime($file);
        return $source->exists = !!$source->timestamp;

    }
1021022
public function source($source, $sourceType = 'local')
    {
        $this->sourcePath = $source;
        $this->sourceType = $sourceType;

        return $this;
    }
135479
public function load($source)
    {
        if ($this->isFile($source)) {
            return $this->loadFile($source);
        } else {
            return $this->loadString($source);
        }
    }
1249991
public function rm($sourcepath)
    {
        if ($sourcepath == '' || substr($sourcepath, 0, 1) !== '/') {
            $sourcepath = $this->dir . '/' . $sourcepath;
        }

        $this->errorHandler->start();
        //check the file actauly exists.
        if (($sourcepath = $this->driver->realpath($this->resource, $sourcepath)) !== false) {
            //file exists
            if ($this->driver->sftpDelete($this->resource, $sourcepath)) {
                //file deleted
                $this->errorHandler->stop();

                return true;
            } //file not deleted
        } //file does not exist.

        $this->errorHandler->stop();
        $this->errorHandler->register("Could not delete: $sourcepath", 0);

        return false;
    }
196895
public function canConvertFrom($source, $targetType)
    {
        $identifier = $this->persistenceManager->getIdentifierByObject($source);
        return ($identifier !== null);
    }
254703
public function canConvertFrom($source, $targetType)
    {
        if (!is_subclass_of($targetType, $this->targetType)) {
            return false;
        }
        if (is_array($source) && !isset($source['__identity'])) {
            return false;
        }
        return true;
    }
160339
public function validate($sourceFile, $originFile)
	{
		$this->validateLineEndings($originFile);
		if (substr($originFile, -4) === '.php')
		{
			$this->validateDefinedInPhpbb($originFile);
			$this->validateUtf8withoutbom($originFile);
			$this->validateNoPhpClosingTag($originFile);
		}

		if (strpos($originFile, $this->originLanguagePath . 'email/') === 0 && substr($originFile, -4) === '.txt')
		{
			$this->validateEmail($sourceFile, $originFile);
		}
		else if (strpos($originFile, $this->originLanguagePath . 'help_') === 0 && substr($originFile, -4) === '.php')
		{
			$this->validateHelpFile($sourceFile, $originFile);
		}
		else if ($originFile == $this->originLanguagePath . 'search_synonyms.php')
		{
			$this->validateSearchSynonymsFile($originFile);
		}
		else if ($originFile == $this->originLanguagePath . 'search_ignore_words.php')
		{
			$this->validateSearchIgnoreWordsFile($originFile);
		}
		else if (substr($originFile, -4) === '.php')
		{
			$this->validateLangFile($sourceFile, $originFile);
		}
		else if (substr($originFile, -9) === 'index.htm')
		{
			$this->validateIndexFile($originFile);
		}
		else if ($originFile === $this->originLanguagePath . 'LICENSE')
		{
			$this->validateLicenseFile($originFile);
		}
		else if ($originFile === $this->originLanguagePath . 'iso.txt')
		{
			$this->validateIsoFile($originFile);
		}
		else if (substr($originFile, -4) === '.css')
		{
			$this->validateUtf8withoutbom($originFile);
			$this->validateCSSFile($sourceFile, $originFile);
		}
		else
		{
			$this->output->addMessage(Output::NOTICE, 'File is not validated', $originFile);
		}
	}
688883
protected function checkFileExists(array $file, Filesystem $fileReader)
    {
        if ($fileReader->has($file['source'])) {
            return true;
        } else {
            throw new ConfiguratorException("Error {$file['source']} does not exist", $code = 1);
        }
    }
882287
protected function _compile($source)
    {
        $result = false;
        if(is_callable($this->_compiler)) {
            $result = call_user_func($this->_compiler, $source);
        }

        return $result;
    }
536586
public function copy(string $source, string $destination) : bool
    {
        $status = @copy($source, $destination);

        if (false === $status) {
            throw new FileException('Cannot copy source to destination.');
        }

        return $status;
    }
261060
protected boolean isSourceFile(File file) {
        String name = file.getName();
        String extension = Files.getExtension(name).toLowerCase();
        return sourceFileExtensions.contains(extension) || sourceFileNames.contains(name);
    }
127571
public function copyDirectory(string $source, string $target, int $flags = null) : bool
    {
        if (!$this->exists($source)) {
            return false;
        }

        if (!$this->isDirectory($target) && !$this->makeDirectory($target, 0777, true)) {
            return false;
        }

        if ($flags === null) {
            $flags = FilesystemIterator::SKIP_DOTS;
        }

        $items = new FilesystemIterator($source, $flags);

        foreach ($items as $item) {
            if ($item->isDir()) {
                if (!$this->copyDirectory($item->getRealPath(), $target . '/' . $item->getBasename(), $flags)) {
                    return false;
                }
            } elseif ($item->isFile()) {
                if (!$this->copyFile($item->getRealPath(), $target . '/' . $item->getBasename())) {
                    return false;
                }
            }
        }

        return true;
    }
1267230
public static function copyFile($source, $path)
    {
        $path = str_replace('\\', '/', $path);
        $arr = explode('/', $path);
        array_pop($arr);
        $folder = join('/', $arr);
        if (!is_dir($folder)) {
            self::createFolder($folder);
        }
        if (is_file($source)) {
            copy($source, $path);
        }
    }
328738
public function delete($source=null) {
        global $DB;
        if (!empty($this->courseid)) {
            $DB->delete_records('grade_outcomes_courses', array('outcomeid' => $this->id, 'courseid' => $this->courseid));
        }
        if (parent::delete($source)) {
            $context = context_system::instance();
            $fs = get_file_storage();
            $files = $fs->get_area_files($context->id, 'grade', 'outcome', $this->id);
            foreach ($files as $file) {
                $file->delete();
            }
            return true;
        }
        return false;
    }
886089
protected function isEqual($source, $destination)
    {
        if (!ends_with($destination, DIRECTORY_SEPARATOR)) {
            $destination = $destination.DIRECTORY_SEPARATOR;
        }
        if (!ends_with($source, DIRECTORY_SEPARATOR)) {
            $source = $source.DIRECTORY_SEPARATOR;
        }

        if ($destination === $source) {
            throw InvalidParameter::destinationDirectoryIsSource();
        }
    }
501765
public function set_source($source) {
        $filerecord = new stdClass;
        $filerecord->source = $source;
        $this->update($filerecord);
    }