1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-10-19 23:56:17 +02:00

Add fluent setters for parameters in the slack handler

This commit is contained in:
Andrew Smith
2016-05-31 20:48:51 +10:00
parent e5900c3814
commit c9d15bb808
2 changed files with 210 additions and 17 deletions

View File

@@ -216,4 +216,92 @@ class SlackHandler extends SocketHandler
return $formatter;
}
/**
* Channel used by the bot when posting
*
* @param string $channel
*
* @return SlackHandler
*/
public function setChannel(string $channel): self
{
$this->slackRecord->setChannel($channel);
return $this;
}
/**
* Username used by the bot when posting
*
* @param string $username
*
* @return SlackHandler
*/
public function setUsername(string $username): self
{
$this->slackRecord->setUsername($username);
return $this;
}
/**
* @param bool $useAttachment
*
* @return SlackHandler
*/
public function useAttachment(bool $useAttachment): self
{
$this->slackRecord->useAttachment($useAttachment);
return $this;
}
/**
* @param string $iconEmoji
*
* @return SlackHandler
*/
public function setIconEmoji(string $iconEmoji): self
{
$this->slackRecord->setUserIcon($iconEmoji);
return $this;
}
/**
* @param bool $useShortAttachment
*
* @return SlackHandler
*/
public function useShortAttachment(bool $useShortAttachment): self
{
$this->slackRecord->useShortAttachment($useShortAttachment);
return $this;
}
/**
* @param bool $includeContextAndExtra
*
* @return SlackHandler
*/
public function includeContextAndExtra(bool $includeContextAndExtra): self
{
$this->slackRecord->includeContextAndExtra($includeContextAndExtra);
return $this;
}
/**
* @param array $excludeFields
*
* @return SlackHandler
*/
public function excludeFields(array $excludeFields): self
{
$this->slackRecord->excludeFields($excludeFields);
return $this;
}
}