Skip to content

Commit

Permalink
fix formatting and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Nov 28, 2016
1 parent 759c31b commit db4879a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
3 changes: 1 addition & 2 deletions src/Illuminate/Notifications/Messages/SlackAttachment.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
21 changes: 6 additions & 15 deletions src/Illuminate/Notifications/Messages/SlackAttachmentField.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand All @@ -29,7 +28,7 @@ class SlackAttachmentField
/**
* Set the title of the field.
*
* @param string $title
* @param string $title
* @return $this
*/
public function title($title)
Expand All @@ -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)
Expand All @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion tests/Notifications/NotificationSlackChannelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public function toSlack($notifiable)
$attachmentField
->title('Special powers')
->content('Zonda')
->dontDisplaySideBySide();
->long();
});
});
}
Expand Down

0 comments on commit db4879a

Please sign in to comment.