silverstripe-environmentcheck/src/Traits/Fetcher.php

52 lines
862 B
PHP
Raw Normal View History

2019-02-14 23:30:51 +01:00
<?php
namespace SilverStripe\EnvironmentCheck\Traits;
use SilverStripe\Control\Director;
2019-02-14 23:30:51 +01:00
/**
* Simple helper for env checks which require HTTP clients.
2019-02-14 23:30:51 +01:00
*
* @package environmentcheck
*/
trait Fetcher
{
/**
* Client for making requests, set vi Injector.
2019-02-14 23:30:51 +01:00
*
* @see SilverStripe\EnvironmentCheck\Services
*
* @var GuzzleHttp\Client
*/
public $client = null;
/**
* Absolute URL for requests.
*
* @var string
2019-02-14 23:30:51 +01:00
*/
protected $url;
2019-02-14 23:30:51 +01:00
/**
* Set URL for requests.
2019-02-14 23:30:51 +01:00
*
* @param string $url Relative URL
* @return self
2019-02-14 23:30:51 +01:00
*/
public function setURL($url)
2019-02-14 23:30:51 +01:00
{
$this->url = Director::absoluteURL($url);
return $this;
2019-02-14 23:30:51 +01:00
}
/**
* Getter for URL
2019-02-14 23:30:51 +01:00
*
* @return string
2019-02-14 23:30:51 +01:00
*/
public function getURL()
2019-02-14 23:30:51 +01:00
{
return $this->url;
2019-02-14 23:30:51 +01:00
}
}