@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | } |
134 | 134 | |
135 | 135 | $contractProviders = $contract->getPeoples() |
136 | - ->filter(function ($contractPeople) { |
|
136 | + ->filter(function($contractPeople) { |
|
137 | 137 | return $contractPeople->getPeopleType() == 'Beneficiary'; |
138 | 138 | }); |
139 | 139 | if ($contractProviders->isEmpty()) { |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | } |
148 | 148 | |
149 | 149 | $contractParticipants = $contract->getPeoples() |
150 | - ->filter(function ($contractPeople) { |
|
150 | + ->filter(function($contractPeople) { |
|
151 | 151 | return $contractPeople->getPeopleType() != 'Beneficiary'; |
152 | 152 | }); |
153 | 153 | if ($contractParticipants->isEmpty()) { |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | protected function getContractContractorSignerName(Contract $contract): string |
167 | 167 | { |
168 | 168 | $contractPayers = $contract->getPeoples() |
169 | - ->filter(function ($contractPeople) { |
|
169 | + ->filter(function($contractPeople) { |
|
170 | 170 | return $contractPeople->getPeopleType() == 'Contractor'; |
171 | 171 | }); |
172 | 172 | if ($contractPayers->isEmpty()) { |
@@ -20,8 +20,9 @@ discard block |
||
20 | 20 | public function genetateFromModel(Contract $data) |
21 | 21 | { |
22 | 22 | $file = $data->getContractFile(); |
23 | - if (!$file) |
|
24 | - $file = new File(); |
|
23 | + if (!$file) { |
|
24 | + $file = new File(); |
|
25 | + } |
|
25 | 26 | |
26 | 27 | $file->setFileType('text'); |
27 | 28 | $file->setExtension('html'); |
@@ -46,8 +47,9 @@ discard block |
||
46 | 47 | { |
47 | 48 | $content = $contract->getContractFile()->getContent(); |
48 | 49 | |
49 | - if ($contract->getContractFile()->getExtension() == 'pdf') |
|
50 | - return $content; |
|
50 | + if ($contract->getContractFile()->getExtension() == 'pdf') { |
|
51 | + return $content; |
|
52 | + } |
|
51 | 53 | |
52 | 54 | if (empty($content)) { |
53 | 55 | throw new \Exception( |
@@ -61,7 +63,8 @@ discard block |
||
61 | 63 | |
62 | 64 | public function postPersist(Contract $contract) |
63 | 65 | { |
64 | - if ($contract->getStatus()->getRealStatus() == 'open') |
|
65 | - return $this->genetateFromModel($contract); |
|
66 | + if ($contract->getStatus()->getRealStatus() == 'open') { |
|
67 | + return $this->genetateFromModel($contract); |
|
68 | + } |
|
66 | 69 | } |
67 | 70 | } |
@@ -11,18 +11,18 @@ discard block |
||
11 | 11 | class ContractService |
12 | 12 | { |
13 | 13 | |
14 | - public function __construct( |
|
14 | + public function __construct( |
|
15 | 15 | private EntityManagerInterface $manager, |
16 | 16 | private PdfService $pdf, |
17 | 17 | private ModelService $modelService, |
18 | 18 | private StatusService $statusService |
19 | - ) {} |
|
19 | + ) {} |
|
20 | 20 | |
21 | - public function genetateFromModel(Contract $data) |
|
22 | - { |
|
21 | + public function genetateFromModel(Contract $data) |
|
22 | + { |
|
23 | 23 | $file = $data->getContractFile(); |
24 | 24 | if (!$file) |
25 | - $file = new File(); |
|
25 | + $file = new File(); |
|
26 | 26 | |
27 | 27 | $file->setFileType('text'); |
28 | 28 | $file->setExtension('html'); |
@@ -34,38 +34,38 @@ discard block |
||
34 | 34 | |
35 | 35 | $data->setContractFile($file); |
36 | 36 | $data->setStatus( |
37 | - $this->statusService->discoveryStatus( |
|
37 | + $this->statusService->discoveryStatus( |
|
38 | 38 | 'open', |
39 | 39 | 'open', |
40 | 40 | $data->getStatus()->getContext() |
41 | - ) |
|
41 | + ) |
|
42 | 42 | ); |
43 | 43 | $this->manager->persist($data); |
44 | 44 | $this->manager->flush(); |
45 | 45 | |
46 | 46 | return $data; |
47 | - } |
|
47 | + } |
|
48 | 48 | |
49 | - public function getContractPDFContent(Contract $contract): string |
|
50 | - { |
|
49 | + public function getContractPDFContent(Contract $contract): string |
|
50 | + { |
|
51 | 51 | $content = $contract->getContractFile()->getContent(); |
52 | 52 | |
53 | 53 | if ($contract->getContractFile()->getExtension() == 'pdf') |
54 | - return $content; |
|
54 | + return $content; |
|
55 | 55 | |
56 | 56 | if (empty($content)) { |
57 | - throw new \Exception( |
|
57 | + throw new \Exception( |
|
58 | 58 | sprintf('Houve um erro ao gerar o PDF') |
59 | - ); |
|
59 | + ); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | return $this->pdf->convertHtmlToPdf($content); |
63 | - } |
|
63 | + } |
|
64 | 64 | |
65 | 65 | |
66 | - public function postPersist(Contract $contract) |
|
67 | - { |
|
66 | + public function postPersist(Contract $contract) |
|
67 | + { |
|
68 | 68 | if ($contract->getStatus()->getRealStatus() == 'open') |
69 | - return $this->genetateFromModel($contract); |
|
70 | - } |
|
69 | + return $this->genetateFromModel($contract); |
|
70 | + } |
|
71 | 71 | } |
@@ -11,15 +11,15 @@ |
||
11 | 11 | class ContractPeopleService |
12 | 12 | { |
13 | 13 | |
14 | - public function __construct( |
|
14 | + public function __construct( |
|
15 | 15 | private EntityManagerInterface $manager, |
16 | 16 | private ContractService $contractService |
17 | - ) {} |
|
17 | + ) {} |
|
18 | 18 | |
19 | - public function postPersist(ContractPeople $contractPeople) |
|
20 | - { |
|
19 | + public function postPersist(ContractPeople $contractPeople) |
|
20 | + { |
|
21 | 21 | $contract = $contractPeople->getContract(); |
22 | 22 | $this->contractService->genetateFromModel($contract); |
23 | 23 | return $contractPeople; |
24 | - } |
|
24 | + } |
|
25 | 25 | } |