/** * @param array $files * @return Result */ public function analyse(array $files) { foreach ($files as $file) { $this->currentFilePath = $file; $this->currentFile = []; $statements = $this->parser->parse(file_get_contents($file)); if (is_array($statements) || $statements instanceof Node) { $this->traverser->traverse($statements); } } return $this->result; }
/** * Get training objects * @param int $index optional index * @return TrainingObject training object */ public final function object($index = 0) { if (is_null($this->Parser)) { Error::getInstance()->addError('Parser of Importer is empty. Returned default TrainingObject.'); return new TrainingObject(DataObject::$DEFAULT_ID); } return $this->Parser->object($index); }
/** * Constructor * @param string $FileContent file content */ public function __construct($FileContent) { parent::__construct($FileContent); $this->TrainingObject = new TrainingObject(DataObject::$DEFAULT_ID); }
/** * Tests the debug method. * * It is expected that the `debug` method, * * * invokes the event dispatcher. * * @return void */ public function testDebug() { // set up mocks for the dispatcher and the generated event. $event_dispatcher = $this->getMock('sfEventDispatcher', array('notify')); $event = $this->getMock('sfEvent', array('getReturnValue'), array($this->fixture, 'system.debug', array('message' => 'body'))); // the event dispatcher's notify method will be invoken and return the // expected event $event_dispatcher->expects($this->once())->method('notify')->will($this->returnValue($event)); // we will let the event return true to test whether the return value // is actually returned $event->expects($this->once())->method('getReturnValue')->will($this->returnValue(true)); // test without setting the dispatcher ParserAbstract::$event_dispatcher = $event_dispatcher; $this->fixture->debug('body'); }