PHP Class Maknz\Slack\Attachment

Datei anzeigen Open project: maknz/slack Class Usage Examples

Protected Properties

Property Type Description
$actions array A maximum of 5 actions may be provided.
$author_icon string Optional author icon for the attachment.
$author_link string Optional author link for the attachment.
$author_name string Optional author name for the attachment.
$color string The color to use for the attachment.
$fallback string The fallback text to use for clients that don't support attachments.
$fields array The fields of the attachment.
$footer string The text to use for the attachment footer.
$footer_icon string The icon to use for the attachment footer.
$image_url string Optional image that should appear within the attachment.
$markdown_fields array The fields of the attachment that Slack should interpret with its Markdown-like language.
$pretext string Optional text that should appear above the formatted data.
$text string Optional text that should appear within the attachment.
$thumb_url string Optional thumbnail that should appear within the attachment.
$timestamp DateTime The timestamp to use for the attachment.
$title string Optional title for the attachment.
$title_link string Optional title link for the attachment.

Public Methods

Method Description
__construct ( array $attributes ) : void Instantiate a new Attachment.
addAction ( mixed $action ) Add an action to the attachment.
addField ( mixed $field ) Add a field to the attachment.
clearActions ( ) Clear the actions for the attachment.
clearFields ( ) Clear the fields for the attachment.
getActions ( ) : AttachmentAction[] Get the collection of actions (buttons) to include in the attachment.
getAuthorIcon ( ) : string Get the author icon to use for the attachment.
getAuthorLink ( ) : string Get the author link to use for the attachment.
getAuthorName ( ) : string Get the author name to use for the attachment.
getColor ( ) : string Get the color to use for the attachment.
getFallback ( ) : string Get the fallback text.
getFields ( ) : array Get the fields for the attachment.
getFooter ( ) : string Get the footer to use for the attachment.
getFooterIcon ( ) : string Get the footer icon to use for the attachment.
getImageUrl ( ) : string Get the optional image to appear within the attachment.
getMarkdownFields ( ) : array Get the fields Slack should interpret in its Markdown-like language.
getPretext ( ) : string Get the text that should appear above the formatted data.
getText ( ) : string Get the optional text to appear within the attachment.
getThumbUrl ( ) : string Get the optional thumbnail to appear within the attachment.
getTimestamp ( ) : DateTime Get the timestamp to use for the attachment.
getTitle ( ) : string Get the title to use for the attachment.
getTitleLink ( ) : string Get the title link to use for the attachment.
setActions ( array $actions ) : Attachment Set the collection of actions (buttons) to include in the attachment.
setAuthorIcon ( string $author_icon ) Set the author icon to use for the attachment.
setAuthorLink ( string $author_link ) Set the auhtor link to use for the attachment.
setAuthorName ( string $author_name ) Set the author name to use for the attachment.
setColor ( string $color ) Set the color to use for the attachment.
setFallback ( string $fallback ) Set the fallback text.
setFields ( array $fields ) Set the fields for the attachment.
setFooter ( string $footer ) Set the footer text to use for the attachment.
setFooterIcon ( string $footerIcon ) Set the footer icon to use for the attachment.
setImageUrl ( string $image_url ) Set the optional image to appear within the attachment.
setMarkdownFields ( array $fields ) Set the fields Slack should interpret in its Markdown-like language.
setPretext ( string $pretext ) Set the text that should appear above the formatted data.
setText ( string $text ) Set the optional text to appear within the attachment.
setThumbUrl ( string $thumb_url ) Set the optional thumbnail to appear within the attachment.
setTimestamp ( DateTime $timestamp ) Set the timestamp to use for the attachment.
setTitle ( string $title ) Set the title to use for the attachment.
setTitleLink ( string $title_link ) Set the title link to use for the attachment.
toArray ( ) : array Convert this attachment to its array representation.

Protected Methods

Method Description
getActionsAsArrays ( ) : array Iterates over all actions in this attachment and returns them in their array form.
getFieldsAsArrays ( ) : array Iterates over all fields in this attachment and returns them in their array form.

Method Details

__construct() public method

Instantiate a new Attachment.
public __construct ( array $attributes ) : void
$attributes array
return void

addAction() public method

Add an action to the attachment.
public addAction ( mixed $action )
$action mixed

addField() public method

Add a field to the attachment.
public addField ( mixed $field )
$field mixed

clearActions() public method

Clear the actions for the attachment.
public clearActions ( )

clearFields() public method

Clear the fields for the attachment.
public clearFields ( )

getActions() public method

Get the collection of actions (buttons) to include in the attachment.
public getActions ( ) : AttachmentAction[]
return AttachmentAction[]

getActionsAsArrays() protected method

Iterates over all actions in this attachment and returns them in their array form.
protected getActionsAsArrays ( ) : array
return array

getAuthorIcon() public method

Get the author icon to use for the attachment.
public getAuthorIcon ( ) : string
return string

getAuthorName() public method

Get the author name to use for the attachment.
public getAuthorName ( ) : string
return string

getColor() public method

Get the color to use for the attachment.
public getColor ( ) : string
return string

getFallback() public method

Get the fallback text.
public getFallback ( ) : string
return string

getFields() public method

Get the fields for the attachment.
public getFields ( ) : array
return array

getFieldsAsArrays() protected method

Iterates over all fields in this attachment and returns them in their array form.
protected getFieldsAsArrays ( ) : array
return array

getFooter() public method

Get the footer to use for the attachment.
public getFooter ( ) : string
return string

getFooterIcon() public method

Get the footer icon to use for the attachment.
public getFooterIcon ( ) : string
return string

getImageUrl() public method

Get the optional image to appear within the attachment.
public getImageUrl ( ) : string
return string

getMarkdownFields() public method

Get the fields Slack should interpret in its Markdown-like language.
public getMarkdownFields ( ) : array
return array

getPretext() public method

Get the text that should appear above the formatted data.
public getPretext ( ) : string
return string

getText() public method

Get the optional text to appear within the attachment.
public getText ( ) : string
return string

getThumbUrl() public method

Get the optional thumbnail to appear within the attachment.
public getThumbUrl ( ) : string
return string

getTimestamp() public method

Get the timestamp to use for the attachment.
public getTimestamp ( ) : DateTime
return DateTime

getTitle() public method

Get the title to use for the attachment.
public getTitle ( ) : string
return string

setActions() public method

Set the collection of actions (buttons) to include in the attachment.
public setActions ( array $actions ) : Attachment
$actions array
return Attachment

setAuthorIcon() public method

Set the author icon to use for the attachment.
public setAuthorIcon ( string $author_icon )
$author_icon string

setAuthorName() public method

Set the author name to use for the attachment.
public setAuthorName ( string $author_name )
$author_name string

setColor() public method

Set the color to use for the attachment.
public setColor ( string $color )
$color string

setFallback() public method

Set the fallback text.
public setFallback ( string $fallback )
$fallback string

setFields() public method

Set the fields for the attachment.
public setFields ( array $fields )
$fields array

setFooter() public method

Set the footer text to use for the attachment.
public setFooter ( string $footer )
$footer string

setFooterIcon() public method

Set the footer icon to use for the attachment.
public setFooterIcon ( string $footerIcon )
$footerIcon string

setImageUrl() public method

Set the optional image to appear within the attachment.
public setImageUrl ( string $image_url )
$image_url string

setMarkdownFields() public method

Set the fields Slack should interpret in its Markdown-like language.
public setMarkdownFields ( array $fields )
$fields array

setPretext() public method

Set the text that should appear above the formatted data.
public setPretext ( string $pretext )
$pretext string

setText() public method

Set the optional text to appear within the attachment.
public setText ( string $text )
$text string

setThumbUrl() public method

Set the optional thumbnail to appear within the attachment.
public setThumbUrl ( string $thumb_url )
$thumb_url string

setTimestamp() public method

Set the timestamp to use for the attachment.
public setTimestamp ( DateTime $timestamp )
$timestamp DateTime

setTitle() public method

Set the title to use for the attachment.
public setTitle ( string $title )
$title string

toArray() public method

Convert this attachment to its array representation.
public toArray ( ) : array
return array

Property Details

$actions protected_oe property

A maximum of 5 actions may be provided.
protected array $actions
return array

$author_icon protected_oe property

Optional author icon for the attachment.
protected string $author_icon
return string

$author_name protected_oe property

Optional author name for the attachment.
protected string $author_name
return string

$color protected_oe property

The color to use for the attachment.
protected string $color
return string

$fallback protected_oe property

The fallback text to use for clients that don't support attachments.
protected string $fallback
return string

$fields protected_oe property

The fields of the attachment.
protected array $fields
return array

$image_url protected_oe property

Optional image that should appear within the attachment.
protected string $image_url
return string

$markdown_fields protected_oe property

The fields of the attachment that Slack should interpret with its Markdown-like language.
protected array $markdown_fields
return array

$pretext protected_oe property

Optional text that should appear above the formatted data.
protected string $pretext
return string

$text protected_oe property

Optional text that should appear within the attachment.
protected string $text
return string

$thumb_url protected_oe property

Optional thumbnail that should appear within the attachment.
protected string $thumb_url
return string

$timestamp protected_oe property

The timestamp to use for the attachment.
protected DateTime $timestamp
return DateTime

$title protected_oe property

Optional title for the attachment.
protected string $title
return string