foreach ($opml->xpath('//outline') as $item) { if ((string) $item['language'] == 'en-gb') { $feed_parser->add((string) $item['xmlUrl']); } } $feed_parser->add('http://www.guardian.co.uk/rss'); $feed_parser->add('http://www.guardian.co.uk/rssfeed/0,,11,00.xml'); $feed_parser->add('http://www.guardian.co.uk/rssfeed/0,,12,00.xml'); $feed_parser->add('http://www.guardian.co.uk/rssfeed/0,,5,00.xml'); $feed_parser->add('http://www.guardian.co.uk/rssfeed/0,,24,00.xml'); $feed_parser->add('http://www.guardian.co.uk/rssfeed/0,15065,19,00.xml'); $feed_parser->add('http://www.guardian.co.uk/rssfeed/0,,18,00.xml'); $feed_parser->add('http://www.guardian.co.uk/rssfeed/0,,7,00.xml'); $feed_parser->add('http://english.aljazeera.net/Services/Rss/?PostingId=2007731105943979989'); echo "DONE\n"; $parser_factory = ParserFactory::create(); function prompt($parser, $item, $category, $locations) { echo "\n" . $item->title() . "\n"; echo $locations[0]['name'] . ' <-> ' . $locations[1]['name'] . "\n"; if ($category) { echo $category['name'] . " ok?\n"; } while (true) { $in = readline('> '); if ($in == 'q') { return; } elseif ($in == 'm') { echo $item->title() . "\n"; echo $item->guid() . "\n"; echo $item->description() . "\n";
/** * This method will process all files that can be found in the given input * path. It will apply rules defined in the comma-separated <b>$ruleSets</b> * argument. The result will be passed to all given renderer instances. * * @param string $inputPath * @param string $ruleSets * @param \PHPMD\AbstractRenderer[] $renderers * @param \PHPMD\RuleSetFactory $ruleSetFactory * @return void */ public function processFiles($inputPath, $ruleSets, array $renderers, RuleSetFactory $ruleSetFactory) { // Merge parsed excludes $this->ignorePatterns = array_merge($this->ignorePatterns, $ruleSetFactory->getIgnorePattern($ruleSets)); $this->input = $inputPath; $report = new Report(); $factory = new ParserFactory(); $parser = $factory->create($this); foreach ($ruleSetFactory->createRuleSets($ruleSets) as $ruleSet) { $parser->addRuleSet($ruleSet); } $report->start(); $parser->parse($report); $report->end(); foreach ($renderers as $renderer) { $renderer->start(); } foreach ($renderers as $renderer) { $renderer->renderReport($report); } foreach ($renderers as $renderer) { $renderer->end(); } $this->violations = !$report->isEmpty(); }
/** * testFactoryConfiguresFileExtensions * * @return void */ public function testFactoryConfiguresFileExtensions() { $factory = new ParserFactory(); $uri = $this->createFileUri('ParserFactory/File/Test.php'); $phpmd = $this->getMock('PHPMD\\PHPMD', array('getFileExtensions', 'getInput')); $phpmd->expects($this->exactly(2))->method('getFileExtensions')->will($this->returnValue(array('.php'))); $phpmd->expects($this->once())->method('getInput')->will($this->returnValue($uri)); $factory->create($phpmd); }