/** * Destructor function. * * Closes the file and the log. */ public function __destruct() { if (is_resource($this->fp)) { fclose($this->fp); } if ($this->log instanceof Log) { $this->log->close(); } }
/** * Destructor. * * @access public * @return void */ public function __destruct() { /* End of processing time in microseconds */ list($usec, $sec) = explode(' ', microtime()); $end = (double) $sec + (double) $usec; /* Calculate elapsed time in seconds. */ $time = round($end - $this->start, 5); /* Log elapsed time */ $this->log->log("Elapsed time: " . $time . " sec"); /* Close log */ if ($this->log instanceof Log) { $this->log->close(); } }