/** * initalize the factory class * * @return LogCommandFactory */ public static function init() { $class = __CLASS__; return self::$instance = new $class(); }
public function executeShowdiff(sfWebRequest $request) { $this->path = $this->getUser()->getAttribute('path'); $this->data = $this->repository->getAllRevisionForPath($this->repository->getUrl() . "/" . urldecode($this->getUser()->getAttribute('path')), $this->log_command); $this->active = $request->getParameter('action'); $choices = array(); foreach ($this->data as $logentry) { $choices[] = "" . $logentry->getLogRevisionNumber() . ""; } $this->form = new ShowDiffListForm($choices, array('path' => $request->getParameter('path'))); $diff_command_factory = DiffCommandFactory::init(); $diff_command = $diff_command_factory->build($this->type); $this->form->bind(array('revision_left' => $request->getParameter('revision_left'), 'revision_right' => $request->getParameter('revision_right'))); if ($this->form->isValid()) { $parser = $this->repository->getDiffMatrixFromRevision($request->getParameter('revision_right'), $request->getParameter('revision_left'), new DiffParser(), $diff_command); $this->blocks_left = $parser->getLeftBlocks(); $this->blocks_right = $parser->getRightBlocks(); $this->revision_first_id = $request->getParameter('revision_right'); $this->revision_second_id = $request->getParameter('revision_left'); $this->setTemplate('showdiff'); } else { $this->form_invalid = true; $this->setTemplate('showdifflist'); } }