1 | <?php |
||
2 | |||
3 | namespace Azine\MailgunWebhooksBundle\Services; |
||
4 | |||
5 | use Azine\MailgunWebhooksBundle\Entity\MailgunEvent; |
||
6 | use Azine\MailgunWebhooksBundle\Entity\Repositories\MailgunEventRepository; |
||
7 | use Symfony\Bridge\Doctrine\ManagerRegistry; |
||
0 ignored issues
–
show
|
|||
8 | |||
9 | class AzineMailgunCockpitService |
||
10 | { |
||
11 | private $emailDomain; |
||
12 | /** @var ManagerRegistry */ |
||
13 | private $managerRegistry; |
||
14 | /** @var \Twig_Environment */ |
||
15 | private $twig; |
||
16 | |||
17 | private $cachedLastKnownIp; |
||
18 | |||
19 | public function __construct(ManagerRegistry $managerRegistry, \Twig_Environment $twig, $emailDomain) |
||
20 | { |
||
21 | $this->emailDomain = $emailDomain; |
||
22 | $this->managerRegistry = $managerRegistry; |
||
23 | $this->twig = $twig; |
||
24 | } |
||
25 | |||
26 | public function getLastKnownSenderIp() |
||
27 | { |
||
28 | if (is_null($this->cachedLastKnownIp)) { |
||
29 | /** @var MailgunEventRepository $eventRepository */ |
||
30 | $eventRepository = $this->managerRegistry->getRepository(MailgunEvent::class); |
||
31 | $lastKnownIp = null; |
||
32 | $ipAddressData = $eventRepository->getLastKnownSenderIpData(); |
||
0 ignored issues
–
show
Are you sure the assignment to
$ipAddressData is correct as $eventRepository->getLastKnownSenderIpData() targeting Azine\MailgunWebhooksBun...LastKnownSenderIpData() seems to always return null.
This check looks for function or method calls that always return null and whose return value is assigned to a variable. class A
{
function getObject()
{
return null;
}
}
$a = new A();
$object = $a->getObject();
The method The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes. ![]() |
|||
33 | |||
34 | if (isset($ipAddressData['id'])) { |
||
35 | $lastKnownIp = $ipAddressData['id']; |
||
36 | } |
||
37 | |||
38 | $this->cachedLastKnownIp = $lastKnownIp; |
||
39 | } else { |
||
40 | $lastKnownIp = $this->cachedLastKnownIp; |
||
41 | } |
||
42 | |||
43 | return $this->getValueOrEmptyString($lastKnownIp); |
||
44 | } |
||
45 | |||
46 | public function getEmailDomain() |
||
47 | { |
||
48 | return $this->getValueOrEmptyString($this->emailDomain); |
||
49 | } |
||
50 | |||
51 | public function getCockpitDataAsArray() |
||
52 | { |
||
53 | return array( |
||
54 | 'lastKnownIp' => $this->getLastKnownSenderIp(), |
||
55 | 'emailDomain' => $this->getEmailDomain(), |
||
56 | ); |
||
57 | } |
||
58 | |||
59 | private function getValueOrEmptyString($value) |
||
60 | { |
||
61 | return is_null($value) ? '' : $value; |
||
62 | } |
||
63 | } |
||
64 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths