for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Raidros\Storer;
class Endpoint
{
protected $method;
protected $uri;
protected $transformers;
/**
* Setup a new endpoint.
*
* @param string
*/
public function __construct($method, $uri)
$this->method = $method;
$this->uri = $uri;
$this->transformers = [];
}
* Add a transformer to a endpoint response.
* @param Raidros\Storer\Transformer $transformer
* @param string $type
* @return Raidros\Storer\Transformer
public function transformer(Transformer $transformer, $type = 'response')
$this->transformers[$type] = $transformer;
return $this;
* get the endpoint method.
* @return string
public function getMethod()
return strtoupper($this->method);
* get the endpoint uri.
* @param array $data
public function getUri($data = null)
if (isset($data['uriData'])) {
$this->uri = str_replace('{params}', implode('/', $data['uriData']), $this->uri);
return $this->uri;
* Get the endpoint transformer.
public function getTransformer($type = 'response')
return isset($this->transformers[$type]) ? $this->transformers[$type] : null;