for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Barenote;
use Barenote\Domain\Credentials;
use Barenote\Domain\Token;
use Barenote\Endpoint\Authentication;
use Barenote\Endpoint\Notes;
use Barenote\Transport\HttpfulTransport;
use Barenote\Transport\Transport;
class BarenoteClient
{
/**
* @var Transport
*/
private $transport;
private $endpoints = [];
* BarenoteClient constructor.
* @param string $host
public function __construct(string $host)
$this->transport = new HttpfulTransport();
$this->transport->setHost($host);
$this->endpoints['authentication'] = new Authentication($this->transport);
$this->endpoints['notes'] = new Notes($this->transport);
}
public function authenticate(string $username, string $password): Token
$credentials = new Credentials($username, $password);
$token = $this->getAuthenticationEndpoint()->authenticate($credentials);
$this->transport->setToken($token);
return $token;
* @return Authentication
private function getAuthenticationEndpoint()
return $this->endpoints['authentication'];
* @return Notes
public function getNotesEndpoint()
return $this->endpoints['notes'];