Skip to content

Commit

Permalink
Rename function for clarity and remove some debugging echos
Browse files Browse the repository at this point in the history
  • Loading branch information
mtompset committed Jan 22, 2025
1 parent 0b57ad9 commit 8160b68
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions SilMock/Google/Service/Groupssettings/Resource/Groups.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,9 @@ public function delete(string $groupKey)
}
}

protected function doesGroupExist(string $groupKey): bool
protected function doGroupsSettingsExist(string $groupKey): bool
{
echo "PASSED GROUPKEY: " . $groupKey . "\n";
$groupsSettings = $this->get($groupKey);
echo "RESULTS: " . json_encode($groupsSettings, JSON_PRETTY_PRINT) . "\n";
return ($groupsSettings !== null);
}

Expand Down Expand Up @@ -67,7 +65,7 @@ public function get(string $groupKey): ?GoogleGroupsSettings_Groups
*/
public function insert(GoogleGroupsSettings_Groups $postBody, $optParams = [])
{
if (! $this->doesGroupExist($postBody->getEmail())) {
if (! $this->doGroupsSettingsExist($postBody->getEmail())) {
$id = str_replace(array(' ', '.'), '', microtime());
$postBody['id'] = $postBody['id'] ?? $id;
$dataAsJson = json_encode(get_object_vars($postBody));
Expand All @@ -78,8 +76,8 @@ public function insert(GoogleGroupsSettings_Groups $postBody, $optParams = [])

public function update(string $groupKey, GoogleGroupsSettings_Groups $postBody, $optParams = []): GoogleGroupsSettings_Groups
{
if (! $this->doesGroupExist($postBody->getEmail())) {
throw new Exception("Group '{$groupKey}' does not exist.");
if (! $this->doGroupsSettingsExist($postBody->getEmail())) {
throw new Exception("Group Settings for '{$groupKey}' does not exist.");
}
$groupsSettings = $this->get($groupKey);

Expand Down

0 comments on commit 8160b68

Please sign in to comment.