Esempio n. 1
0
 /**
  * Constructor
  *
  * @param array $config The config array.
  */
 public function __construct($config = [])
 {
     parent::__construct($config);
     $defaults = ['size' => 50, 'preferences' => ['pass' => 'green', 'fail' => 'red', 'incomplete' => 'yellow', 'exception' => 'magenta'], 'chars' => ['bar' => '=', 'indicator' => '>'], 'format' => '[{:b}{:i}] {:p}%'];
     $config += $defaults;
     $config['chars'] += $defaults['chars'];
     $config['preferences'] += $defaults['preferences'];
     foreach ($config as $key => $value) {
         $_key = "_{$key}";
         $this->{$_key} = $value;
     }
     $this->_color = $this->_preferences['pass'];
 }
Esempio n. 2
0
 /**
  * The Constructor.
  *
  * @param array $config The config for the reporter, the options are:
  *                      - `'verbosity`' _integer|string_: The verbosity level:
  *                        - 1      : overall coverage value for the whole code.
  *                        - 2      : overall coverage by namespaces.
  *                        - 3      : overall coverage by classes.
  *                        - 4      : overall coverage by methods and functions.
  *                        - string : coverage for a fully namespaced (class/method/namespace) string.
  */
 public function __construct($config = [])
 {
     parent::__construct($config);
     $defaults = ['verbosity' => 1];
     $config += $defaults;
     $verbosity = $config['verbosity'];
     $this->_verbosity = is_numeric($verbosity) ? (int) $verbosity : (string) $verbosity;
     if (is_string($this->_verbosity)) {
         $class = preg_replace('/(::)?\\w+\\(\\)$/', '', $this->_verbosity);
         $interceptor = static::$_classes['interceptor'];
         $loader = $interceptor::instance();
         if ($loader && ($path = $loader->findPath($class))) {
             $config['path'] = $path;
         }
     }
     $this->_collector = new Collector($config);
 }