| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | namespace NotificationChannels\Clickatell; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  | use stdClass; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  | use Clickatell\ClickatellException; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  | use Clickatell\Rest; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  | use NotificationChannels\Clickatell\Exceptions\CouldNotSendNotification; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  | class ClickatellClient | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  |     const SUCCESSFUL_SEND = 0; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  |     const AUTH_FAILED = 1; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  |     const INVALID_DEST_ADDRESS = 105; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  |     const INVALID_API_ID = 108; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  |     const CANNOT_ROUTE_MESSAGE = 114; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  |     const DEST_MOBILE_BLOCKED = 121; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |     const DEST_MOBILE_OPTED_OUT = 122; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  |     const MAX_MT_EXCEEDED = 130; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  |     const NO_CREDIT_LEFT = 301; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  |     const INTERNAL_ERROR = 901; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |      * @var Rest | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |     private $clickatell; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |      * @param Rest $clickatellRest | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |     public function __construct(Rest $clickatellRest) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |         $this->clickatell = $clickatellRest; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |      * @param array $to String or Array of numbers | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |      * @param string $message | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |     public function send(array $to, $message) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |         $to = collect($to)->toArray(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |         try { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |             $response = $this->clickatell->sendMessage($to, $message); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |         } catch (ClickatellException $e) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |             throw CouldNotSendNotification::serviceRespondedWithAnError( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |                 (string) $e, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |                 $errorCode | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |             ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |      * @return array | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 56 |  |  |      */ | 
            
                                                                        
                            
            
                                    
            
            
                | 57 |  |  |     public function getFailedQueueCodes() | 
            
                                                                        
                            
            
                                    
            
            
                | 58 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 59 |  |  |         return [ | 
            
                                                                        
                            
            
                                    
            
            
                | 60 |  |  |             self::AUTH_FAILED, | 
            
                                                                        
                            
            
                                    
            
            
                | 61 |  |  |             self::INVALID_DEST_ADDRESS, | 
            
                                                                        
                            
            
                                    
            
            
                | 62 |  |  |             self::INVALID_API_ID, | 
            
                                                                        
                            
            
                                    
            
            
                | 63 |  |  |             self::CANNOT_ROUTE_MESSAGE, | 
            
                                                                        
                            
            
                                    
            
            
                | 64 |  |  |             self::DEST_MOBILE_BLOCKED, | 
            
                                                                        
                            
            
                                    
            
            
                | 65 |  |  |             self::DEST_MOBILE_OPTED_OUT, | 
            
                                                                        
                            
            
                                    
            
            
                | 66 |  |  |             self::MAX_MT_EXCEEDED, | 
            
                                                                        
                            
            
                                    
            
            
                | 67 |  |  |         ]; | 
            
                                                                        
                            
            
                                    
            
            
                | 68 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  |      * @return array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  |     public function getRetryQueueCodes() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  |         return [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  |             self::NO_CREDIT_LEFT, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  |             self::INTERNAL_ERROR, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  |         ]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 80 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 81 |  |  |  | 
            
                        
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.
In this case you can add the
@ignorePhpDoc annotation to the duplicate definition and it will be ignored.