diff --git a/src/GTMetrixClient.php b/src/GTMetrixClient.php index 7496e80..005a88d 100644 --- a/src/GTMetrixClient.php +++ b/src/GTMetrixClient.php @@ -182,12 +182,13 @@ public function getBrowser($id) { * @param null|string $browser * @param null|string $httpUser * @param null|string $httpPassword + * @param array $xParams * * @return GTMetrixTest * @throws GTMetrixConfigurationException * @throws GTMetrixException */ - public function startTest($url, $location = null, $browser = null, $httpUser = null, $httpPassword = null) { + public function startTest($url, $location = null, $browser = null, $httpUser = null, $httpPassword = null, array $xParams = []) { $data = array(); $data['url'] = $url; @@ -203,6 +204,9 @@ public function startTest($url, $location = null, $browser = null, $httpUser = n if ($httpPassword) { $data['login-pass'] = $httpPassword; } + if ($xParams) { + $data = array_merge($data, $xParams); + } $result = $this->apiCall('/test', $data); $test = new GTMetrixTest(); @@ -242,6 +246,7 @@ public function getTestStatus($test) { $test->setConnectDuration($testStatus['results']['connect_duration']); $test->setBackendDuration($testStatus['results']['backend_duration']); $test->setFirstPaintTime($testStatus['results']['first_paint_time']); + $test->setFirstContentfulPaintTime($testStatus['results']['first_contentful_paint_time']); $test->setDomInteractiveTime($testStatus['results']['dom_interactive_time']); $test->setDomContentLoadedTime($testStatus['results']['dom_content_loaded_time']); $test->setDomContentLoadedDuration($testStatus['results']['dom_content_loaded_duration']); diff --git a/src/GTMetrixTest.php b/src/GTMetrixTest.php index c22351c..0623b4a 100644 --- a/src/GTMetrixTest.php +++ b/src/GTMetrixTest.php @@ -92,6 +92,11 @@ class GTMetrixTest { * @var int */ protected $firstPaintTime; + + /** + * @var int + */ + protected $firstContentfulPaintTime; /** * @var int @@ -359,6 +364,20 @@ public function setFirstPaintTime($firstPaintTime) { $this->firstPaintTime = $firstPaintTime; } + /** + * @return int + */ + public function getFirstContentfulPaintTime() { + return $this->firstContentfulPaintTime; + } + + /** + * @param int $firstPaintTime + */ + public function setFirstContentfulPaintTime($firstContentfulPaintTime) { + $this->firstContentfulPaintTime = $firstContentfulPaintTime; + } + /** * @return int */