| Conditions | 3 |
| Paths | 4 |
| Total Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 12 |
| Changes | 0 | ||
| 1 | <?php |
||
| 41 | public function findHubSpotId(string $fieldId, string $elementId, string $siteId = null) |
||
| 42 | { |
||
| 43 | if ($siteId === null) { |
||
| 44 | /** @noinspection PhpUnhandledExceptionInspection */ |
||
| 45 | $siteId = \Craft::$app->getSites()->getCurrentSite()->id; |
||
| 46 | } |
||
| 47 | |||
| 48 | $hubSpotId = HubSpot::getInstance()->getResourceAssociations()->getQuery([ |
||
| 49 | 'select' => ['hubSpotId'], |
||
| 50 | 'elementId' => $elementId, |
||
| 51 | 'siteId' => $siteId, |
||
| 52 | 'fieldId' => $fieldId |
||
| 53 | ])->scalar(); |
||
| 54 | |||
| 55 | return is_string($hubSpotId) ? $hubSpotId : null; |
||
| 56 | } |
||
| 57 | } |
||
| 58 |