Skip to content

Commit

Permalink
Updated InfoRedactor to remove non PHP 7.4 code. (#1060)
Browse files Browse the repository at this point in the history
  • Loading branch information
fiboknacky authored Dec 13, 2024
1 parent aa08607 commit c875cbd
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
10 changes: 8 additions & 2 deletions src/Google/Ads/GoogleAds/Lib/V16/InfoRedactor.php
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,10 @@ private static function redactFeed(Feed $feed)
private static function redactLocalServicesLeadContactDetailsEmail(
LocalServicesLead $localServicesLead
) {
if ($localServicesLead?->getContactDetails()?->getEmail()) {
if (
!is_null($localServicesLead->getContactDetails())
&& !is_null($localServicesLead->getContactDetails()->getEmail())
) {
$localServicesLead->getContactDetails()->setEmail(self::REDACTED_STRING);
}
}
Expand All @@ -399,7 +402,10 @@ private static function redactLocalServicesLeadContactDetailsEmail(
private static function redactLocalServicesLeadConversationMessageDetailsText(
LocalServicesLeadConversation $localServicesLeadConversation
) {
if ($localServicesLeadConversation?->getMessageDetails()?->getText()) {
if (
!is_null($localServicesLeadConversation->getMessageDetails())
&& !is_null($localServicesLeadConversation->getMessageDetails()->getText())
) {
$localServicesLeadConversation->getMessageDetails()->setText(self::REDACTED_STRING);
}
}
Expand Down
10 changes: 8 additions & 2 deletions src/Google/Ads/GoogleAds/Lib/V17/InfoRedactor.php
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,10 @@ private static function redactFeed(Feed $feed)
private static function redactLocalServicesLeadContactDetailsEmail(
LocalServicesLead $localServicesLead
) {
if ($localServicesLead?->getContactDetails()?->getEmail()) {
if (
!is_null($localServicesLead->getContactDetails())
&& !is_null($localServicesLead->getContactDetails()->getEmail())
) {
$localServicesLead->getContactDetails()->setEmail(self::REDACTED_STRING);
}
}
Expand All @@ -399,7 +402,10 @@ private static function redactLocalServicesLeadContactDetailsEmail(
private static function redactLocalServicesLeadConversationMessageDetailsText(
LocalServicesLeadConversation $localServicesLeadConversation
) {
if ($localServicesLeadConversation?->getMessageDetails()?->getText()) {
if (
!is_null($localServicesLeadConversation->getMessageDetails())
&& !is_null($localServicesLeadConversation->getMessageDetails()->getText())
) {
$localServicesLeadConversation->getMessageDetails()->setText(self::REDACTED_STRING);
}
}
Expand Down
10 changes: 8 additions & 2 deletions src/Google/Ads/GoogleAds/Lib/V18/InfoRedactor.php
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,10 @@ private static function redactFeed(Feed $feed)
private static function redactLocalServicesLeadContactDetailsEmail(
LocalServicesLead $localServicesLead
) {
if ($localServicesLead?->getContactDetails()?->getEmail()) {
if (
!is_null($localServicesLead->getContactDetails())
&& !is_null($localServicesLead->getContactDetails()->getEmail())
) {
$localServicesLead->getContactDetails()->setEmail(self::REDACTED_STRING);
}
}
Expand All @@ -399,7 +402,10 @@ private static function redactLocalServicesLeadContactDetailsEmail(
private static function redactLocalServicesLeadConversationMessageDetailsText(
LocalServicesLeadConversation $localServicesLeadConversation
) {
if ($localServicesLeadConversation?->getMessageDetails()?->getText()) {
if (
!is_null($localServicesLeadConversation->getMessageDetails())
&& !is_null($localServicesLeadConversation->getMessageDetails()->getText())
) {
$localServicesLeadConversation->getMessageDetails()->setText(self::REDACTED_STRING);
}
}
Expand Down

0 comments on commit c875cbd

Please sign in to comment.