本文整理汇总了PHP中FileUtils::contentEquals方法的典型用法代码示例。如果您正苦于以下问题:PHP FileUtils::contentEquals方法的具体用法?PHP FileUtils::contentEquals怎么用?PHP FileUtils::contentEquals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileUtils
的用法示例。
在下文中一共展示了FileUtils::contentEquals方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: selectionTest
/**
* This test is our selection test that compared the file with the destfile.
*
* @param PhingFile $srcfile the source file
* @param PhingFile $destfile the destination file
* @return bool true if the files are different
*
* @throws BuildException
*/
protected function selectionTest(PhingFile $srcfile, PhingFile $destfile)
{
try {
// if either of them is missing, they are different
if ($srcfile->exists() !== $destfile->exists()) {
return true;
}
if ($srcfile->length() !== $destfile->length()) {
// different size => different files
return true;
}
if (!$this->ignoreFileTimes) {
// different dates => different files
if ($destfile->lastModified() !== $srcfile->lastModified()) {
return true;
}
}
if (!$this->ignoreContents) {
//here do a bulk comparison
$fu = new FileUtils();
return !$fu->contentEquals($srcfile, $destfile);
}
} catch (IOException $e) {
throw new BuildException("while comparing {$srcfile} and {$destfile}", $e);
}
return false;
}
示例2: evaluate
/**
* comparison method of the interface
*
* @return bool if the files are equal
* @throws BuildException if it all went pear-shaped
*/
public function evaluate()
{
if ($this->file1 == null || $this->file2 == null) {
throw new BuildException("both file1 and file2 are required in filesmatch");
}
$fu = new FileUtils();
return $fu->contentEquals($this->file1, $this->file2);
}