Fix logic
This commit is contained in:
parent
213c6ab6d5
commit
7bac792328
@ -39,16 +39,15 @@ final class SlackSectionBlock extends AbstractSlackBlock
|
||||
*/
|
||||
public function field(string $text, bool $markdown = true): self
|
||||
{
|
||||
if (10 === \count($this->options['fields'])) {
|
||||
throw new \LogicException('Maximum number of fields should not exceed 10.');
|
||||
}
|
||||
|
||||
$this->options['fields'][] = [
|
||||
'type' => $markdown ? 'mrkdwn' : 'plain_text',
|
||||
'text' => $text,
|
||||
];
|
||||
|
||||
// Maximum number of items is 10
|
||||
if (10 <= \count($this->options['fields'])) {
|
||||
throw new \LogicException('Maximum number of fields should not exceed 10.');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user