MoipBilletCommand::fire()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 23
Code Lines 20

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
c 3
b 0
f 0
dl 0
loc 23
rs 9.0856
cc 2
eloc 20
nc 2
nop 0
1
<?php namespace SOSTheBlack\Moip\Commands;
2
3
use Moip;
4
use Illuminate\Console\Command;
5
6
class MoipBilletCommand extends Command {
7
8
	/**
9
	 * The console command name.
10
	 *
11
	 * @var string
12
	 */
13
	protected $name = 'moip:billet';
14
15
	/**
16
	 * The console command description.
17
	 *
18
	 * @var string
19
	 */
20
	protected $description = 'Banking billet settings.';
21
22
	/**
23
	 * Create a new command instance.
24
	 */
25
	public function __construct()
26
	{
27
		parent::__construct();
28
	}
29
30
	/**
31
	 * Execute the console command.
32
	 *
33
	 * @return mixed
34
	 */
35
	public function fire()
36
	{
37
		$moip = Moip::first();
38
		if ($this->confirm('Boleto bancario ativado? [yes|no]')) {
39
			$expiration 	= $this->ask('Dia do vencimento apos emissao do boleto (in days):');
40
			$working_days	= $this->confirm('Dias corridos? [yes corridos|no úteis]');
41
			$this->comment('Mensagem no boleto');
42
			$first_line		= $this->ask("Primeira linha:");
43
			$second_line	= $this->ask("Segunda linha:");
44
			$last_line		= $this->ask("Terceira linha:");
45
			$url_logo		= $this->ask("URL do logo:");
46
			$moip->billet = true;
47
			$moip->expiration 	= $expiration;
48
			$moip->workingDays 	= $working_days;
49
			$moip->firstLine 	= $first_line;
50
			$moip->secondLine 	= $second_line;
51
			$moip->lastLine 	= $last_line;
52
			$moip->uriLogo 		= $url_logo;
53
		} else {
54
			$moip->billet = false;
55
		}
56
		$moip->save();
57
	}
58
}
59