public function getComposerInterfaces($vendor = null)
{
// global namespace is stored with 'global' keyword, so we remove it.
$query = "SELECT CASE namespace WHEN 'global' THEN interfacename ELSE namespace || '\\' || interfacename END AS interfacename FROM namespaces \nJOIN interfaces ON interfaces.namespace_id = namespaces.id";
if ($vendor !== null) {
list($vendor, $component) = explode('/', $vendor);
$query .= " WHERE vendor = '{$vendor}' and component = '{$component}'";
}
$res = $this->sqlite->query($query);
$return = array();
while ($row = $res->fetchArray(\SQLITE3_ASSOC)) {
$return[] = strtolower($row['interfacename']);
}
return $return;
}
public function analyze() { $data = new Composer(); $interfaces = $data->getComposerInterfaces(); $interfacesFullNP = $this->makeFullNsPath($interfaces); $this->atomIs('Class')->outIs('IMPLEMENTS', 'EXTENDS')->isNot('aliased', true)->fullnspathIs($interfacesFullNP); $this->prepareQuery(); $this->atomIs('Instanceof')->outIs('CLASS')->tokenIs(array('T_STRING', 'T_NS_SEPARATOR'))->atomIsNot('Array')->isNot('aliased', true)->fullnspathIs($interfacesFullNP); $this->prepareQuery(); $this->atomIs('Function')->outIs('ARGUMENTS')->outIs('ARGUMENT')->outIs('TYPEHINT')->isNot('aliased', true)->fullnspathIs($interfacesFullNP); $this->prepareQuery(); $this->atomIs('Use')->outIs('USE')->fullnspathIs($interfacesFullNP); $this->prepareQuery(); }