for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Swm\Bundle\MailHookBundle\Provider;
use Swm\Bundle\MailHookBundle\ApiService\ApiServiceInterface;
use Symfony\Component\DependencyInjection\Exception\LogicException;
use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
class ApiServiceProvider implements ProviderInterface
{
/**
* @var array
*/
private $apiServiceList = array();
* @param string $apiServiceName
* @return ApiServiceInterface
public function get($apiServiceName)
if (!array_key_exists($apiServiceName, $this->apiServiceList)) {
throw new LogicException("This api service is not allowed");
}
return $this->apiServiceList[$apiServiceName];
* @param ApiServiceInterface $apiService
* @return this
public function setApiService($apiServiceName, ApiServiceInterface $apiService)
$this->apiServiceList[$apiServiceName] = $apiService;
return $this;
* @return string
private function sanitize($apiServiceName)
return strtolower($apiServiceName);