Skip to content
This repository has been archived by the owner on Sep 27, 2019. It is now read-only.

Commit

Permalink
Merge pull request #11 from laravel-notification-channels/analysis-zE…
Browse files Browse the repository at this point in the history
…Em3M

Applied fixes from StyleCI
  • Loading branch information
pmatseykanets committed Aug 25, 2016
2 parents 08f84cf + 349a1cd commit 665c450
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 10 deletions.
8 changes: 8 additions & 0 deletions src/Card.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ public static function create($title = '', $id = '')
public function title($title)
{
$this->title = trim($title);

return $this;
}

Expand All @@ -174,6 +175,7 @@ public function title($title)
public function id($id)
{
$this->id = trim($id);

return $this;
}

Expand All @@ -186,6 +188,7 @@ public function id($id)
public function style($style)
{
$this->style = $style;

return $this;
}

Expand All @@ -198,6 +201,7 @@ public function style($style)
public function content($content)
{
$this->content = trim($content);

return $this;
}

Expand Down Expand Up @@ -244,6 +248,7 @@ public function html($content = '')
public function cardFormat($cardFormat)
{
$this->cardFormat = trim($cardFormat);

return $this;
}

Expand All @@ -256,6 +261,7 @@ public function cardFormat($cardFormat)
public function url($url)
{
$this->url = trim($url);

return $this;
}

Expand Down Expand Up @@ -338,12 +344,14 @@ public function addAttribute($attribute)
{
if ($attribute instanceof CardAttribute) {
$this->attributes[] = $attribute;

return $this;
}

if ($attribute instanceof \Closure) {
$attribute($new = new CardAttribute());
$this->attributes[] = $new;

return $this;
}

Expand Down
8 changes: 6 additions & 2 deletions src/CardAttribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class CardAttribute
public function value($value)
{
$this->value = trim($value);

return $this;
}

Expand All @@ -55,6 +56,7 @@ public function value($value)
public function label($label)
{
$this->label = trim($label);

return $this;
}

Expand All @@ -65,6 +67,7 @@ public function label($label)
public function url($url)
{
$this->url = trim($url);

return $this;
}

Expand All @@ -77,11 +80,12 @@ public function url($url)
public function style($style)
{
$this->style = trim($style);

return $this;
}

/**
* Sets the icon for the atttribute
* Sets the icon for the atttribute.
*
* @param string $icon
* @param string|null $icon2
Expand Down Expand Up @@ -136,7 +140,7 @@ public function toArray()
'style' => $this->style,
]),
];

if (! empty($this->icon)) {
$attribute['value']['icon'] = array_filter([
'url' => $this->icon,
Expand Down
2 changes: 1 addition & 1 deletion src/CardAttributeStyles.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ interface CardAttributeStyles
const COMPLETE = 'lozenge-complete';
const MOVED = 'lozenge-moved';
const GENERAL = 'lozenge';
}
}
2 changes: 1 addition & 1 deletion src/CardFormats.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ interface CardFormats
{
const MEDIUM = 'medium';
const COMPACT = 'compact';
}
}
2 changes: 1 addition & 1 deletion src/CardStyles.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ interface CardStyles
const IMAGE = 'image';
const LINK = 'link';
const MEDIA = 'media';
}
}
2 changes: 2 additions & 0 deletions src/HipChatMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -242,12 +242,14 @@ public function card($card)
{
if ($card instanceof Card) {
$this->card = $card;

return $this;
}

if ($card instanceof \Closure) {
$card($new = new Card());
$this->card = $new;

return $this;
}

Expand Down
6 changes: 3 additions & 3 deletions tests/CardAttributeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function test_it_transforms_to_array()
'icon' => [
'url' => 'http://example.com/qux',
'url@2x' => 'http://example.com/quux',
]
],
],
'label' => 'foo',
], $attribute->toArray());
Expand All @@ -55,8 +55,8 @@ public function test_it_transforms_to_array_being_partially_populated()
'label' => 'bar',
'icon' => [
'url' => 'http://example.com/qux',
]
],
],
], $attribute->toArray());
}
}
}
4 changes: 2 additions & 2 deletions tests/CardTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,12 +215,12 @@ public function test_it_transforms_to_array()
'html' => '<b>Activity content</b>',
'icon' => [
'url' => 'http://example.com/activity',
'url@2x' => 'http://example.com/activity2'
'url@2x' => 'http://example.com/activity2',
],
],
'icon' => [
'url' => 'http://example.com/icon',
'url@2x' => 'http://example.com/icon2'
'url@2x' => 'http://example.com/icon2',
],
'attributes' => [$attribute->toArray()],
], $card->toArray());
Expand Down

0 comments on commit 665c450

Please sign in to comment.