Conditions | 18 |
Paths | 18 |
Total Lines | 38 |
Code Lines | 37 |
Lines | 0 |
Ratio | 0 % |
Changes | 9 | ||
Bugs | 0 | Features | 3 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
38 | public function getProvider(string $id): IProvider { |
||
39 | switch ($id) { |
||
40 | case SipGate::PROVIDER_ID: |
||
41 | return $this->container->query(SipGate::class); |
||
|
|||
42 | case PuzzelSMS::PROVIDER_ID: |
||
43 | return $this->container->query(PuzzelSMS::class); |
||
44 | case PlaySMS::PROVIDER_ID: |
||
45 | return $this->container->query(PlaySMS::class); |
||
46 | case SMSGlobal::PROVIDER_ID: |
||
47 | return $this->container->query(SMSGlobal::class); |
||
48 | case WebSms::PROVIDER_ID: |
||
49 | return $this->container->query(WebSms::class); |
||
50 | case ClockworkSMS::PROVIDER_ID: |
||
51 | return $this->container->query(ClockworkSMS::class); |
||
52 | case EcallSMS::PROVIDER_ID: |
||
53 | return $this->container->query(EcallSMS::class); |
||
54 | case VoipMs::PROVIDER_ID: |
||
55 | return $this->container->query(VoipMs::class); |
||
56 | case Voipbuster::PROVIDER_ID: |
||
57 | return $this->container->query(Voipbuster::class); |
||
58 | case HuaweiE3531::PROVIDER_ID: |
||
59 | return $this->container->query(HuaweiE3531::class); |
||
60 | case Sms77Io::PROVIDER_ID: |
||
61 | return $this->container->query(Sms77Io::class); |
||
62 | case Ovh::PROVIDER_ID: |
||
63 | return $this->container->query(Ovh::class); |
||
64 | case SpryngSMS::PROVIDER_ID: |
||
65 | return $this->container->query(SpryngSMS::class); |
||
66 | case ClickatellCentral::PROVIDER_ID: |
||
67 | return $this->container->query(ClickatellCentral::class); |
||
68 | case ClickatellPortal::PROVIDER_ID: |
||
69 | return $this->container->query(ClickatellPortal::class); |
||
70 | case ClickSend::PROVIDER_ID: |
||
71 | return $this->container->query(ClickSend::class); |
||
72 | case SerwerSMS::PROVIDER_ID: |
||
73 | return $this->container->query(SerwerSMS::class); |
||
74 | default: |
||
75 | throw new InvalidSmsProviderException("Provider <$id> does not exist"); |
||
76 | } |
||
79 |
This function has been deprecated. The supplier of the function has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.