MoipBilletCommand   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 3
c 3
b 0
f 0
lcom 0
cbo 0
dl 0
loc 53
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A fire() 0 23 2
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