public function resolve(ResolvedClass $resolved)
{
$class = $resolved->getClass();
$pattern = new Facade($class->getFullname());
foreach ($class->getMethods() as $method) {
$instancied = array_unique($method->getInstanciedClasses());
// $externalCalls = $method->getExternalCalls();
// today PhpMetrics is not able to get external calls when they are made on internal propery
// ex: $this->foo->bar()
// we will count T_OBJECT_CALL
if (preg_match_all('!\\->\\w+\\(!', $method->getTokens()->asString(), $matches)) {
$nbExternalCalls = sizeof($matches[0]);
}
if (sizeof($instancied) == 0 && $nbExternalCalls >= 2) {
$resolved->pushPattern($pattern);
return;
}
}
}