@@ -25,8 +25,8 @@ |
||
| 25 | 25 | { |
| 26 | 26 | /** @var VehicleInspection $vehicleInspection */ |
| 27 | 27 | foreach ($existingVehicleInspection as $vehicleInspection) { |
| 28 | - if($newVehicleInspection->getLastInspection() === $vehicleInspection->getLastInspection() || |
|
| 29 | - $newVehicleInspection->getId() === $vehicleInspection->getId() |
|
| 28 | + if ($newVehicleInspection->getLastInspection() === $vehicleInspection->getLastInspection() || |
|
| 29 | + $newVehicleInspection->getId() === $vehicleInspection->getId() |
|
| 30 | 30 | ) { |
| 31 | 31 | return true; |
| 32 | 32 | } |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | |
| 21 | 21 | public function create($type, $id, $title, $description, $source) |
| 22 | 22 | { |
| 23 | - switch($type) { |
|
| 23 | + switch ($type) { |
|
| 24 | 24 | case self::CAR_DOCUMENT: |
| 25 | 25 | return new CarDocument($id, $title, $description, $source); |
| 26 | 26 | break; |
@@ -129,7 +129,7 @@ |
||
| 129 | 129 | |
| 130 | 130 | try { |
| 131 | 131 | $newInsuranceDocument->execute(); |
| 132 | - } catch(NonexistentInsuranceException $nonexistent) { |
|
| 132 | + } catch (NonexistentInsuranceException $nonexistent) { |
|
| 133 | 133 | } |
| 134 | 134 | } |
| 135 | 135 | } |
@@ -138,8 +138,7 @@ |
||
| 138 | 138 | * @Then chciałbym w samochodzie :carId dodać informację o przeglądzie z numerem :inspectionId, w którym data ostatniego to :lastInspection, a data następnego to :upcomingInspection |
| 139 | 139 | * @throws \Madkom\RegistryApplication\Domain\CarManagement\CarExceptions\InvalidDatesException |
| 140 | 140 | */ |
| 141 | - public function chcialbymWSamochodzieDodacInformacjeOPrzegladzieZNumeremWKtorymDataOstatniegoToADataNastępnegoTo |
|
| 142 | -( |
|
| 141 | + public function chcialbymWSamochodzieDodacInformacjeOPrzegladzieZNumeremWKtorymDataOstatniegoToADataNastępnegoTo( |
|
| 143 | 142 | $carId, |
| 144 | 143 | $inspectionId, |
| 145 | 144 | $lastInspection, |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | $this->hasValidDateFormat($dateFrom, $dateTo); |
| 32 | 32 | $this->isEqualToOneYear($dateFrom, $dateTo); |
| 33 | 33 | |
| 34 | - switch($insuranceType) { |
|
| 34 | + switch ($insuranceType) { |
|
| 35 | 35 | case CarInsurance::INSURANCE_TYPE: |
| 36 | 36 | $insurance = new CarInsurance($insuranceId, $dateFrom, $dateTo, $insurerId); |
| 37 | 37 | break; |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | */ |
| 73 | 73 | private function hasValidDateFormat($dateFrom, $dateTo) |
| 74 | 74 | { |
| 75 | - if (! ($dateFrom instanceof \DateTime) or ! ($dateTo instanceof \DateTime)) { |
|
| 75 | + if (!($dateFrom instanceof \DateTime) or !($dateTo instanceof \DateTime)) { |
|
| 76 | 76 | throw new \InvalidArgumentException('The \'date from\' or \'date to\' has not be instance of DateTime class.' |
| 77 | 77 | ); |
| 78 | 78 | } |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | { |
| 83 | 83 | $interval = $dateTo->diff($dateFrom); |
| 84 | 84 | |
| 85 | - if($interval->days < 365 or $interval->days > 366) { |
|
| 85 | + if ($interval->days < 365 or $interval->days > 366) { |
|
| 86 | 86 | throw new InvalidDatesException('Umowa z ubezpieczeniem może być tylko na rok.'); |
| 87 | 87 | } |
| 88 | 88 | } |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | ) { |
| 28 | 28 | return true; |
| 29 | 29 | } |
| 30 | - if($newInsurance->getId() === $insurance->getId()) { |
|
| 30 | + if ($newInsurance->getId() === $insurance->getId()) { |
|
| 31 | 31 | return true; |
| 32 | 32 | } |
| 33 | 33 | } |
@@ -144,13 +144,13 @@ discard block |
||
| 144 | 144 | { |
| 145 | 145 | $duplicationChecker = new VehicleInspectionDuplicationChecker(); |
| 146 | 146 | $isDuplicated = $duplicationChecker->checkForDuplicates($this->vehicleInspection, $newVehicleInspection); |
| 147 | - if($isDuplicated) { |
|
| 147 | + if ($isDuplicated) { |
|
| 148 | 148 | throw new DuplicatedVehicleInspectionException; |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | $dateChecker = new VehicleInspectionDateChecker(); |
| 152 | 152 | $isInvalidDates = $dateChecker->checkDates($newVehicleInspection); |
| 153 | - if($isInvalidDates) { |
|
| 153 | + if ($isInvalidDates) { |
|
| 154 | 154 | throw new InvalidDatesException; |
| 155 | 155 | } |
| 156 | 156 | |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | */ |
| 165 | 165 | public function removeVehicleInspection(VehicleInspection $vehicleInspection) |
| 166 | 166 | { // REFACTOR: przekazywać tylko ID |
| 167 | - if( ($key = array_search($vehicleInspection, $this->vehicleInspection, true)) !== false) { |
|
| 167 | + if (($key = array_search($vehicleInspection, $this->vehicleInspection, true)) !== false) { |
|
| 168 | 168 | unset($this->vehicleInspection[$key]); |
| 169 | 169 | } else { |
| 170 | 170 | throw new RemovingNonexistentElementException; |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | { |
| 181 | 181 | $duplicationChecker = new InsuranceDuplicationChecker(); |
| 182 | 182 | $isDuplicated = $duplicationChecker->checkForDuplicates($this->insurances, $newInsurance); |
| 183 | - if($isDuplicated) { |
|
| 183 | + if ($isDuplicated) { |
|
| 184 | 184 | throw new DuplicatedInsuranceException; |
| 185 | 185 | } |
| 186 | 186 | |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | public function removeInsurance($selectedInsuranceId) |
| 191 | 191 | { |
| 192 | 192 | foreach ($this->insurances as $key => $insurance) { |
| 193 | - if($insurance->getId() === $selectedInsuranceId) { |
|
| 193 | + if ($insurance->getId() === $selectedInsuranceId) { |
|
| 194 | 194 | unset($this->insurances[$key]); |
| 195 | 195 | return 0; |
| 196 | 196 | } |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | public function addInsuranceDocument($insuranceId, InsuranceDocument $insuranceDocument) |
| 203 | 203 | { |
| 204 | 204 | foreach ($this->insurances as &$insurance) { |
| 205 | - if($insurance->getId() === $insuranceId) { |
|
| 205 | + if ($insurance->getId() === $insuranceId) { |
|
| 206 | 206 | $insurance->addInsuranceDocument($insuranceDocument); |
| 207 | 207 | return 0; |
| 208 | 208 | } |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | public function getInsuranceDocuments($insuranceId) |
| 215 | 215 | { |
| 216 | 216 | foreach ($this->insurances as $insurance) { |
| 217 | - if($insurance->getId() === $insuranceId) { |
|
| 217 | + if ($insurance->getId() === $insuranceId) { |
|
| 218 | 218 | return $insurance->getInsuranceDocuments(); |
| 219 | 219 | } |
| 220 | 220 | } |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | public function removeInsuranceDocument($insuranceId, $documentId) |
| 248 | 248 | { |
| 249 | 249 | foreach ($this->insurances as $insurance) { |
| 250 | - if($insurance->getId() === $insuranceId) { |
|
| 250 | + if ($insurance->getId() === $insuranceId) { |
|
| 251 | 251 | $insurance->removeInsuranceDocument($documentId); |
| 252 | 252 | return 0; |
| 253 | 253 | } |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | |
| 23 | 23 | public function find($carId) |
| 24 | 24 | { |
| 25 | - if(!array_key_exists($carId, $this->repository)) { |
|
| 25 | + if (!array_key_exists($carId, $this->repository)) { |
|
| 26 | 26 | throw new CarNotFoundException('Nie znaleziono samochodu o podanym id = ' . $carId); |
| 27 | 27 | } |
| 28 | 28 | |
@@ -31,12 +31,12 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | public function isEmpty() |
| 33 | 33 | { |
| 34 | - return (! count($this->repository)) ?: false; |
|
| 34 | + return (!count($this->repository)) ?: false; |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | public function remove($carId) |
| 38 | 38 | { |
| 39 | - if(!array_key_exists($carId, $this->repository)) { |
|
| 39 | + if (!array_key_exists($carId, $this->repository)) { |
|
| 40 | 40 | throw new CarNotFoundException('Nie znaleziono samochodu o podanym id = ' . $carId); |
| 41 | 41 | } |
| 42 | 42 | |