@@ -12,24 +12,24 @@ |
||
| 12 | 12 | /** |
| 13 | 13 | * @return UsernameInterface|null |
| 14 | 14 | */ |
| 15 | - public function getUsername(); |
|
| 15 | + public function getUsername (); |
|
| 16 | 16 | |
| 17 | 17 | /** |
| 18 | 18 | * Returns whether there is a custom Username. |
| 19 | 19 | * |
| 20 | 20 | * @return bool |
| 21 | 21 | */ |
| 22 | - public function hasUsername(); |
|
| 22 | + public function hasUsername (); |
|
| 23 | 23 | |
| 24 | 24 | /** |
| 25 | 25 | * @return IconInterface|null |
| 26 | 26 | */ |
| 27 | - public function getIcon(); |
|
| 27 | + public function getIcon (); |
|
| 28 | 28 | |
| 29 | 29 | /** |
| 30 | 30 | * Returns whether there is a custom Icon. |
| 31 | 31 | * |
| 32 | 32 | * @return bool |
| 33 | 33 | */ |
| 34 | - public function hasIcon(); |
|
| 34 | + public function hasIcon (); |
|
| 35 | 35 | } |
@@ -16,12 +16,12 @@ |
||
| 16 | 16 | * |
| 17 | 17 | * @return string |
| 18 | 18 | */ |
| 19 | - public function getUsername(); |
|
| 19 | + public function getUsername (); |
|
| 20 | 20 | |
| 21 | 21 | /** |
| 22 | 22 | * The string representation of the username class should match the username. |
| 23 | 23 | * |
| 24 | 24 | * @return string |
| 25 | 25 | */ |
| 26 | - public function __toString(); |
|
| 26 | + public function __toString (); |
|
| 27 | 27 | } |
@@ -14,26 +14,26 @@ |
||
| 14 | 14 | * |
| 15 | 15 | * @return string |
| 16 | 16 | */ |
| 17 | - public function getUrl(); |
|
| 17 | + public function getUrl (); |
|
| 18 | 18 | |
| 19 | 19 | /** |
| 20 | 20 | * A custom channel that will override the default set in the config on slack. |
| 21 | 21 | * |
| 22 | 22 | * @return ChannelInterface |
| 23 | 23 | */ |
| 24 | - public function getCustomChannel(); |
|
| 24 | + public function getCustomChannel (); |
|
| 25 | 25 | |
| 26 | 26 | /** |
| 27 | 27 | * This will return true if there is a custom channel that will override the default set in the config on slack. |
| 28 | 28 | * |
| 29 | 29 | * @return bool |
| 30 | 30 | */ |
| 31 | - public function hasCustomChannel(); |
|
| 31 | + public function hasCustomChannel (); |
|
| 32 | 32 | |
| 33 | 33 | /** |
| 34 | 34 | * The to string representation of the webhook should return the url of the webhook. |
| 35 | 35 | * |
| 36 | 36 | * @return string |
| 37 | 37 | */ |
| 38 | - public function __toString(); |
|
| 38 | + public function __toString (); |
|
| 39 | 39 | } |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | * @param array $record |
| 50 | 50 | * @param SlackConfigInterface $slackConfig |
| 51 | 51 | */ |
| 52 | - public function __construct(array $record, SlackConfigInterface $slackConfig = null) |
|
| 52 | + public function __construct (array $record, SlackConfigInterface $slackConfig = null) |
|
| 53 | 53 | { |
| 54 | 54 | $this->record = $record; |
| 55 | 55 | $this->slackConfig = $slackConfig; |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | $this->generatePayload(); |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - private function generatePayload() |
|
| 60 | + private function generatePayload () |
|
| 61 | 61 | { |
| 62 | 62 | $this->setErrorData(); |
| 63 | 63 | |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | /** |
| 72 | 72 | * Generate the payload for the slack config. |
| 73 | 73 | */ |
| 74 | - private function generatePayloadForSlackConfig() |
|
| 74 | + private function generatePayloadForSlackConfig () |
|
| 75 | 75 | { |
| 76 | 76 | $this->setChannel(); |
| 77 | 77 | |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | } |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - private function generatePayloadForCustomUser() |
|
| 83 | + private function generatePayloadForCustomUser () |
|
| 84 | 84 | { |
| 85 | 85 | $this->setIcon(); |
| 86 | 86 | $this->setUsername(); |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | /** |
| 90 | 90 | * Set a custom icon if available. |
| 91 | 91 | */ |
| 92 | - private function setIcon() |
|
| 92 | + private function setIcon () |
|
| 93 | 93 | { |
| 94 | 94 | if (!$this->slackConfig->getCustomUser()->hasIcon()) { |
| 95 | 95 | return; |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | /** |
| 103 | 103 | * Set a custom username if available. |
| 104 | 104 | */ |
| 105 | - private function setUsername() |
|
| 105 | + private function setUsername () |
|
| 106 | 106 | { |
| 107 | 107 | if (!$this->slackConfig->getCustomUser()->hasUsername()) { |
| 108 | 108 | return; |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | /** |
| 115 | 115 | * Set a custom channel if available. |
| 116 | 116 | */ |
| 117 | - private function setChannel() |
|
| 117 | + private function setChannel () |
|
| 118 | 118 | { |
| 119 | 119 | if (!$this->slackConfig->getWebhook()->hasCustomChannel()) { |
| 120 | 120 | return; |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | /** |
| 127 | 127 | * If available set the error data. |
| 128 | 128 | */ |
| 129 | - private function setErrorData() |
|
| 129 | + private function setErrorData () |
|
| 130 | 130 | { |
| 131 | 131 | if (!isset($this->record['context']['error'])) { |
| 132 | 132 | return; |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | $this->errorData = $this->record['context']['error']; |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | - private function setAttachments() |
|
| 138 | + private function setAttachments () |
|
| 139 | 139 | { |
| 140 | 140 | $this->payload['attachments'] = [ |
| 141 | 141 | new BasicInfoAttachment($this->record, $this->errorData), |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | } |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | - private function addErrorSpecificAttachments() |
|
| 149 | + private function addErrorSpecificAttachments () |
|
| 150 | 150 | { |
| 151 | 151 | $formatter = new StringFormat(); |
| 152 | 152 | $this->payload['attachments'][] = new TraceAttachment($this->errorData, $formatter); |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | /** |
| 156 | 156 | * {@inheritdoc} |
| 157 | 157 | */ |
| 158 | - public function jsonSerialize() |
|
| 158 | + public function jsonSerialize () |
|
| 159 | 159 | { |
| 160 | 160 | return $this->payload; |
| 161 | 161 | } |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | /** |
| 164 | 164 | * @inheritDoc |
| 165 | 165 | */ |
| 166 | - public function __toString() |
|
| 166 | + public function __toString () |
|
| 167 | 167 | { |
| 168 | 168 | return json_encode($this->jsonSerialize()); |
| 169 | 169 | } |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | * |
| 23 | 23 | * @return string |
| 24 | 24 | */ |
| 25 | - public function escape($unescapedText) |
|
| 25 | + public function escape ($unescapedText) |
|
| 26 | 26 | { |
| 27 | 27 | return str_replace(['&', '<', '>'], ['&', '<', '>'], $unescapedText); |
| 28 | 28 | } |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | * |
| 35 | 35 | * @return string |
| 36 | 36 | */ |
| 37 | - public function emphasis($text) |
|
| 37 | + public function emphasis ($text) |
|
| 38 | 38 | { |
| 39 | 39 | return $this->wrapStringWith($text, '*'); |
| 40 | 40 | } |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | * |
| 47 | 47 | * @return string |
| 48 | 48 | */ |
| 49 | - public function italicize($text) |
|
| 49 | + public function italicize ($text) |
|
| 50 | 50 | { |
| 51 | 51 | return $this->wrapStringWith($text, '_'); |
| 52 | 52 | } |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | * |
| 59 | 59 | * @return string |
| 60 | 60 | */ |
| 61 | - public function strikethrough($text) |
|
| 61 | + public function strikethrough ($text) |
|
| 62 | 62 | { |
| 63 | 63 | return $this->wrapStringWith($text, '~'); |
| 64 | 64 | } |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | * |
| 71 | 71 | * @return string |
| 72 | 72 | */ |
| 73 | - public function pre($text) |
|
| 73 | + public function pre ($text) |
|
| 74 | 74 | { |
| 75 | 75 | return $this->wrapStringWith($text, '```'); |
| 76 | 76 | } |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | * |
| 83 | 83 | * @return string |
| 84 | 84 | */ |
| 85 | - public function code($text) |
|
| 85 | + public function code ($text) |
|
| 86 | 86 | { |
| 87 | 87 | return $this->wrapStringWith($text, '`'); |
| 88 | 88 | } |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | * |
| 97 | 97 | * @return string |
| 98 | 98 | */ |
| 99 | - public function indent($text) |
|
| 99 | + public function indent ($text) |
|
| 100 | 100 | { |
| 101 | 101 | return '>' . str_replace("\n", "\n>", $text); |
| 102 | 102 | } |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | * |
| 109 | 109 | * @return string |
| 110 | 110 | */ |
| 111 | - public function arrayToNumberedList(array $listItems) |
|
| 111 | + public function arrayToNumberedList (array $listItems) |
|
| 112 | 112 | { |
| 113 | 113 | $formattedList = ''; |
| 114 | 114 | $number = 1; |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | * |
| 128 | 128 | * @return string |
| 129 | 129 | */ |
| 130 | - public function arrayToKeyValueList(array $listItems) |
|
| 130 | + public function arrayToKeyValueList (array $listItems) |
|
| 131 | 131 | { |
| 132 | 132 | $formattedList = ''; |
| 133 | 133 | |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | * |
| 147 | 147 | * @return string |
| 148 | 148 | */ |
| 149 | - public function arrayToBulletList(array $listItems, $bulletCharacter = '•') |
|
| 149 | + public function arrayToBulletList (array $listItems, $bulletCharacter = '•') |
|
| 150 | 150 | { |
| 151 | 151 | $formattedList = ''; |
| 152 | 152 | |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | * |
| 166 | 166 | * @return string |
| 167 | 167 | */ |
| 168 | - private function wrapStringWith($text, $wrapper) |
|
| 168 | + private function wrapStringWith ($text, $wrapper) |
|
| 169 | 169 | { |
| 170 | 170 | return sprintf("%1\$s%2\$s%1\$s", $wrapper, $text); |
| 171 | 171 | } |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | /** |
| 16 | 16 | * {@inheritdoc} |
| 17 | 17 | */ |
| 18 | - public function getIcon() |
|
| 18 | + public function getIcon () |
|
| 19 | 19 | { |
| 20 | 20 | return $this->getUrl(); |
| 21 | 21 | } |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | /** |
| 24 | 24 | * {@inheritdoc} |
| 25 | 25 | */ |
| 26 | - public function getType() |
|
| 26 | + public function getType () |
|
| 27 | 27 | { |
| 28 | 28 | return 'url'; |
| 29 | 29 | } |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | * @param UsernameInterface|null $username |
| 31 | 31 | * @param IconInterface|null $icon |
| 32 | 32 | */ |
| 33 | - public function __construct(UsernameInterface $username = null, IconInterface $icon = null) |
|
| 33 | + public function __construct (UsernameInterface $username = null, IconInterface $icon = null) |
|
| 34 | 34 | { |
| 35 | 35 | $this->username = $username; |
| 36 | 36 | $this->icon = $icon; |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | /** |
| 40 | 40 | * {@inheritdoc} |
| 41 | 41 | */ |
| 42 | - public function getUsername() |
|
| 42 | + public function getUsername () |
|
| 43 | 43 | { |
| 44 | 44 | return $this->username; |
| 45 | 45 | } |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | /** |
| 48 | 48 | * {@inheritdoc} |
| 49 | 49 | */ |
| 50 | - public function hasUsername() |
|
| 50 | + public function hasUsername () |
|
| 51 | 51 | { |
| 52 | 52 | return $this->username !== null; |
| 53 | 53 | } |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | /** |
| 56 | 56 | * {@inheritdoc} |
| 57 | 57 | */ |
| 58 | - public function getIcon() |
|
| 58 | + public function getIcon () |
|
| 59 | 59 | { |
| 60 | 60 | return $this->icon; |
| 61 | 61 | } |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | /** |
| 64 | 64 | * {@inheritdoc} |
| 65 | 65 | */ |
| 66 | - public function hasIcon() |
|
| 66 | + public function hasIcon () |
|
| 67 | 67 | { |
| 68 | 68 | return $this->icon !== null; |
| 69 | 69 | } |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | * |
| 23 | 23 | * @param string $username |
| 24 | 24 | */ |
| 25 | - public function __construct($username) |
|
| 25 | + public function __construct ($username) |
|
| 26 | 26 | { |
| 27 | 27 | $this->setUsername($username); |
| 28 | 28 | } |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | /** |
| 31 | 31 | * {@inheritdoc} |
| 32 | 32 | */ |
| 33 | - public function getUsername() |
|
| 33 | + public function getUsername () |
|
| 34 | 34 | { |
| 35 | 35 | return $this->username; |
| 36 | 36 | } |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | * |
| 41 | 41 | * @return self |
| 42 | 42 | */ |
| 43 | - private function setUsername($username) |
|
| 43 | + private function setUsername ($username) |
|
| 44 | 44 | { |
| 45 | 45 | $this->username = trim($username); |
| 46 | 46 | |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | /** |
| 51 | 51 | * {@inheritdoc} |
| 52 | 52 | */ |
| 53 | - public function __toString() |
|
| 53 | + public function __toString () |
|
| 54 | 54 | { |
| 55 | 55 | return $this->getUsername(); |
| 56 | 56 | } |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | * @param Url $url The webhook url provided by slack. |
| 33 | 33 | * @param ChannelInterface|null $customChannel if no channel is provided the default will be used from the config in slack. |
| 34 | 34 | */ |
| 35 | - public function __construct(Url $url, ChannelInterface $customChannel = null) |
|
| 35 | + public function __construct (Url $url, ChannelInterface $customChannel = null) |
|
| 36 | 36 | { |
| 37 | 37 | $this->setUrl($url); |
| 38 | 38 | $this->customChannel = $customChannel; |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | /** |
| 42 | 42 | * {@inheritdoc} |
| 43 | 43 | */ |
| 44 | - public function getUrl() |
|
| 44 | + public function getUrl () |
|
| 45 | 45 | { |
| 46 | 46 | return $this->url; |
| 47 | 47 | } |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | * |
| 56 | 56 | * @return self |
| 57 | 57 | */ |
| 58 | - private function setUrl(Url $url) |
|
| 58 | + private function setUrl (Url $url) |
|
| 59 | 59 | { |
| 60 | 60 | $urlValidationRegex = '_https:\/\/hooks.slack.com\/services\/[\w\/]+$_iuS'; |
| 61 | 61 | if (!preg_match($urlValidationRegex, (string) $url)) { |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | /** |
| 77 | 77 | * {@inheritdoc} |
| 78 | 78 | */ |
| 79 | - public function __toString() |
|
| 79 | + public function __toString () |
|
| 80 | 80 | { |
| 81 | 81 | return (string) $this->getUrl(); |
| 82 | 82 | } |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | /** |
| 85 | 85 | * {@inheritdoc} |
| 86 | 86 | */ |
| 87 | - public function getCustomChannel() |
|
| 87 | + public function getCustomChannel () |
|
| 88 | 88 | { |
| 89 | 89 | return $this->customChannel; |
| 90 | 90 | } |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | /** |
| 93 | 93 | * {@inheritdoc} |
| 94 | 94 | */ |
| 95 | - public function hasCustomChannel() |
|
| 95 | + public function hasCustomChannel () |
|
| 96 | 96 | { |
| 97 | 97 | return $this->customChannel !== null; |
| 98 | 98 | } |