| 1 | <?php |
||
| 10 | trait DataStructureGuesser |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * @param ClassNode|ASTClass $node |
||
| 14 | * |
||
| 15 | * @return bool |
||
| 16 | */ |
||
| 17 | 25 | protected function isDataStructure(ClassNode $node) |
|
| 18 | { |
||
| 19 | 25 | if (!preg_match($this->getRegex('dataStructureNamespaceRegex'), $node->getNamespaceName())) { |
|
| 20 | 14 | return false; |
|
| 21 | } |
||
| 22 | |||
| 23 | 11 | if (!preg_match($this->getRegex('dataStructureClassNameRegex'), $node->getName())) { |
|
| 24 | 3 | return false; |
|
| 25 | } |
||
| 26 | |||
| 27 | 8 | return true; |
|
| 28 | } |
||
| 29 | |||
| 30 | /** |
||
| 31 | * @param string $name |
||
| 32 | * |
||
| 33 | * @return string |
||
| 34 | */ |
||
| 35 | abstract protected function getRegex($name); |
||
| 36 | } |
||
| 37 |