@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | Event::on( |
| 84 | 84 | CraftVariable::class, |
| 85 | 85 | CraftVariable::EVENT_INIT, |
| 86 | - function (Event $event) |
|
| 86 | + function(Event $event) |
|
| 87 | 87 | { |
| 88 | 88 | $variable = $event->sender; |
| 89 | 89 | $variable->set('harvest', HarvestVariable::class); |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | Event::on( |
| 96 | 96 | Fields::class, |
| 97 | 97 | Fields::EVENT_REGISTER_FIELD_TYPES, |
| 98 | - function (RegisterComponentTypesEvent $event) |
|
| 98 | + function(RegisterComponentTypesEvent $event) |
|
| 99 | 99 | { |
| 100 | 100 | $event->types[] = SaasLinkField::class; |
| 101 | 101 | } |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | { |
| 189 | 189 | $organizationOptions = []; |
| 190 | 190 | |
| 191 | - foreach($this->trello->getMemberOrganizations() as $organization) |
|
| 191 | + foreach ($this->trello->getMemberOrganizations() as $organization) |
|
| 192 | 192 | { |
| 193 | 193 | $organizationOptions[] = [ |
| 194 | 194 | 'label' => $organization->displayName, |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | { |
| 153 | 153 | $compareValue = $value->value ?? $value; |
| 154 | 154 | |
| 155 | - foreach ($this->options as $option) |
|
| 155 | + foreach ($this->options as $option) |
|
| 156 | 156 | { |
| 157 | 157 | if ($option['value'] === $compareValue) |
| 158 | 158 | { |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | */ |
| 170 | 170 | public function normalizeValue($value, ElementInterface $element = null) |
| 171 | 171 | { |
| 172 | - if (!$value) |
|
| 172 | + if ( ! $value) |
|
| 173 | 173 | { |
| 174 | 174 | $value = $this->defaultValue(); |
| 175 | 175 | } |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | /** |
| 35 | 35 | * @var string |
| 36 | 36 | */ |
| 37 | - protected $apiBaseUrl = 'https://api.harvestapp.com/v2/'; |
|
| 37 | + protected $apiBaseUrl = 'https://api.harvestapp.com/v2/'; |
|
| 38 | 38 | |
| 39 | 39 | /** |
| 40 | 40 | * @var string |
@@ -507,7 +507,7 @@ discard block |
||
| 507 | 507 | |
| 508 | 508 | foreach ($timeEntries as $timeEntry) |
| 509 | 509 | { |
| 510 | - if ($timeEntry->billable && !$timeEntry->is_billed) |
|
| 510 | + if ($timeEntry->billable && ! $timeEntry->is_billed) |
|
| 511 | 511 | { |
| 512 | 512 | $roundedHours = $this->roundTime($timeEntry->hours, self::TIME_ROUNDING_METHOD); |
| 513 | 513 | |
@@ -136,8 +136,7 @@ discard block |
||
| 136 | 136 | usort($options, function($a, $b) { |
| 137 | 137 | return strtolower($a['label']) <=> strtolower($b['label']); |
| 138 | 138 | }); |
| 139 | - } |
|
| 140 | - elseif ($relationshipType === 'project') |
|
| 139 | + } elseif ($relationshipType === 'project') |
|
| 141 | 140 | { |
| 142 | 141 | $projects = $this->getProjects(); |
| 143 | 142 | |
@@ -394,8 +393,7 @@ discard block |
||
| 394 | 393 | if ( ! isset($hoursByPerson[$timeEntry->user->name])) |
| 395 | 394 | { |
| 396 | 395 | $hoursByPerson[$timeEntry->user->name] = $timeEntry->hours; |
| 397 | - } |
|
| 398 | - else |
|
| 396 | + } else |
|
| 399 | 397 | { |
| 400 | 398 | $hoursByPerson[$timeEntry->user->name] += $timeEntry->hours; |
| 401 | 399 | } |
@@ -440,8 +438,7 @@ discard block |
||
| 440 | 438 | if ($roundTime) |
| 441 | 439 | { |
| 442 | 440 | $total += $roundedHours * $timeEntry->billable_rate; |
| 443 | - } |
|
| 444 | - else |
|
| 441 | + } else |
|
| 445 | 442 | { |
| 446 | 443 | $total += $timeEntry->hours * $timeEntry->billable_rate; |
| 447 | 444 | } |
@@ -514,8 +511,7 @@ discard block |
||
| 514 | 511 | if ($roundTime) |
| 515 | 512 | { |
| 516 | 513 | $total += $roundedHours * $timeEntry->billable_rate; |
| 517 | - } |
|
| 518 | - else |
|
| 514 | + } else |
|
| 519 | 515 | { |
| 520 | 516 | $total += $timeEntry->hours * $timeEntry->billable_rate; |
| 521 | 517 | } |
@@ -568,8 +564,7 @@ discard block |
||
| 568 | 564 | if ($roundTime) |
| 569 | 565 | { |
| 570 | 566 | $timeCost = $roundedHours * $timeEntry->cost_rate; |
| 571 | - } |
|
| 572 | - else |
|
| 567 | + } else |
|
| 573 | 568 | { |
| 574 | 569 | $timeCost = $timeEntry->hours * $timeEntry->cost_rate; |
| 575 | 570 | } |
@@ -604,8 +599,7 @@ discard block |
||
| 604 | 599 | $endpointPieces = explode('?', $endpoint); |
| 605 | 600 | $endpointWithoutParameters = $endpointPieces[0]; |
| 606 | 601 | $endpoint .= '&page='; |
| 607 | - } |
|
| 608 | - else |
|
| 602 | + } else |
|
| 609 | 603 | { |
| 610 | 604 | $endpointWithoutParameters = $endpoint; |
| 611 | 605 | $endpoint .= '?page='; |
@@ -668,18 +662,15 @@ discard block |
||
| 668 | 662 | { |
| 669 | 663 | // round up to nearest half hour |
| 670 | 664 | return ceil($hours * 2) / 2; |
| 671 | - } |
|
| 672 | - elseif ($method === 'nearestHalfHour') |
|
| 665 | + } elseif ($method === 'nearestHalfHour') |
|
| 673 | 666 | { |
| 674 | 667 | // round up or down to closest half hour |
| 675 | 668 | return round($hours * 2) / 2; |
| 676 | - } |
|
| 677 | - elseif ($method === 'nextWholeNumber') |
|
| 669 | + } elseif ($method === 'nextWholeNumber') |
|
| 678 | 670 | { |
| 679 | 671 | // round up to whole number |
| 680 | 672 | return round($hours); |
| 681 | - } |
|
| 682 | - elseif ($method === 'nearestWholeNumber') |
|
| 673 | + } elseif ($method === 'nearestWholeNumber') |
|
| 683 | 674 | { |
| 684 | 675 | // round up or down to closest whole number |
| 685 | 676 | return round($hours, 0, PHP_ROUND_HALF_EVEN); |
@@ -139,8 +139,7 @@ discard block |
||
| 139 | 139 | 'default' => null |
| 140 | 140 | ]; |
| 141 | 141 | } |
| 142 | - } |
|
| 143 | - elseif ($relationshipType === 'organization') |
|
| 142 | + } elseif ($relationshipType === 'organization') |
|
| 144 | 143 | { |
| 145 | 144 | foreach ($this->getOrganizations() as $organization) |
| 146 | 145 | { |
@@ -156,8 +155,7 @@ discard block |
||
| 156 | 155 | usort($options, function($a, $b) { |
| 157 | 156 | return strtolower($a['label']) <=> strtolower($b['label']); |
| 158 | 157 | }); |
| 159 | - } |
|
| 160 | - elseif ($relationshipType === 'person') |
|
| 158 | + } elseif ($relationshipType === 'person') |
|
| 161 | 159 | { |
| 162 | 160 | foreach (SaasLink::$plugin->capsule->getPeople() as $person) |
| 163 | 161 | { |
@@ -287,8 +285,7 @@ discard block |
||
| 287 | 285 | $endpointPieces = explode('?', $endpoint); |
| 288 | 286 | $endpointWithoutParameters = $endpointPieces[0]; |
| 289 | 287 | $endpoint .= '&page='; |
| 290 | - } |
|
| 291 | - else |
|
| 288 | + } else |
|
| 292 | 289 | { |
| 293 | 290 | $endpointWithoutParameters = $endpoint; |
| 294 | 291 | $endpoint .= '?page='; |
@@ -131,8 +131,7 @@ |
||
| 131 | 131 | if (self::CACHE_ENABLED && $cachedResponse = Craft::$app->cache->get($cacheKey)) |
| 132 | 132 | { |
| 133 | 133 | $responseData = $cachedResponse; |
| 134 | - } |
|
| 135 | - else |
|
| 134 | + } else |
|
| 136 | 135 | { |
| 137 | 136 | $response = $this->client->get(sprintf( |
| 138 | 137 | 'organizations/%s/boards?filter=%s&fields=%s', |