Kahlan\Reporter\Coverage\Exporter\Istanbul::write PHP Method

write() public static method

Writes a coverage to an ouput file.
public static write ( array $options ) : boolean
$options array The option where the possible values are: -`'file'` _string_: The output file name.
return boolean
    public static function write($options)
    {
        $defaults = ['file' => null];
        $options += $defaults;
        if (!($file = $options['file'])) {
            throw new RuntimeException("Missing file name");
        }
        unset($options['file']);
        return file_put_contents($file, static::export($options));
    }

Usage Example

示例#1
0
 /**
  * The default `'reporting'` filter.
  */
 protected function _reporting()
 {
     return Filter::on($this, 'reporting', [], function ($chain) {
         $reporter = $this->reporters()->get('coverage');
         if (!$reporter) {
             return;
         }
         if ($this->args()->exists('clover')) {
             Clover::write(['collector' => $reporter, 'file' => $this->args()->get('clover')]);
         }
         if ($this->args()->exists('istanbul')) {
             Istanbul::write(['collector' => $reporter, 'file' => $this->args()->get('istanbul')]);
         }
         if ($this->args()->exists('lcov')) {
             Lcov::write(['collector' => $reporter, 'file' => $this->args()->get('lcov')]);
         }
     });
 }
All Usage Examples Of Kahlan\Reporter\Coverage\Exporter\Istanbul::write