for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Cerbero\FluentApi\Requests;
/**
* Resource request.
*
*/
class Request implements RequestInterface
{
* The HTTP verb.
* @var string
protected $verb;
* The endpoint.
protected $endpoint;
* The options.
* @var array
protected $options = [];
* Set the base API URL.
* @param string $url
* @return void
@return
Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.
Please refer to the PHP core documentation on constructors.
public function __construct($url)
$this->setEndpoint($url);
}
* Set the HTTP verb.
* @param string $verb
* @return $this
public function setVerb($verb)
$this->verb = $verb;
return $this;
* Retrieve the HTTP verb.
* @return string
public function verb()
return $this->verb;
* Set the endpoint.
* @param string $endpoint
public function setEndpoint($endpoint)
$this->normalizeEndpoint($endpoint);
$this->endpoint = $endpoint;
* Normalize the API endpoint.
private function normalizeEndpoint(&$endpoint)
if ($url = $this->endpoint()) {
$endpoint = rtrim($url, '/') . '/' . ltrim($endpoint, '/');
* Retrieve the endpoint.
public function endpoint()
return $this->endpoint;
* Set the options.
* @param array $options
public function setOptions(array $options)
$this->options = array_merge_recursive($this->options(), $options);
* Retrieve the options.
* @return array
public function options()
return $this->options;
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.