|
@@ 65-80 (lines=16) @@
|
| 62 |
|
* |
| 63 |
|
* @return array Collection event subscription collection |
| 64 |
|
*/ |
| 65 |
|
public function findAllStaticSubscriptions($code) |
| 66 |
|
{ |
| 67 |
|
// Found collection |
| 68 |
|
$matches = array(); |
| 69 |
|
|
| 70 |
|
// Matching pattern |
| 71 |
|
$pattern = '/(\\\\samsonphp\\\\event\\\\|samson_core_|\\\samson\\\\core\\\\)*Event::subscribe\s*\(\s*(\'|\")(?<id>[^\'\"]+)(\'|\")\s*,\s*(?<handler>[^;-]+)/ui'; |
| 72 |
|
|
| 73 |
|
// Perform text search |
| 74 |
|
if (preg_match_all($pattern, $code, $matches)) { |
| 75 |
|
// Additional handling |
| 76 |
|
} |
| 77 |
|
|
| 78 |
|
// Call generic subscription parser |
| 79 |
|
return $this->parseSubscription($matches); |
| 80 |
|
} |
| 81 |
|
|
| 82 |
|
/** |
| 83 |
|
* Find all event fire calls in code |
|
@@ 145-160 (lines=16) @@
|
| 142 |
|
* |
| 143 |
|
* @return array Collection event subscription collection |
| 144 |
|
*/ |
| 145 |
|
public function findAllDynamicSubscriptions($code) |
| 146 |
|
{ |
| 147 |
|
// Found collection |
| 148 |
|
$matches = array(); |
| 149 |
|
|
| 150 |
|
// Matching pattern |
| 151 |
|
$pattern = '/\s*->\s*subscribe\s*\(\s*(\'|\")(?<id>[^\'\"]+)(\'|\")\s*,\s*(?<handler>[^;-]+)/ui'; |
| 152 |
|
|
| 153 |
|
// Perform text search |
| 154 |
|
if (preg_match_all($pattern, $code, $matches)) { |
| 155 |
|
// Additional handling |
| 156 |
|
} |
| 157 |
|
|
| 158 |
|
// Call generic subscription parser |
| 159 |
|
return $this->parseSubscription($matches); |
| 160 |
|
} |
| 161 |
|
|
| 162 |
|
/** |
| 163 |
|
* Analyze code and gather event system calls |