@@ -46,14 +46,14 @@ |
||
| 46 | 46 | $sequence = new Sequence('0104'); |
| 47 | 47 | |
| 48 | 48 | /* @var $customer \MrPrompt\Celesc\Common\Base\Customer */ |
| 49 | - $customer = Factory::createCustomerFromArray(array_shift($lista)['vendedor']); |
|
| 49 | + $customer = Factory::createCustomerFromArray(array_shift($lista)[ 'vendedor' ]); |
|
| 50 | 50 | |
| 51 | 51 | /* @var $dealership \MrPrompt\Celesc\Common\Base\Dealership */ |
| 52 | 52 | $dealership = new Dealership(); |
| 53 | 53 | $dealership->setCode('0001'); |
| 54 | 54 | |
| 55 | 55 | /* @var $exporter \MrPrompt\Celesc\Shipment\File */ |
| 56 | - $exporter = new File($customer, $dealership, $sequence, $today, __DIR__); |
|
| 56 | + $exporter = new File($customer, $dealership, $sequence, $today, __DIR__); |
|
| 57 | 57 | |
| 58 | 58 | $exporter->setCart($cart); |
| 59 | 59 | |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | require __DIR__ . '/bootstrap.php'; |
| 13 | 13 | |
| 14 | 14 | /* @var $lista array */ |
| 15 | -$lista = require __DIR__ . '/cart.php'; |
|
| 15 | +$lista = require __DIR__ . '/cart.php'; |
|
| 16 | 16 | |
| 17 | 17 | try { |
| 18 | 18 | /* @var $importer \MrPrompt\Celesc\Common\Base\Sequence */ |
@@ -83,7 +83,7 @@ |
||
| 83 | 83 | $this->dealership = new Dealership(); |
| 84 | 84 | $this->dealership->setCode(substr($row, 57, 2)); |
| 85 | 85 | |
| 86 | - $this->created = DateTime::createFromFormat('dmY', substr($row, 61, 8)); |
|
| 86 | + $this->created = DateTime::createFromFormat('dmY', substr($row, 61, 8)); |
|
| 87 | 87 | |
| 88 | 88 | $this->occurrence = new Occurrence(); |
| 89 | 89 | $this->occurrence->setReturn(substr($row, 81, 2)); |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | /** |
| 40 | 40 | * @var array |
| 41 | 41 | */ |
| 42 | - private $rows = []; |
|
| 42 | + private $rows = [ ]; |
|
| 43 | 43 | |
| 44 | 44 | /** |
| 45 | 45 | * @var Sequence |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | */ |
| 121 | 121 | public function getCart() |
| 122 | 122 | { |
| 123 | - $this->cart = new Cart(); |
|
| 123 | + $this->cart = new Cart(); |
|
| 124 | 124 | |
| 125 | 125 | /* @var $detail \MrPrompt\Celesc\Received\Partial\Detail */ |
| 126 | 126 | foreach ($this->rows as $row) { |
@@ -63,7 +63,7 @@ |
||
| 63 | 63 | $result = self::TYPE; |
| 64 | 64 | |
| 65 | 65 | // sum of charges values |
| 66 | - $result .= str_pad(str_replace('.', '', $this->sum), 11, Number::FILL, Number::ALIGN); |
|
| 66 | + $result .= str_pad(str_replace('.', '', $this->sum), 11, Number::FILL, Number::ALIGN); |
|
| 67 | 67 | |
| 68 | 68 | // whitespace |
| 69 | 69 | $result .= str_pad(' ', 132, Alphanumeric::FILL, Alphanumeric::ALIGN); |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | |
| 207 | 207 | $this->content .= $detail->render() . PHP_EOL; |
| 208 | 208 | |
| 209 | - $totalPrice += $this->getTotalPrice( $detail->getParcels() ); |
|
| 209 | + $totalPrice += $this->getTotalPrice($detail->getParcels()); |
|
| 210 | 210 | $counter++; |
| 211 | 211 | } |
| 212 | 212 | |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | $this->now |
| 268 | 268 | ); |
| 269 | 269 | |
| 270 | - $this->footer = new Footer( |
|
| 270 | + $this->footer = new Footer( |
|
| 271 | 271 | substr($footerLine, 1, 6), |
| 272 | 272 | substr($footerLine, 7, 10), |
| 273 | 273 | (new Sequence(substr($footerLine, 144, 6))) |
@@ -346,7 +346,7 @@ discard block |
||
| 346 | 346 | */ |
| 347 | 347 | private function createAuthorization($row) |
| 348 | 348 | { |
| 349 | - $authorization = new Authorization(); |
|
| 349 | + $authorization = new Authorization(); |
|
| 350 | 350 | // $authorization->setNumber(substr($row, 773, 10)); |
| 351 | 351 | |
| 352 | 352 | return $authorization; |
@@ -34,11 +34,11 @@ discard block |
||
| 34 | 34 | * @param array $campos |
| 35 | 35 | * @return Document |
| 36 | 36 | */ |
| 37 | - public static function createDocumentFromArray(array $campos = []) |
|
| 37 | + public static function createDocumentFromArray(array $campos = [ ]) |
|
| 38 | 38 | { |
| 39 | 39 | $document = new Document(); |
| 40 | - $document->setType(strlen($campos['documento']) === 11 ? Document::CPF : Document::CNPJ); |
|
| 41 | - $document->setNumber($campos['documento']); |
|
| 40 | + $document->setType(strlen($campos[ 'documento' ]) === 11 ? Document::CPF : Document::CNPJ); |
|
| 41 | + $document->setNumber($campos[ 'documento' ]); |
|
| 42 | 42 | |
| 43 | 43 | return $document; |
| 44 | 44 | } |
@@ -47,12 +47,12 @@ discard block |
||
| 47 | 47 | * @param array $campos |
| 48 | 48 | * @return Customer |
| 49 | 49 | */ |
| 50 | - public static function createCustomerFromArray(array $campos = []) |
|
| 50 | + public static function createCustomerFromArray(array $campos = [ ]) |
|
| 51 | 51 | { |
| 52 | 52 | $customer = new Customer(); |
| 53 | - $customer->setCode($campos['codigo']); |
|
| 54 | - $customer->setIdentityNumber($campos['documento']); |
|
| 55 | - $customer->setName($campos['nome']); |
|
| 53 | + $customer->setCode($campos[ 'codigo' ]); |
|
| 54 | + $customer->setIdentityNumber($campos[ 'documento' ]); |
|
| 55 | + $customer->setName($campos[ 'nome' ]); |
|
| 56 | 56 | |
| 57 | 57 | return $customer; |
| 58 | 58 | } |
@@ -61,10 +61,10 @@ discard block |
||
| 61 | 61 | * @param array $campos |
| 62 | 62 | * @return Charge |
| 63 | 63 | */ |
| 64 | - public static function createChargeFromArray(array $campos = []) |
|
| 64 | + public static function createChargeFromArray(array $campos = [ ]) |
|
| 65 | 65 | { |
| 66 | 66 | $charge = new Charge(); |
| 67 | - $charge->setCharging($campos['cobranca']); |
|
| 67 | + $charge->setCharging($campos[ 'cobranca' ]); |
|
| 68 | 68 | $charge->setOccurrence(self::createOccurrenceFromArray($campos)); |
| 69 | 69 | |
| 70 | 70 | return $charge; |
@@ -74,18 +74,18 @@ discard block |
||
| 74 | 74 | * @param array $campos |
| 75 | 75 | * @return ConsumerUnity |
| 76 | 76 | */ |
| 77 | - public static function createConsumerUnityFromArray(array $campos = []) |
|
| 77 | + public static function createConsumerUnityFromArray(array $campos = [ ]) |
|
| 78 | 78 | { |
| 79 | 79 | $consumerUnity = new ConsumerUnity(); |
| 80 | 80 | |
| 81 | 81 | if (array_key_exists('energia', $campos)) { |
| 82 | - $leitura = DateTime::createFromFormat('dmY', $campos['energia']['leitura']); |
|
| 83 | - $vencimento = DateTime::createFromFormat('dmY', $campos['energia']['vencimento']); |
|
| 82 | + $leitura = DateTime::createFromFormat('dmY', $campos[ 'energia' ][ 'leitura' ]); |
|
| 83 | + $vencimento = DateTime::createFromFormat('dmY', $campos[ 'energia' ][ 'vencimento' ]); |
|
| 84 | 84 | |
| 85 | 85 | $consumerUnity->setRead($leitura); |
| 86 | 86 | $consumerUnity->setMaturity($vencimento); |
| 87 | - $consumerUnity->setNumber($campos['energia']['numero']); |
|
| 88 | - $consumerUnity->setCode($campos['energia']['concessionaria']); |
|
| 87 | + $consumerUnity->setNumber($campos[ 'energia' ][ 'numero' ]); |
|
| 88 | + $consumerUnity->setCode($campos[ 'energia' ][ 'concessionaria' ]); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | return $consumerUnity; |
@@ -95,12 +95,12 @@ discard block |
||
| 95 | 95 | * @param array $campos |
| 96 | 96 | * @return Occurrence |
| 97 | 97 | */ |
| 98 | - public static function createOccurrenceFromArray(array $campos = []) |
|
| 98 | + public static function createOccurrenceFromArray(array $campos = [ ]) |
|
| 99 | 99 | { |
| 100 | 100 | $occurrence = new Occurrence(); |
| 101 | 101 | |
| 102 | 102 | if (array_key_exists('ocorrencia', $campos)) { |
| 103 | - $occurrence->setType($campos['ocorrencia']); |
|
| 103 | + $occurrence->setType($campos[ 'ocorrencia' ]); |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | return $occurrence; |
@@ -124,17 +124,17 @@ discard block |
||
| 124 | 124 | * @param array $campos |
| 125 | 125 | * @return Person |
| 126 | 126 | */ |
| 127 | - public static function createPersonFromArray(array $campos = []) |
|
| 127 | + public static function createPersonFromArray(array $campos = [ ]) |
|
| 128 | 128 | { |
| 129 | 129 | $person = new Person(); |
| 130 | - $person->setName($campos['nome']); |
|
| 131 | - $person->setCellPhone(self::createPhone($campos['celular'], Phone::CELLPHONE)); |
|
| 132 | - $person->setHomePhone(self::createPhone($campos['telefone1'], Phone::TELEPHONE)); |
|
| 133 | - $person->setHomePhoneSecondary(self::createPhone($campos['telefone2'], Phone::TELEPHONE)); |
|
| 134 | - $person->setDocument(self::createDocumentFromArray($campos['comprador'])); |
|
| 135 | - $person->setEmail($campos['email']); |
|
| 136 | - $person->setFatherName($campos['pai']); |
|
| 137 | - $person->setMotherName($campos['mae']); |
|
| 130 | + $person->setName($campos[ 'nome' ]); |
|
| 131 | + $person->setCellPhone(self::createPhone($campos[ 'celular' ], Phone::CELLPHONE)); |
|
| 132 | + $person->setHomePhone(self::createPhone($campos[ 'telefone1' ], Phone::TELEPHONE)); |
|
| 133 | + $person->setHomePhoneSecondary(self::createPhone($campos[ 'telefone2' ], Phone::TELEPHONE)); |
|
| 134 | + $person->setDocument(self::createDocumentFromArray($campos[ 'comprador' ])); |
|
| 135 | + $person->setEmail($campos[ 'email' ]); |
|
| 136 | + $person->setFatherName($campos[ 'pai' ]); |
|
| 137 | + $person->setMotherName($campos[ 'mae' ]); |
|
| 138 | 138 | |
| 139 | 139 | return $person; |
| 140 | 140 | } |
@@ -143,17 +143,17 @@ discard block |
||
| 143 | 143 | * @param array $campos |
| 144 | 144 | * @return Holder |
| 145 | 145 | */ |
| 146 | - public static function createHolderFromArray(array $campos = []) |
|
| 146 | + public static function createHolderFromArray(array $campos = [ ]) |
|
| 147 | 147 | { |
| 148 | 148 | $person = new Holder(); |
| 149 | 149 | |
| 150 | 150 | if (array_key_exists('titular', $campos)) { |
| 151 | - $person->setName($campos['titular']['nome']); |
|
| 152 | - $person->setCellPhone($campos['titular']['celular']); |
|
| 153 | - $person->setDocument(self::createDocumentFromArray($campos['titular'])); |
|
| 154 | - $person->setEmail($campos['titular']['email']); |
|
| 155 | - $person->setFatherName($campos['titular']['pai']); |
|
| 156 | - $person->setMotherName($campos['titular']['mae']); |
|
| 151 | + $person->setName($campos[ 'titular' ][ 'nome' ]); |
|
| 152 | + $person->setCellPhone($campos[ 'titular' ][ 'celular' ]); |
|
| 153 | + $person->setDocument(self::createDocumentFromArray($campos[ 'titular' ])); |
|
| 154 | + $person->setEmail($campos[ 'titular' ][ 'email' ]); |
|
| 155 | + $person->setFatherName($campos[ 'titular' ][ 'pai' ]); |
|
| 156 | + $person->setMotherName($campos[ 'titular' ][ 'mae' ]); |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | return $person; |
@@ -163,16 +163,16 @@ discard block |
||
| 163 | 163 | * @param array $campos |
| 164 | 164 | * @return Address |
| 165 | 165 | */ |
| 166 | - public static function createAddressFromArray(array $campos = []) |
|
| 166 | + public static function createAddressFromArray(array $campos = [ ]) |
|
| 167 | 167 | { |
| 168 | 168 | $address = new Address(); |
| 169 | - $address->setNumber($campos['numero']); |
|
| 170 | - $address->setAddress($campos['logradouro']); |
|
| 171 | - $address->setComplement($campos['complemento']); |
|
| 172 | - $address->setDistrict($campos['bairro']); |
|
| 173 | - $address->setPostalCode($campos['cep']); |
|
| 174 | - $address->setCity($campos['cidade']); |
|
| 175 | - $address->setState($campos['uf']); |
|
| 169 | + $address->setNumber($campos[ 'numero' ]); |
|
| 170 | + $address->setAddress($campos[ 'logradouro' ]); |
|
| 171 | + $address->setComplement($campos[ 'complemento' ]); |
|
| 172 | + $address->setDistrict($campos[ 'bairro' ]); |
|
| 173 | + $address->setPostalCode($campos[ 'cep' ]); |
|
| 174 | + $address->setCity($campos[ 'cidade' ]); |
|
| 175 | + $address->setState($campos[ 'uf' ]); |
|
| 176 | 176 | |
| 177 | 177 | return $address; |
| 178 | 178 | } |
@@ -181,27 +181,27 @@ discard block |
||
| 181 | 181 | * @param array $campos |
| 182 | 182 | * @return BankAccount |
| 183 | 183 | */ |
| 184 | - public static function createBankAccountFromArray(array $campos = []) |
|
| 184 | + public static function createBankAccountFromArray(array $campos = [ ]) |
|
| 185 | 185 | { |
| 186 | 186 | $holder = new Holder(); |
| 187 | 187 | $bank = new Bank(); |
| 188 | 188 | $account = new BankAccount($bank, $holder); |
| 189 | 189 | |
| 190 | 190 | if (array_key_exists('banco', $campos)) { |
| 191 | - $bank->setAgency($campos['banco']['agencia']); |
|
| 192 | - $bank->setDigit($campos['banco']['digito']); |
|
| 193 | - $bank->setCode($campos['banco']['codigo']); |
|
| 191 | + $bank->setAgency($campos[ 'banco' ][ 'agencia' ]); |
|
| 192 | + $bank->setDigit($campos[ 'banco' ][ 'digito' ]); |
|
| 193 | + $bank->setCode($campos[ 'banco' ][ 'codigo' ]); |
|
| 194 | 194 | |
| 195 | - $account->setDigit($campos['banco']['conta']['digito']); |
|
| 196 | - $account->setNumber($campos['banco']['conta']['numero']); |
|
| 197 | - $account->setOperation($campos['banco']['conta']['operacao']); |
|
| 195 | + $account->setDigit($campos[ 'banco' ][ 'conta' ][ 'digito' ]); |
|
| 196 | + $account->setNumber($campos[ 'banco' ][ 'conta' ][ 'numero' ]); |
|
| 197 | + $account->setOperation($campos[ 'banco' ][ 'conta' ][ 'operacao' ]); |
|
| 198 | 198 | |
| 199 | - if (array_key_exists('seguro', $campos['banco']['conta'])) { |
|
| 200 | - $account->setSecurity($campos['banco']['conta']['seguro']); |
|
| 199 | + if (array_key_exists('seguro', $campos[ 'banco' ][ 'conta' ])) { |
|
| 200 | + $account->setSecurity($campos[ 'banco' ][ 'conta' ][ 'seguro' ]); |
|
| 201 | 201 | } |
| 202 | 202 | |
| 203 | - if (array_key_exists('titular', $campos['banco']['conta'])) { |
|
| 204 | - $account->setHolder(self::createHolderFromArray($campos['banco']['conta']['titular'])); |
|
| 203 | + if (array_key_exists('titular', $campos[ 'banco' ][ 'conta' ])) { |
|
| 204 | + $account->setHolder(self::createHolderFromArray($campos[ 'banco' ][ 'conta' ][ 'titular' ])); |
|
| 205 | 205 | } |
| 206 | 206 | } |
| 207 | 207 | |
@@ -212,24 +212,24 @@ discard block |
||
| 212 | 212 | * @param array $campos |
| 213 | 213 | * @return Purchaser |
| 214 | 214 | */ |
| 215 | - public static function createPurchaserFromArray(array $campos = []) |
|
| 215 | + public static function createPurchaserFromArray(array $campos = [ ]) |
|
| 216 | 216 | { |
| 217 | - $purchaser = new Purchaser(); |
|
| 217 | + $purchaser = new Purchaser(); |
|
| 218 | 218 | |
| 219 | 219 | if (array_key_exists('comprador', $campos)) { |
| 220 | - $document = self::createDocumentFromArray($campos['comprador']); |
|
| 221 | - $address = self::createAddressFromArray($campos['comprador']['endereco']); |
|
| 222 | - $birth = DateTime::createFromFormat('dmY', $campos['comprador']['nascimento']); |
|
| 223 | - |
|
| 224 | - $purchaser->setName($campos['comprador']['nome']); |
|
| 225 | - $purchaser->setCellPhone(self::createPhone($campos['comprador']['celular'], Phone::CELLPHONE)); |
|
| 226 | - $purchaser->setHomePhone(self::createPhone($campos['comprador']['telefone1'], Phone::TELEPHONE)); |
|
| 227 | - $purchaser->setHomePhoneSecondary(self::createPhone($campos['comprador']['telefone2'], Phone::TELEPHONE)); |
|
| 220 | + $document = self::createDocumentFromArray($campos[ 'comprador' ]); |
|
| 221 | + $address = self::createAddressFromArray($campos[ 'comprador' ][ 'endereco' ]); |
|
| 222 | + $birth = DateTime::createFromFormat('dmY', $campos[ 'comprador' ][ 'nascimento' ]); |
|
| 223 | + |
|
| 224 | + $purchaser->setName($campos[ 'comprador' ][ 'nome' ]); |
|
| 225 | + $purchaser->setCellPhone(self::createPhone($campos[ 'comprador' ][ 'celular' ], Phone::CELLPHONE)); |
|
| 226 | + $purchaser->setHomePhone(self::createPhone($campos[ 'comprador' ][ 'telefone1' ], Phone::TELEPHONE)); |
|
| 227 | + $purchaser->setHomePhoneSecondary(self::createPhone($campos[ 'comprador' ][ 'telefone2' ], Phone::TELEPHONE)); |
|
| 228 | 228 | $purchaser->setDocument($document); |
| 229 | - $purchaser->setEmail(self::createEmail($campos['comprador']['email'])); |
|
| 229 | + $purchaser->setEmail(self::createEmail($campos[ 'comprador' ][ 'email' ])); |
|
| 230 | 230 | $purchaser->setBirth($birth); |
| 231 | 231 | $purchaser->setAddress($address); |
| 232 | - $purchaser->setPerson($campos['comprador']['pessoa']); |
|
| 232 | + $purchaser->setPerson($campos[ 'comprador' ][ 'pessoa' ]); |
|
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | return $purchaser; |
@@ -248,17 +248,17 @@ discard block |
||
| 248 | 248 | * @param array $campos |
| 249 | 249 | * @return \SplFixedArray |
| 250 | 250 | */ |
| 251 | - public static function createParcelsFromArray(array $campos = []) |
|
| 251 | + public static function createParcelsFromArray(array $campos = [ ]) |
|
| 252 | 252 | { |
| 253 | - $parcels = new Parcels(count($campos['parcelas'])); |
|
| 253 | + $parcels = new Parcels(count($campos[ 'parcelas' ])); |
|
| 254 | 254 | $key = 1; |
| 255 | 255 | |
| 256 | - foreach ($campos['parcelas'] as $parcela) { |
|
| 257 | - $parcelOne = new Parcel(); |
|
| 258 | - $parcelOne->setMaturity(DateTime::createFromFormat('dmY', $parcela['vencimento'])); |
|
| 256 | + foreach ($campos[ 'parcelas' ] as $parcela) { |
|
| 257 | + $parcelOne = new Parcel(); |
|
| 258 | + $parcelOne->setMaturity(DateTime::createFromFormat('dmY', $parcela[ 'vencimento' ])); |
|
| 259 | 259 | $parcelOne->setKey($key); |
| 260 | - $parcelOne->setPrice($parcela['valor']); |
|
| 261 | - $parcelOne->setQuantity($parcela['quantidade']); |
|
| 260 | + $parcelOne->setPrice($parcela[ 'valor' ]); |
|
| 261 | + $parcelOne->setQuantity($parcela[ 'quantidade' ]); |
|
| 262 | 262 | |
| 263 | 263 | $parcels->addParcel($parcelOne); |
| 264 | 264 | |
@@ -272,16 +272,16 @@ discard block |
||
| 272 | 272 | * @param array $campos |
| 273 | 273 | * @return Seller |
| 274 | 274 | */ |
| 275 | - public static function createSellerFromArray(array $campos = []) |
|
| 275 | + public static function createSellerFromArray(array $campos = [ ]) |
|
| 276 | 276 | { |
| 277 | 277 | $seller = new Seller(); |
| 278 | 278 | |
| 279 | 279 | if (array_key_exists('vendedor', $campos)) { |
| 280 | 280 | $seller = new Seller(); |
| 281 | - $seller->setCode($campos['vendedor']['codigo']); |
|
| 282 | - $seller->setName($campos['vendedor']['nome']); |
|
| 283 | - $seller->setDocument(static::createDocumentFromArray($campos['vendedor'])); |
|
| 284 | - $seller->setAddress(static::createAddressFromArray($campos['vendedor']['endereco'])); |
|
| 281 | + $seller->setCode($campos[ 'vendedor' ][ 'codigo' ]); |
|
| 282 | + $seller->setName($campos[ 'vendedor' ][ 'nome' ]); |
|
| 283 | + $seller->setDocument(static::createDocumentFromArray($campos[ 'vendedor' ])); |
|
| 284 | + $seller->setAddress(static::createAddressFromArray($campos[ 'vendedor' ][ 'endereco' ])); |
|
| 285 | 285 | } |
| 286 | 286 | |
| 287 | 287 | return $seller; |
@@ -291,12 +291,12 @@ discard block |
||
| 291 | 291 | * @param array $campos |
| 292 | 292 | * @return Authorization |
| 293 | 293 | */ |
| 294 | - public static function createAuthorizationFromArray(array $campos = []) |
|
| 294 | + public static function createAuthorizationFromArray(array $campos = [ ]) |
|
| 295 | 295 | { |
| 296 | 296 | $authorization = new Authorization(); |
| 297 | 297 | |
| 298 | 298 | if (array_key_exists('autorizacao', $campos)) { |
| 299 | - $authorization->setNumber($campos['autorizacao']); |
|
| 299 | + $authorization->setNumber($campos[ 'autorizacao' ]); |
|
| 300 | 300 | } |
| 301 | 301 | |
| 302 | 302 | return $authorization; |
@@ -306,13 +306,13 @@ discard block |
||
| 306 | 306 | * @param array $campos |
| 307 | 307 | * @return Billet |
| 308 | 308 | */ |
| 309 | - public static function createBilletFromArray(array $campos = []) |
|
| 309 | + public static function createBilletFromArray(array $campos = [ ]) |
|
| 310 | 310 | { |
| 311 | 311 | $billet = new Billet(); |
| 312 | 312 | |
| 313 | 313 | if (array_key_exists('boleto', $campos)) { |
| 314 | - $billet->setBankAccount(self::createBankAccountFromArray($campos['boleto'])); |
|
| 315 | - $billet->setNumber($campos['boleto']['documento']); |
|
| 314 | + $billet->setBankAccount(self::createBankAccountFromArray($campos[ 'boleto' ])); |
|
| 315 | + $billet->setNumber($campos[ 'boleto' ][ 'documento' ]); |
|
| 316 | 316 | } |
| 317 | 317 | |
| 318 | 318 | return $billet; |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | * @param array $campos |
| 325 | 325 | * @return Detail |
| 326 | 326 | */ |
| 327 | - public static function createDetailFromArray(array $campos = []) |
|
| 327 | + public static function createDetailFromArray(array $campos = [ ]) |
|
| 328 | 328 | { |
| 329 | 329 | $purchaser = self::createPurchaserFromArray($campos); |
| 330 | 330 | $parcels = self::createParcelsFromArray($campos); |
@@ -379,20 +379,20 @@ discard block |
||
| 379 | 379 | 'complemento' => $item->getPurchaser()->getAddress()->getComplement(), |
| 380 | 380 | ], |
| 381 | 381 | ], |
| 382 | - 'parcelas' => [], |
|
| 382 | + 'parcelas' => [ ], |
|
| 383 | 383 | ]; |
| 384 | 384 | |
| 385 | 385 | foreach ($item->getParcels() as $parcel) { |
| 386 | - $result['parcelas'][] = [ |
|
| 386 | + $result[ 'parcelas' ][ ] = [ |
|
| 387 | 387 | 'vencimento' => ($parcel->getMaturity() !== null ? $parcel->getMaturity()->format('dmY') : null), |
| 388 | 388 | 'valor' => $parcel->getPrice(), |
| 389 | 389 | 'quantidade' => $parcel->getQuantity(), |
| 390 | 390 | ]; |
| 391 | 391 | } |
| 392 | 392 | |
| 393 | - switch ($result['cobranca']) { |
|
| 393 | + switch ($result[ 'cobranca' ]) { |
|
| 394 | 394 | case Charge::CREDIT_CARD: |
| 395 | - $result['cartao'] = [ |
|
| 395 | + $result[ 'cartao' ] = [ |
|
| 396 | 396 | 'bandeira' => $item->getCreditCard()->getFlag(), |
| 397 | 397 | 'numero' => $item->getCreditCard()->getNumber(), |
| 398 | 398 | 'validade' => ($item->getCreditCard()->getValidate() !== null ? $item->getCreditCard()->getValidate()->format('mY') : null), |
@@ -401,7 +401,7 @@ discard block |
||
| 401 | 401 | break; |
| 402 | 402 | |
| 403 | 403 | case Charge::DEBIT: |
| 404 | - $result['banco'] = [ |
|
| 404 | + $result[ 'banco' ] = [ |
|
| 405 | 405 | 'codigo' => $item->getBankAccount()->getBank()->getCode(), |
| 406 | 406 | 'agencia' => $item->getBankAccount()->getBank()->getAgency(), |
| 407 | 407 | 'digito' => $item->getBankAccount()->getBank()->getDigit(), |
@@ -410,13 +410,13 @@ discard block |
||
| 410 | 410 | 'digito' => $item->getBankAccount()->getDigit(), |
| 411 | 411 | 'operacao' => $item->getBankAccount()->getOperation(), |
| 412 | 412 | 'seguro' => $item->getBankAccount()->getSecurity(), |
| 413 | - 'titular' => $result['comprador'], |
|
| 413 | + 'titular' => $result[ 'comprador' ], |
|
| 414 | 414 | ] |
| 415 | 415 | ]; |
| 416 | 416 | break; |
| 417 | 417 | |
| 418 | 418 | case Charge::ENERGY: |
| 419 | - $result['energia'] = [ |
|
| 419 | + $result[ 'energia' ] = [ |
|
| 420 | 420 | 'numero' => $item->getConsumerUnity()->getNumber(), |
| 421 | 421 | 'leitura' => ($item->getConsumerUnity()->getRead() !== null ? $item->getConsumerUnity()->getRead()->format('dmy') : null), |
| 422 | 422 | 'vencimento' => ($item->getConsumerUnity()->getMaturity() !== null ? $item->getConsumerUnity()->getMaturity()->format('dmy') : null), |
@@ -76,7 +76,7 @@ |
||
| 76 | 76 | public function setType($type) |
| 77 | 77 | { |
| 78 | 78 | try { |
| 79 | - Validator::intType()->in([self::CELLPHONE, self::TELEPHONE])->assert($type); |
|
| 79 | + Validator::intType()->in([ self::CELLPHONE, self::TELEPHONE ])->assert($type); |
|
| 80 | 80 | |
| 81 | 81 | $this->type = $type; |
| 82 | 82 | } catch (AllOfException $ex) { |
@@ -59,7 +59,7 @@ |
||
| 59 | 59 | Validator |
| 60 | 60 | ::intType() |
| 61 | 61 | ->notEmpty() |
| 62 | - ->in([self::CPF, self::CNPJ]) |
|
| 62 | + ->in([ self::CPF, self::CNPJ ]) |
|
| 63 | 63 | ->assert($type); |
| 64 | 64 | |
| 65 | 65 | $this->type = $type; |