本文整理匯總了PHP中Symfony\Component\Finder\SplFileInfo::__toString方法的典型用法代碼示例。如果您正苦於以下問題:PHP SplFileInfo::__toString方法的具體用法?PHP SplFileInfo::__toString怎麽用?PHP SplFileInfo::__toString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Symfony\Component\Finder\SplFileInfo
的用法示例。
在下文中一共展示了SplFileInfo::__toString方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: isClassDefinedInFile
/**
* Verify whether given class is defined in given file because there is no sense in adding class with incorrect
* file or path. Examples:
* app/code/core/Mage/Core/Model/Mysql4/Design/Theme/Collection.php -> Mage_Core_Model_Mysql4_Design_Theme
* app/code/core/Mage/Payment/Model/Paygate/Request.php -> Mage_Paygate_Model_Authorizenet_Request
* app/code/core/Mage/Dataflow/Model/Convert/Iterator.php -> Mage_Dataflow_Model_Session_Adapter_Iterator
*
* @param SplFileInfo $file
* @param string $className
* @param OutputInterface $output
* @return bool
*/
protected function isClassDefinedInFile(SplFileInfo $file, $className, OutputInterface $output)
{
try {
return preg_match("/class\\s+{$className}/m", $file->getContents());
} catch (\Exception $e) {
$output->writeln('<error>File: ' . $file->__toString() . ' | ' . $e->getMessage() . '</error>');
return false;
}
}
示例2: __toString
public function __toString()
{
return $this->fileInfo->__toString();
}