Conditions | 6 |
Paths | 5 |
Total Lines | 18 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
45 | public function match(SmsInterface $sms) |
||
46 | { |
||
47 | foreach ($this->gateways as $gateway) { |
||
48 | if (!$this->supports($gateway)) { |
||
49 | throw new InvalidGatewayException(); |
||
50 | } |
||
51 | |||
52 | foreach ($gateway->getPrefixCodes() as $prefixCode) { |
||
53 | $recipient = $sms->getRecipient(); |
||
54 | |||
55 | if ($prefixCode != '' && strrpos($recipient, $prefixCode, -strlen($recipient)) !== false) { |
||
56 | return $gateway; |
||
57 | } |
||
58 | } |
||
59 | } |
||
60 | |||
61 | return null; |
||
62 | } |
||
63 | |||
72 |