Beberlei\Metrics\Collector\Graphite::flush PHP Method

flush() public method

public flush ( )
    public function flush()
    {
        if (!$this->data) {
            return;
        }
        try {
            $fp = fsockopen($this->protocol . '://' . $this->host, $this->port);
            if (!$fp) {
                return;
            }
            foreach ($this->data as $line) {
                fwrite($fp, $line);
            }
            fclose($fp);
        } catch (Exception $e) {
        }
        $this->data = array();
    }