-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* More handy subclasses Introduce more handy subclasses `Section`, `Divider`, `MarkdownText`, `PlainText`, `Image`, `Button` to be used instead of the generic classes `Block`, `Accessory`, `Text` * Update README with a Hello, World! example * Update the readme file * Fix accessory type for buttons and new lines at the end of some classes.
- Loading branch information
1 parent
ec8d7c5
commit 3405a97
Showing
8 changed files
with
152 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
namespace AmirIskander\SlackNotifier; | ||
|
||
class Button extends Accessory | ||
{ | ||
public function __construct(string $url, string $text, ?string $alt = null) | ||
{ | ||
parent::__construct('button'); | ||
$this | ||
->setUrl($url) | ||
->setText(new PlainText($text)) | ||
->setAltText($alt) | ||
; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
namespace AmirIskander\SlackNotifier; | ||
|
||
class Divider extends Block | ||
{ | ||
public function __construct() | ||
{ | ||
parent::__construct('divider'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
namespace AmirIskander\SlackNotifier; | ||
|
||
class Image extends Accessory | ||
{ | ||
public function __construct(string $url, ?string $alt = null) | ||
{ | ||
parent::__construct('image'); | ||
$this | ||
->setImageUrl($url) | ||
->setAltText($alt) | ||
; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
namespace AmirIskander\SlackNotifier; | ||
|
||
class MarkdownText extends Text | ||
{ | ||
public function __construct(string $text) | ||
{ | ||
parent::__construct('mrkdwn', $text); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
namespace AmirIskander\SlackNotifier; | ||
|
||
class PlainText extends Text | ||
{ | ||
public function __construct(string $text) | ||
{ | ||
parent::__construct('plain_text', $text); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
namespace AmirIskander\SlackNotifier; | ||
|
||
class Section extends Block | ||
{ | ||
public function __construct() | ||
{ | ||
parent::__construct('section'); | ||
} | ||
} |