Tester\CodeCoverage\Collector::save PHP Method

save() public static method

Saves information about code coverage. Can be called repeatedly to free memory.
public static save ( ) : void
return void
    public static function save()
    {
        if (!self::isStarted()) {
            throw new \LogicException('Code coverage collector has not been started.');
        }
        list($positive, $negative) = call_user_func([__CLASS__, self::$collector]);
        flock(self::$file, LOCK_EX);
        fseek(self::$file, 0);
        $rawContent = stream_get_contents(self::$file);
        $original = $rawContent ? unserialize($rawContent) : [];
        $coverage = array_replace_recursive($negative, $original, $positive);
        fseek(self::$file, 0);
        ftruncate(self::$file, 0);
        fwrite(self::$file, serialize($coverage));
        flock(self::$file, LOCK_UN);
    }