Copyright 2010-2016 Horde LLC (http://www.horde.org/) See the enclosed file COPYING for license information (LGPL). If you did not receive this file, see http://www.horde.org/licenses/lgpl21.
Author: Gunnar Wrobel (wrobel@pardus.de)
Example #1
0
 /**
  * Return the path to the template directory
  *
  * @return string The path to the template directory.
  */
 public function getTemplateDirectory()
 {
     $options = $this->_config->getOptions();
     if (!isset($options['templatedir'])) {
         return Components_Constants::getDataDirectory();
     } else {
         return $options['templatedir'];
     }
 }
Example #2
0
 /**
  * Run the task.
  *
  * @param array &$options Additional options.
  *
  * @return integer Number of errors.
  */
 public function run(&$options)
 {
     $lib = realpath($this->_config->getPath() . '/lib');
     $renderer = new PHP_PMD_Renderer_TextRenderer();
     $renderer->setWriter(new PHP_PMD_Writer_Stream(STDOUT));
     $ruleSetFactory = new PHP_PMD_RuleSetFactory();
     $ruleSetFactory->setMinimumPriority(PHP_PMD_AbstractRule::LOWEST_PRIORITY);
     $phpmd = new PHP_PMD();
     $phpmd->processFiles($lib, Components_Constants::getDataDirectory() . '/qc_standards/phpmd.xml', array($renderer), $ruleSetFactory);
     return $phpmd->hasViolations();
 }
Example #3
0
 /**
  * Constructor.
  *
  */
 public function __construct(Horde_Argv_Parser $parser)
 {
     $this->_parser = $parser;
     $parser->addOption(new Horde_Argv_Option('-c', '--config', array('action' => 'store', 'help' => sprintf('the path to the configuration file for the components script (default : %s).', Components_Constants::getConfigFile()), 'default' => Components_Constants::getConfigFile())));
     $parser->addOption(new Horde_Argv_Option('-q', '--quiet', array('action' => 'store_true', 'help' => 'Reduce output to a minimum')));
     $parser->addOption(new Horde_Argv_Option('-v', '--verbose', array('action' => 'store_true', 'help' => 'Reduce output to a maximum')));
     $parser->addOption(new Horde_Argv_Option('-P', '--pretend', array('action' => 'store_true', 'help' => 'Just pretend and indicate what would be done rather than performing the action.')));
     $parser->addOption(new Horde_Argv_Option('-N', '--nocolor', array('action' => 'store_true', 'help' => 'Avoid colors in the output')));
     $parser->addOption(new Horde_Argv_Option('-t', '--templatedir', array('action' => 'store', 'help' => 'Location of a template directory that contains template definitions (see the data directory of this package to get an impression of which templates are available).')));
     $parser->addOption(new Horde_Argv_Option('-D', '--destination', array('action' => 'store', 'help' => 'Path to an (existing) destination directory where any output files will be placed.')));
     $parser->addOption(new Horde_Argv_Option('-R', '--pearrc', array('action' => 'store', 'help' => 'the path to the configuration of the PEAR installation you want to use for all PEAR based actions (leave empty to use your system default PEAR environment).')));
     $parser->addOption(new Horde_Argv_Option('--allow-remote', array('action' => 'store_true', 'help' => 'allow horde-components to access the remote http://pear.horde.org for dealing with stable releases. This option is not required in case you work locally in your git checkout and will only work for some actions that are able to operate on stable release packages.')));
     $parser->addOption(new Horde_Argv_Option('-G', '--commit', array('action' => 'store_true', 'help' => 'Commit any changes during the selected action to git.')));
     $parser->addOption(new Horde_Argv_Option('--horde-root', array('action' => 'store', 'help' => 'The root of the Horde git repository.')));
     list($this->_options, $this->_arguments) = $this->_parser->parseArgs();
 }
Example #4
0
 /**
  * Run the task.
  *
  * @param array &$options Additional options.
  *
  * @return integer Number of errors.
  */
 public function run(&$options)
 {
     $old_dir = getcwd();
     $lib = realpath($this->_config->getPath() . '/lib');
     $argv = $_SERVER['argv'];
     $argc = $_SERVER['argv'];
     $_SERVER['argv'] = array();
     $_SERVER['argc'] = 0;
     define('PHPCS_DEFAULT_WARN_SEV', 0);
     $phpcs = new PHP_CodeSniffer();
     $phpcs->process($lib, Components_Constants::getDataDirectory() . '/qc_standards/phpcs.xml');
     $_SERVER['argv'] = $argv;
     $_SERVER['argc'] = $argc;
     chdir($old_dir);
     return $phpcs->reporting->printReport('emacs', false, null);
 }
Example #5
0
 private function _getFileConfig()
 {
     $path = Components_Constants::getConfigFile();
     return new Components_Config_File($path . '.dist');
 }