コード例 #1
0
 /**
  * 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
0
 public function __toString()
 {
     return $this->fileInfo->__toString();
 }