Skip to content
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

Merged
merged 2 commits into from
Nov 30, 2017

Conversation

fabeat
Copy link
Contributor

@fabeat fabeat commented Nov 29, 2017

Hi,

I've added some convenience methods for the creation of display directives. Tests included.

Cheers,
Fabian

@maxbeckers
Copy link
Owner

Hi,
I'll have a look.

Cheers,
Max

Copy link
Owner

@maxbeckers maxbeckers left a 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
Copy link
Owner

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;
Copy link
Owner

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))
Copy link
Owner

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;
Copy link
Owner

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;
Copy link
Owner

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();
Copy link
Owner

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;
Copy link
Owner

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;
Copy link
Owner

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;
/**
Copy link
Owner

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

@maxbeckers maxbeckers self-assigned this Nov 30, 2017
@fabeat
Copy link
Contributor Author

fabeat commented Nov 30, 2017

Hi Max,
it's done :)
Cheers,
Fabian

@maxbeckers maxbeckers merged commit 036c947 into maxbeckers:master Nov 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants