public function analyze() { $data = new Composer(); $classes = $data->getComposerClasses(); $classesFullNP = $this->makeFullNsPath($classes); $this->atomIs('Class')->outIs(array('IMPLEMENTS', 'EXTENDS'))->fullnspathIs($classesFullNP); $this->prepareQuery(); $this->atomIs('Instanceof')->outIs('CLASS')->tokenIs(array('T_NS_SEPARATOR', 'T_STRING'))->atomIsNot('Array')->fullnspathIs($classesFullNP); $this->prepareQuery(); $this->atomIs('Function')->outIs('ARGUMENTS')->outIs('ARGUMENT')->outIs('TYPEHINT')->fullnspathIs($classesFullNP); $this->prepareQuery(); $this->atomIs('New')->outIs('NEW')->tokenIs(array('T_NS_SEPARATOR', 'T_STRING'))->atomIsNot('Array')->fullnspathIs($classesFullNP); $this->prepareQuery(); }
public function analyze() { $data = new Composer(); $packagistNamespaces = $data->getComposerNamespaces(); $packagistNamespacesFullNS = $this->makeFullNSPath($packagistNamespaces); $packagistClasses = $data->getComposerClasses(); $packagistClassesFullNS = $this->makeFullNSPath($packagistClasses); // Chunks is made to shorten the queries $packagistClassesFullNSChunks = array_chunk($packagistClassesFullNS, 5000); $packagistInterfaces = $data->getComposerInterfaces(); $packagistInterfacesFullNs = $this->makeFullNSPath($packagistInterfaces); //////////////////////////////////////////////// // Use // namespaces in Composer $this->atomIs('Use')->outIs('USE')->is('originpath', $packagistNamespacesFullNS); $this->prepareQuery(); // classes in Composer foreach ($packagistClassesFullNSChunks as $id => $p) { $this->atomIs('Use')->outIs('USE')->is('originpath', $p); $this->prepareQuery(); } // interfaces in Composer $this->atomIs('Use')->outIs('USE')->is('originpath', $packagistInterfaces); $this->prepareQuery(); // traits in Composer $packagistTraits = $data->getComposerTraits(); $this->atomIs('Use')->outIs('USE')->is('originpath', $packagistTraits); $this->prepareQuery(); //////////////////////////////////////////////// // Classes extends or implements // Classes in Composer foreach ($packagistClassesFullNSChunks as $id => $p) { $this->atomIs('Class')->outIs(array('IMPLEMENTS', 'EXTENDS'))->fullnspathIs($p); $this->prepareQuery(); } $this->atomIs('Class')->outIs(array('IMPLEMENTS', 'EXTENDS'))->fullnspathIs($packagistInterfacesFullNs); $this->prepareQuery(); //////////////////////////////////////////////// // Instanceof // Classes or interfaces in Composer foreach ($packagistClassesFullNSChunks as $id => $p) { $this->atomIs('Instanceof')->outIs('CLASS')->atomIs(array('Nsname', 'Identifier'))->fullnspathIs($p); $this->prepareQuery(); } $this->atomIs('Instanceof')->outIs('CLASS')->atomIs(array('Nsname', 'Identifier'))->fullnspathIs($packagistInterfacesFullNs); $this->prepareQuery(); }