for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* File part of the Redmine User Provider bundle
*
* @category SymfonyBundle
* @package GMaissa.RedmineUserProviderBundle
* @author Guillaume Maïssa <[email protected]>
* @copyright 2017 Guillaume Maïssa
* @license https://opensource.org/licenses/MIT The MIT License (MIT)
*/
namespace GMaissa\RedmineUserProviderBundle\ApiClient\Adapter;
use GMaissa\RedmineUserProviderBundle\ApiClient\RedmineApiClientInterface;
* AWS Ec2 client adapter class
class RedmineClientAdapter implements RedmineApiClientInterface
{
* Redmine API Client Class
* @var string
private $clientClass;
* @var Object
private $client;
private $url;
* Class constructor.
* @param string $url
public function __construct(string $url)
$this->url = $url;
}
* Set the Redmine client Class
* @param string $clientClass
public function setClientClass(string $clientClass)
$this->clientClass = $clientClass;
* Connect to Redmine API
* @param string $login
* @param string $password
public function connect(string $login, string $password)
$this->client = new $this->clientClass($this->url, $login, $password);
* Retrieve a specific API
* @param string $apiName
* @return Object
* @throws \Exception if not connected
public function api(string $apiName)
if (!$this->client instanceof $this->clientClass) {
throw new \Exception('Connection to server not instantiated');
return $this->client->api($apiName);