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