Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ClassNameExtractor.php
Go to the documentation of this file.
1 <?php
7 
9 {
16  public function getNameWithNamespace($fileContent)
17  {
18  $namespace = $this->getNamespace($fileContent);
19  $name = $this->getName($fileContent);
20  if ($name) {
21  return $namespace ? $namespace . '\\' . $name : $name;
22  }
23  return false;
24  }
25 
32  public function getName($fileContent)
33  {
34  $namespace = $this->getNamespace($fileContent);
35  if (isset($namespace)) {
36  preg_match_all(
37  '/^\s*(class|abstract\sclass|interface)\s+([a-z0-9]+)(\s+(extends|implements)|\s*$)/im',
38  $fileContent,
39  $classMatches
40  );
41  if (isset($classMatches[2][0])) {
42  return $classMatches[2][0];
43  }
44  }
45  return false;
46  }
47 
54  public function getNamespace($fileContent)
55  {
56  preg_match_all(
57  '/namespace\s([a-z0-9\\\\]+);/im',
58  $fileContent,
59  $namespaceMatches
60  );
61  if (isset($namespaceMatches[1][0])) {
62  return $namespaceMatches[1][0];
63  }
64  return false;
65  }
66 }
if(!isset($_GET['name'])) $name
Definition: log.php:14