| Conditions | 1 | 
| Paths | 1 | 
| Total Lines | 58 | 
| Code Lines | 52 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
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 | ||
| 30 | public function init() | ||
| 31 |     { | ||
| 32 |         $this->ipag = new Ipag(new Authentication(getenv('ID_IPAG'), getenv('API_KEY')), Endpoint::SANDBOX); | ||
| 33 | |||
| 34 | $this->transaction = $this->ipag->transaction(); | ||
| 35 | |||
| 36 | $cart = $this->ipag->cart( | ||
| 37 | ['APC Flotador Universal Perol 5 Litros', 55.9, 2, '000347'], | ||
| 38 | ['Aplicador de gel para pneus Cadillac', 10, 2, '001567'], | ||
| 39 | ['Escova Azul para Furo de Rodas Mandala', 35.9, 2, 'E01'], | ||
| 40 | ['Polidor de Corte LPD Hi Cut + Lincoln 1K (nova fórmula)', 148.9, 1, '002053'], | ||
| 41 | ['Lava Auto Shampoo Super Concentrado 1:300 Monster Cadillac 2L', 37.05, 2, '001646'], | ||
| 42 | ['Balde com Protetor de Areia Ultimate Filter GF', 60.9, 1, '001549'], | ||
| 43 | ['Balde com Protetor de Areia Ultimate Filter GF', 60.9, 1, '001549'], | ||
| 44 | ['Removedor de Piche Tar Remover Sonax 300ml', 54, 1, '000586'], | ||
| 45 | ['Boina de Espuma Super Macia Preta Waffle Mills 7.8\'', 60, 1, '001004'], | ||
| 46 | ['Cera de Carnaúba Cleaner Wax Cadillac 300gr', 79.9, 1, '000312'], | ||
| 47 | ['Cera de Carnaúba Lincoln 200g', 72.5, 1, '001051'], | ||
| 48 | ['Vonixx Cera de Carnaúba Super Protetora', 52, 1, '001455'], | ||
| 49 | ['Vonixx Revitalizador de Pneus 500ml', 32, 1, '001479'], | ||
| 50 | ['Boina de Espuma Médio Agressiva Dune Alcance 5\' ', 41.5, 1, '002333'], | ||
| 51 | ['Boina Lã S/Interface Corte Lincoln 6\' (listra Colorida)', 39, 1, '001891'], | ||
| 52 | ['Desinfetante BAC 500 Perol 5L', 66.9, 1, '001286'], | ||
| 53 | ['Escova Caixa de Roda Cadillac', 39.9, 1, '000544'], | ||
| 54 | ['Escova para Estofados (cerdas de silicone) Cadillac', 36.9, 1, '001488'], | ||
| 55 | ['Lavagem a Seco Affix Perol 5L', 216.9, 1, '000499'], | ||
| 56 | ['POLIDOR DE METAIS METAL-LAC CADILLAC 150G', 37.9, 1, '831676'], | ||
| 57 | ['Vonixx Restaurax 500ml', 32.9, 1, '001478'], | ||
| 58 | ['Revitalizador de Plásticos Doctor Shine Cadillac 500ml', 34.1, 1, '002020'], | ||
| 59 | ['Menzerna Selante Power Lock Ultimate Protection 1L', 251.9, 1, '001423'], | ||
| 60 | ['Pneu Visco Cadillac 5L', 43.6, 1, '000265'], | ||
| 61 | ['Metal Polish Optimum 227g', 83, 1, '001910'], | ||
| 62 | ['Nano Pro (Profiline) Perfect Finish Sonax - 400g', 109.9, 1, '000427'], | ||
| 63 | ['OXICLEAN – REMOVEDOR DE CHUVA ÁCIDA', 45.9, 1, '001513'], | ||
| 64 | ['Pasta Abrasiva 3M Cleaner Clay + Brinde Limpeza Final 3M 500ml', 86.9, 1, '000279'], | ||
| 65 | ['Shampoo automotivo Espumacar Cadillac 5L', 28, 1, '000266'], | ||
| 66 | ['Suporte c/ Velcro Ventilado 5\' p/ Roto 21 - Cadillac ou Kers', 56.9, 1, '001547'], | ||
| 67 | ['Toalha de Microfibra Cadillac 40x40 cm', 9.9, 1, '001554'], | ||
| 68 | ['Boina de Espuma Agressiva Azul Spider Scholl 6.5\'', 113.5, 1, 'BSA165'], | ||
| 69 | ['Ironlac Descontaminante de Superfícies Cadillac 5L', 113.9, 1, '001824'], | ||
| 70 | ['Lustrador Alto Brilho 2x1 Lincoln', 39.9, 1, '000086'], | ||
| 71 | ['Meguiars Espuma Aplicadora', 11.23, 1, '000558'], | ||
| 72 | ['Melamina Kers - Esponja Mágica', 11.9, 1, '001406'], | ||
| 73 | ['Escova Pneus Cadillac', 40.9, 1, '000573'], | ||
| 74 | ['Mini Politriz Roto Orbital Yes GFX-5802 220V + Kit Pincel Kers', 1100, 1, '002165'] | ||
| 75 | ); | ||
| 76 | |||
| 77 | $this->transaction->getOrder() | ||
| 78 |             ->setOrderId(date('mdHis')) | ||
| 79 |             ->setCallbackUrl(getenv('CALLBACK_URL')) | ||
| 80 | ->setAmount(10.00) | ||
| 81 | ->setInstallments(1) | ||
| 82 |             ->setVisitorId('9as7d8s9a7da9sd7sa9889a') | ||
| 83 | ->setPayment($this->ipag->payment() | ||
| 84 | ->setMethod(Method::VISA) | ||
| 85 | ->setCreditCard($this->initCard()) | ||
| 86 | )->setCustomer($this->initCustomer()) | ||
| 87 | ->setCart($cart); | ||
| 88 | } | ||
| 219 |