Пример #1
0
 /**
  * Very naive way to get the classes defined in a file
  */
 public static function extractClassFromFile($file)
 {
     $code = file_get_contents($file);
     return ClassUtil::extractClassesFromText($code);
 }
Пример #2
0
 public function testExtractClassesFromText()
 {
     $text = file_get_contents(__DIR__ . '/classes.txt');
     $classes = ClassUtil::extractClassesFromText($text);
     $this->assertEquals(array('ClassName', 'ClassName2', 'ClassName3', 'ClassName4', 'ClassName5', 'Class_Name', 'Name\\Space\\Namespaced', 'Name\\Space\\ClassName', 'Name\\Space2\\Namespaced'), $classes);
 }