| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | namespace Integracao\ControlPay\API; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  | use GuzzleHttp\Exception\RequestException; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  | use Integracao\ControlPay\AbstractAPI; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  | use Integracao\ControlPay\Client; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  | use Integracao\ControlPay\Helpers\SerializerHelper; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  | use Integracao\ControlPay\Contracts; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  |  * Class IntencaoVendaApi | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  |  * @package Integracao\ControlPay\API | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  | class IntencaoVendaApi extends AbstractAPI | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  |      * IntencaoVendaApi constructor. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  |     public function __construct(Client $client = null) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |         parent::__construct('intencaoVenda', $client); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |      * @param Contracts\IntencaoVenda\GetByFiltrosRequest $getByFiltrosRequest | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |      * @return Contracts\IntencaoVenda\GetByFiltrosResponse | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |      * @throws \Exception | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |     public function getByFiltros(Contracts\IntencaoVenda\GetByFiltrosRequest $getByFiltrosRequest) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |         try{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |             $response = $this->_httpClient->post(__FUNCTION__,[ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |                 'body' => json_encode($getByFiltrosRequest), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |             ]); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |             return SerializerHelper::denormalize( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |                 $response->json(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |                 Contracts\IntencaoVenda\GetByFiltrosResponse::class | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |             ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |         }catch (RequestException $ex) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |             $responseBody = $ex->getResponse()->json(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |             throw new \Exception($responseBody['message']); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |         }catch (\Exception $ex){ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |             throw new \Exception($ex->getMessage(), $ex->getCode(), $ex); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |      * @param integer $intencaoVendaId | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |      * @return Contracts\IntencaoVenda\GetByFiltrosResponse | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |      * @throws \Exception | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |     public function getById($intencaoVendaId) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |         try{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  |             $response = $this->_httpClient->post(__FUNCTION__,[ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  |                 'query' => $this->addQueryAdditionalParameters([ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  |                     'intencaoVendaId' => $intencaoVendaId | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  |                 ]) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  |             ]); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  |             return SerializerHelper::denormalize( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  |                 $response->json(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  |                 Contracts\IntencaoVenda\GetByIdResponse::class | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  |             ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  |         }catch (RequestException $ex) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  |             $responseBody = $ex->getResponse()->json(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  |             throw new \Exception($responseBody['message']); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  |         }catch (\Exception $ex){ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  |             throw new \Exception($ex->getMessage(), $ex->getCode(), $ex); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  | //    /** | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  | //     * API Provavelmente descontinuada | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  | //     * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  | //     * @param Contracts\IntencaoVenda\GetByIntegracaoIdRequest $getByIntegracaoIdRequest | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 80 |  |  | //     * @return Contracts\IntencaoVenda\GetByIntegracaoIdResponse | 
            
                                                                        
                            
            
                                    
            
            
                | 81 |  |  | //     * @throws \Exception | 
            
                                                                        
                            
            
                                    
            
            
                | 82 |  |  | //     */ | 
            
                                                                        
                            
            
                                    
            
            
                | 83 |  |  | //    public function getByIntegracaoId(Contracts\IntencaoVenda\GetByIntegracaoIdRequest $getByIntegracaoIdRequest) | 
            
                                                                        
                            
            
                                    
            
            
                | 84 |  |  | //    { | 
            
                                                                        
                            
            
                                    
            
            
                | 85 |  |  | //        try{ | 
            
                                                                        
                            
            
                                    
            
            
                | 86 |  |  | //            $response = $this->_httpClient->post(__FUNCTION__,[ | 
            
                                                                        
                            
            
                                    
            
            
                | 87 |  |  | //                'body' => json_encode($getByIntegracaoIdRequest), | 
            
                                                                        
                            
            
                                    
            
            
                | 88 |  |  | //            ]); | 
            
                                                                        
                            
            
                                    
            
            
                | 89 |  |  | // | 
            
                                                                        
                            
            
                                    
            
            
                | 90 |  |  | //            return SerializerHelper::denormalize( | 
            
                                                                        
                            
            
                                    
            
            
                | 91 |  |  | //                $response->json(), | 
            
                                                                        
                            
            
                                    
            
            
                | 92 |  |  | //                Contracts\IntencaoVenda\GetByIntegracaoIdResponse::class | 
            
                                                                        
                            
            
                                    
            
            
                | 93 |  |  | //            ); | 
            
                                                                        
                            
            
                                    
            
            
                | 94 |  |  | //        }catch (RequestException $ex) { | 
            
                                                                        
                            
            
                                    
            
            
                | 95 |  |  | //            $responseBody = $ex->getResponse()->json(); | 
            
                                                                        
                            
            
                                    
            
            
                | 96 |  |  | //            throw new \Exception($responseBody['message']); | 
            
                                                                        
                            
            
                                    
            
            
                | 97 |  |  | //        }catch (\Exception $ex){ | 
            
                                                                        
                            
            
                                    
            
            
                | 98 |  |  | //            throw new \Exception($ex->getMessage(), $ex->getCode(), $ex); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 99 |  |  | //        } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 100 |  |  | //    } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 101 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 102 |  |  | } | 
            
                        
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.