-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added convenience methods for display directives #6
Conversation
Hi, Cheers, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some minor fixes, looking good :)
|
||
/** | ||
* @param string|null $contentDescription | ||
* @param null|ImageSource|ImageSource[] $imageSource |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be @param ImageSource[] $imageSource
because a param should be array oder Object[|null] but not both.
{ | ||
$image = new self(); | ||
|
||
$image->contentDescription = $contentDescription; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CodeStyle $image->contentDescription = $contentDescription;
|
||
$image->contentDescription = $contentDescription; | ||
|
||
if (!is_null($imageSource)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic will change to $image->sources[] = $sources;
and CodeStyle is
if (is_array($imageSource)) {
$image->sources = $imageSource;
}
$imageSource->url = $url; | ||
$imageSource->size = $size; | ||
$imageSource->widthPixels = $widthPixels; | ||
$imageSource->heightPixels = $heightPixels; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aline with only one blank in this line
|
||
$listItem->token = $token; | ||
$listItem->image = $image; | ||
$listItem->textContent = $textContent; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
*/ | ||
public static function create($text, $type = self::TYPE_PLAIN_TEXT): Text | ||
{ | ||
$text_ = new self(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like the underscore naming, perhaps $text = new self();
here and public static function create($value = null, $type = self::TYPE_PLAIN_TEXT): Text
$text_ = new self(); | ||
|
||
$text_->text = $text; | ||
$text_->type = $type; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here also aline equal signs with only one blank (in the longest line).
$textContent = new self(); | ||
|
||
$textContent->primaryText = $primaryText; | ||
$textContent->secondaryText = $secondaryText; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
use \MaxBeckers\AmazonAlexa\Response\Directives\Display\Image; | ||
use \MaxBeckers\AmazonAlexa\Response\Directives\Display\Template; | ||
use \MaxBeckers\AmazonAlexa\Response\Directives\Display\ListItem; | ||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one empty line after use statements
Hi Max, |
Hi,
I've added some convenience methods for the creation of display directives. Tests included.
Cheers,
Fabian