From db4879ae84a3a1959729ac2732ae42cfe377314c Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Mon, 28 Nov 2016 08:22:19 -0600 Subject: [PATCH] fix formatting and tests --- .../Channels/SlackWebhookChannel.php | 2 +- .../Messages/SlackAttachment.php | 3 +-- .../Messages/SlackAttachmentField.php | 21 ++++++------------- .../NotificationSlackChannelTest.php | 2 +- 4 files changed, 9 insertions(+), 19 deletions(-) diff --git a/src/Illuminate/Notifications/Channels/SlackWebhookChannel.php b/src/Illuminate/Notifications/Channels/SlackWebhookChannel.php index f8b7c000e78b..f9fd1436a731 100644 --- a/src/Illuminate/Notifications/Channels/SlackWebhookChannel.php +++ b/src/Illuminate/Notifications/Channels/SlackWebhookChannel.php @@ -3,10 +3,10 @@ namespace Illuminate\Notifications\Channels; use GuzzleHttp\Client as HttpClient; -use Illuminate\Notifications\Messages\SlackAttachmentField; use Illuminate\Notifications\Notification; use Illuminate\Notifications\Messages\SlackMessage; use Illuminate\Notifications\Messages\SlackAttachment; +use Illuminate\Notifications\Messages\SlackAttachmentField; class SlackWebhookChannel { diff --git a/src/Illuminate/Notifications/Messages/SlackAttachment.php b/src/Illuminate/Notifications/Messages/SlackAttachment.php index 1deee81942e0..dc8c8ca8e76e 100644 --- a/src/Illuminate/Notifications/Messages/SlackAttachment.php +++ b/src/Illuminate/Notifications/Messages/SlackAttachment.php @@ -122,9 +122,8 @@ public function field($title, $content = '') if (is_callable($title)) { $callback = $title; - $attachmentField = new SlackAttachmentField(); + $callback($attachmentField = new SlackAttachmentField); - $callback($attachmentField); $this->fields[] = $attachmentField; return $this; diff --git a/src/Illuminate/Notifications/Messages/SlackAttachmentField.php b/src/Illuminate/Notifications/Messages/SlackAttachmentField.php index b993ab747924..f63bb2678d7a 100644 --- a/src/Illuminate/Notifications/Messages/SlackAttachmentField.php +++ b/src/Illuminate/Notifications/Messages/SlackAttachmentField.php @@ -19,8 +19,7 @@ class SlackAttachmentField protected $content; /** - * Whether the content is short enough to fit side by side with - * other contents. + * Whether the content is short. * * @var bool */ @@ -29,7 +28,7 @@ class SlackAttachmentField /** * Set the title of the field. * - * @param string $title + * @param string $title * @return $this */ public function title($title) @@ -42,7 +41,7 @@ public function title($title) /** * Set the content of the field. * - * @param string $content + * @param string $content * @return $this */ public function content($content) @@ -53,19 +52,11 @@ public function content($content) } /** + * Indicates that the content should not be displayed side-by-side with other fields. + * * @return $this */ - public function displaySideBySide() - { - $this->short = true; - - return $this; - } - - /** - * @return $this - */ - public function dontDisplaySideBySide() + public function long() { $this->short = false; diff --git a/tests/Notifications/NotificationSlackChannelTest.php b/tests/Notifications/NotificationSlackChannelTest.php index a84b8f0a5df4..9965ed0311e5 100644 --- a/tests/Notifications/NotificationSlackChannelTest.php +++ b/tests/Notifications/NotificationSlackChannelTest.php @@ -182,7 +182,7 @@ public function toSlack($notifiable) $attachmentField ->title('Special powers') ->content('Zonda') - ->dontDisplaySideBySide(); + ->long(); }); }); }