@@ -10,17 +10,17 @@ discard block |
||
| 10 | 10 | class ContractService |
| 11 | 11 | { |
| 12 | 12 | |
| 13 | - public function __construct( |
|
| 13 | + public function __construct( |
|
| 14 | 14 | private EntityManagerInterface $manager, |
| 15 | 15 | private PdfService $pdf, |
| 16 | 16 | private ModelService $modelService |
| 17 | - ) {} |
|
| 17 | + ) {} |
|
| 18 | 18 | |
| 19 | - public function genetateFromModel(Contract $data) |
|
| 20 | - { |
|
| 19 | + public function genetateFromModel(Contract $data) |
|
| 20 | + { |
|
| 21 | 21 | $file = $data->getContractFile(); |
| 22 | 22 | if (!$file) |
| 23 | - $file = new File(); |
|
| 23 | + $file = new File(); |
|
| 24 | 24 | |
| 25 | 25 | $file->setFileType('text'); |
| 26 | 26 | $file->setExtension('html'); |
@@ -29,23 +29,23 @@ discard block |
||
| 29 | 29 | $this->manager->flush(); |
| 30 | 30 | |
| 31 | 31 | return $data; |
| 32 | - } |
|
| 32 | + } |
|
| 33 | 33 | |
| 34 | - public function getContractPDFContent(Contract $contract): string |
|
| 35 | - { |
|
| 34 | + public function getContractPDFContent(Contract $contract): string |
|
| 35 | + { |
|
| 36 | 36 | $content = $contract->getContractFile()->getContent(); |
| 37 | 37 | |
| 38 | 38 | if ($contract->getContractFile()->getExtension() == 'pdf') |
| 39 | - return $content; |
|
| 39 | + return $content; |
|
| 40 | 40 | |
| 41 | 41 | if (empty($content)) { |
| 42 | - throw new \Exception( |
|
| 42 | + throw new \Exception( |
|
| 43 | 43 | sprintf('Houve um erro ao gerar o PDF') |
| 44 | - ); |
|
| 44 | + ); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | return $this->pdf->convertHtmlToPdf($content); |
| 48 | - } |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | 50 | |
| 51 | 51 | |
@@ -30,8 +30,9 @@ discard block |
||
| 30 | 30 | public function genetateFromModel(Contract $data) |
| 31 | 31 | { |
| 32 | 32 | $file = $data->getContractFile(); |
| 33 | - if (!$file) |
|
| 34 | - $file = new File(); |
|
| 33 | + if (!$file) { |
|
| 34 | + $file = new File(); |
|
| 35 | + } |
|
| 35 | 36 | |
| 36 | 37 | $file->setFileType('text'); |
| 37 | 38 | $file->setExtension('html'); |
@@ -47,8 +48,9 @@ discard block |
||
| 47 | 48 | { |
| 48 | 49 | $content = $contract->getContractFile()->getContent(); |
| 49 | 50 | |
| 50 | - if ($contract->getContractFile()->getExtension() == 'pdf') |
|
| 51 | - return $content; |
|
| 51 | + if ($contract->getContractFile()->getExtension() == 'pdf') { |
|
| 52 | + return $content; |
|
| 53 | + } |
|
| 52 | 54 | |
| 53 | 55 | if (empty($content)) { |
| 54 | 56 | throw new \Exception( |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | |
| 147 | 147 | |
| 148 | 148 | $contractProviders = $contract->getContractPeople() |
| 149 | - ->filter(function ($contractPeople) { |
|
| 149 | + ->filter(function($contractPeople) { |
|
| 150 | 150 | return $contractPeople->getPeopleType() == 'Provider'; |
| 151 | 151 | }); |
| 152 | 152 | if ($contractProviders->isEmpty()) { |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | // add the rest |
| 163 | 163 | |
| 164 | 164 | $contractParticipants = $contract->getContractPeople() |
| 165 | - ->filter(function ($contractPeople) { |
|
| 165 | + ->filter(function($contractPeople) { |
|
| 166 | 166 | return $contractPeople->getPeopleType() != 'Provider'; |
| 167 | 167 | }); |
| 168 | 168 | if ($contractParticipants->isEmpty()) { |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | protected function getContractContractorSignerName(ContractEntity $contract): string |
| 182 | 182 | { |
| 183 | 183 | $contractPayers = $contract->getContractPeople() |
| 184 | - ->filter(function ($contractPeople) { |
|
| 184 | + ->filter(function($contractPeople) { |
|
| 185 | 185 | return $contractPeople->getPeopleType() == 'Payer'; |
| 186 | 186 | }); |
| 187 | 187 | if ($contractPayers->isEmpty()) { |