for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Swm\Bundle\MailHookBundle\Service;
use Swm\Bundle\MailHookBundle\ApiService\ApiServiceInterface;
use Swm\Bundle\MailHookBundle\Model as ApiServiceModel;
use Swm\Bundle\MailHookBundle\Provider\ProviderInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
class MailHookService
{
/**
* @var Request
*/
private $request;
* @var ProviderInterface
private $apiServiceModelProvider;
* @param RequestStack $requestStack
* @param ProviderInterface $apiServiceProvider
public function __construct(RequestStack $requestStack, ProviderInterface $apiServiceProvider)
$this->request = $requestStack->getCurrentRequest();
$this->apiServiceProvider = $apiServiceProvider;
apiServiceProvider
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
class MyClass { } $x = new MyClass(); $x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:
class MyClass { public $foo; } $x = new MyClass(); $x->foo = true;
}
* @param string $serviceName
* @return array<HookInterface>
public function getHooksForService($serviceName)
$apiService = $this->apiServiceProvider->get($serviceName)->setRequest($this->request);
return $apiService->bind();
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: