From 28b756834c0c6ae137e2b35f878638761767aa1b Mon Sep 17 00:00:00 2001 From: Mihai Mazuro Date: Tue, 13 Aug 2024 14:49:44 +0300 Subject: [PATCH 1/3] #759 cli notifications email --- src/Diff.php | 5 +++-- src/Project.php | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Diff.php b/src/Diff.php index 278b094..d5a8c65 100644 --- a/src/Diff.php +++ b/src/Diff.php @@ -51,7 +51,7 @@ protected function __construct(int $diffId) * @return mixed * @throws \Diffy\InvalidArgumentsException */ - public static function create(int $projectId, int $screenshotId1, int $screenshotId2, string $name = '') + public static function create(int $projectId, int $screenshotId1, int $screenshotId2, array $options = []) { if (empty($projectId)) { throw new InvalidArgumentsException('Project ID can not be empty'); @@ -68,7 +68,8 @@ public static function create(int $projectId, int $screenshotId1, int $screensho return Diffy::request('POST', 'projects/' . $projectId . '/diffs', [ 'snapshot1' => $screenshotId1, 'snapshot2' => $screenshotId2, - 'name' => $name, + 'name' => $options['name'], + 'notifications' => $options['notifications'], ]); } diff --git a/src/Project.php b/src/Project.php index e212c32..592aa5f 100644 --- a/src/Project.php +++ b/src/Project.php @@ -92,6 +92,10 @@ public static function compare(int $projectId, $params = []) $arguments['commitSha'] = $params['commitSha']; } + if (!empty($params['notifications'])) { + $arguments['notifications'] = $params['notifications']; + } + return Diffy::request('POST', 'projects/' . $projectId . '/compare', $arguments); } From 8dd03d73bc63992b8828d93df440b6bb238a6656 Mon Sep 17 00:00:00 2001 From: Mihai Mazuro Date: Tue, 13 Aug 2024 15:02:18 +0300 Subject: [PATCH 2/3] #759 add null coalesce operator --- src/Diff.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Diff.php b/src/Diff.php index d5a8c65..eab82bc 100644 --- a/src/Diff.php +++ b/src/Diff.php @@ -68,8 +68,8 @@ public static function create(int $projectId, int $screenshotId1, int $screensho return Diffy::request('POST', 'projects/' . $projectId . '/diffs', [ 'snapshot1' => $screenshotId1, 'snapshot2' => $screenshotId2, - 'name' => $options['name'], - 'notifications' => $options['notifications'], + 'name' => $options['name'] ?? null, + 'notifications' => $options['notifications'] ?? null, ]); } From a690b47a56b4493c63e1afcca46ae9a91cd4fc58 Mon Sep 17 00:00:00 2001 From: Mihai Mazuro Date: Tue, 13 Aug 2024 15:42:21 +0300 Subject: [PATCH 3/3] #759 update attribute --- src/Diff.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Diff.php b/src/Diff.php index eab82bc..b6e40c1 100644 --- a/src/Diff.php +++ b/src/Diff.php @@ -47,7 +47,7 @@ protected function __construct(int $diffId) * @param int $projectId * @param int $screenshotId1 * @param int $screenshotId2 - * @param string $name + * @param array $options * @return mixed * @throws \Diffy\InvalidArgumentsException */