/** * (non-PHPdoc) * @see PHP_CodeSniffer_Sniff::register() */ public function register() { // get range from config $minVersion = Foobugs_Standard_RunHelper::getPhpReferenceVersion(); $maxVersion = Foobugs_Standard_RunHelper::getPhpTargetVersion(); // load configuration and test $success = Foobugs_Standard_ConfigHelper::configureSniff($this, $maxVersion, $minVersion); if (!$success) { Foobugs_Standard_RunHelper::markSniffSkipped(get_class($this)); return array(); } // TODO load configuration for range return $this->fooRegisterToken; }
<?php // try composer autoloading $autoloaders = array(dirname(__FILE__) . '/vendor/autoload.php', dirname(__FILE__) . '/../../autoload.php', dirname(__FILE__) . '/../../../../../autoload.php', dirname(__FILE__) . '/autoload.php'); foreach ($autoloaders as $autoloaderPath) { if (file_exists($autoloaderPath)) { require_once $autoloaderPath; break; } } if (!class_exists('Foobugs_Standard_AbstractStandard', true)) { // TODO die properly } unset($autoloaders); // prepare for run Foobugs_Standard_RunHelper::reset(); Foobugs_Standard_ConfigHelper::setConfigPath(dirname(__FILE__) . '/config/');
/** * Set path to sniff config files. * * @param string $path */ public static function setConfigPath($path) { self::$path = $path; }