Add a constructor
Signed-off-by: Maurício Meneghini Fauth <mauriciofauth@gmail.com>
This commit is contained in:
parent
d60f28e441
commit
eaae50a1bc
@ -9,6 +9,7 @@ use PhpMyAdmin\ErrorReport;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Response;
|
||||
use PhpMyAdmin\UserPreferences;
|
||||
use PhpMyAdmin\Utils\HttpRequest;
|
||||
|
||||
require_once 'libraries/common.inc.php';
|
||||
|
||||
@ -20,7 +21,7 @@ if (!isset($_REQUEST['exception_type'])
|
||||
|
||||
$response = Response::getInstance();
|
||||
|
||||
$errorReport = new ErrorReport();
|
||||
$errorReport = new ErrorReport(new HttpRequest());
|
||||
|
||||
if (isset($_REQUEST['send_error_report'])
|
||||
&& ($_REQUEST['send_error_report'] == true
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Error reporting functions used to generate and submit error reports
|
||||
* Holds the PhpMyAdmin\ErrorReport class
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
@ -10,11 +10,10 @@ namespace PhpMyAdmin;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Template;
|
||||
use PhpMyAdmin\Url;
|
||||
use PhpMyAdmin\Util;
|
||||
use PhpMyAdmin\Utils\HttpRequest;
|
||||
|
||||
/**
|
||||
* PhpMyAdmin\ErrorReport class
|
||||
* Error reporting functions used to generate and submit error reports
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
@ -22,8 +21,26 @@ class ErrorReport
|
||||
{
|
||||
/**
|
||||
* the url where to submit reports to
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const SUBMISSION_URL = "https://reports.phpmyadmin.net/incidents/create";
|
||||
private $submissionUrl;
|
||||
|
||||
/**
|
||||
* @var HttpRequest
|
||||
*/
|
||||
private $httpRequest;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param HttpRequest $httpRequest HttpRequest instance
|
||||
*/
|
||||
public function __construct(HttpRequest $httpRequest)
|
||||
{
|
||||
$this->httpRequest = $httpRequest;
|
||||
$this->submissionUrl = 'https://reports.phpmyadmin.net/incidents/create';
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the pretty printed error report data collected from the
|
||||
@ -179,9 +196,8 @@ class ErrorReport
|
||||
*/
|
||||
public function send(array $report)
|
||||
{
|
||||
$httpRequest = new HttpRequest();
|
||||
$response = $httpRequest->create(
|
||||
self::SUBMISSION_URL,
|
||||
$response = $this->httpRequest->create(
|
||||
$this->submissionUrl,
|
||||
"POST",
|
||||
false,
|
||||
json_encode($report),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user