Skip to content

Commit

Permalink
Fix TypeError, when getEmail() is null (#56)
Browse files Browse the repository at this point in the history
* Fix TypeError, when getEmail() is null

* Apply php-cs-fixer changes

---------

Co-authored-by: blankse <[email protected]>
  • Loading branch information
blankse and blankse authored Nov 22, 2024
1 parent 8b1779b commit 4e49467
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public function getParamsForSingleSending(int $limit, int $offset): array
$containers = [];

foreach ($objects as $object) {
if (method_exists($object, 'getEmail')) {
if (method_exists($object, 'getEmail') && $object->getEmail()) {
$containers[] = new SendingParamContainer($object->getEmail(), [
'gender' => method_exists($object, 'getGender') ? $object->getGender() : '',
'firstname' => method_exists($object, 'getFirstname') ? $object->getFirstname() : '',
Expand Down
8 changes: 4 additions & 4 deletions src/Installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ private function addUserPermission(): void
foreach (self::USER_PERMISSIONS as $permission) {
// check if the permission already exists
$permissionExists = $db->executeStatement('SELECT `key` FROM users_permission_definitions WHERE `key` = :key', ['key' => $permission]);
if(!$permissionExists) {
if (!$permissionExists) {
$db->insert('users_permission_definitions', [
$db->quoteIdentifier('key') => $permission,
$db->quoteIdentifier('category') => self::USER_PERMISSION_CATEGORY,
Expand Down Expand Up @@ -139,11 +139,11 @@ private function modifyEnumTypes(array $enums): void

private function removeNewsLetterDocTypes(): void
{
foreach(SettingsStore::getIdsByScope(self::SETTINGS_STORE_SCOPE) as $id) {
foreach (SettingsStore::getIdsByScope(self::SETTINGS_STORE_SCOPE) as $id) {
$newsletterDocType = SettingsStore::get($id, self::SETTINGS_STORE_SCOPE);
if($newsletterDocType) {
if ($newsletterDocType) {
$data = json_decode($newsletterDocType->getData(), true);
if(!empty($data) && $data['type'] === self::DOCTYPE) {
if (!empty($data) && $data['type'] === self::DOCTYPE) {
SettingsStore::delete($id, self::SETTINGS_STORE_SCOPE);
}
}
Expand Down

0 comments on commit 4e49467

Please sign in to comment.