-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Ralf Eggert
committed
Jul 24, 2020
1 parent
6bc9fb1
commit aa51d87
Showing
2 changed files
with
42 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,40 @@ | ||
<?php | ||
/** | ||
* Build voice applications for Amazon Alexa with phlexa and PHP | ||
* | ||
* @author Meike Ziesecke <[email protected]> | ||
* @license http://opensource.org/licenses/MIT The MIT License (MIT) | ||
* @link https://github.com/phoice/phlexa | ||
* @link https://www.phoice.tech/ | ||
* @link https://www.travello.audio/ | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Phlexa\Response\Directives\Alexa\Presentation\APLA\Document; | ||
|
||
use Phlexa\Response\Directives\DirectivesInterface; | ||
|
||
/** | ||
* Class APLA | ||
* | ||
* @package Phlexa\Response\Directives\Alexa\Presentation\APLA\Document | ||
*/ | ||
class APLA implements DirectivesInterface | ||
{ | ||
/** Type of directive */ | ||
public const DIRECTIVE_TYPE = 'APLA'; | ||
|
||
/** @var string */ | ||
private $version = '0.8'; | ||
|
||
/** | ||
* @var array | ||
*/ | ||
private $mainTemplate = []; | ||
|
||
|
||
/** @var array */ | ||
private $mainTemplate = []; | ||
|
||
/** | ||
* APLA constructor. | ||
* | ||
* @param array $mainTemplate | ||
* @param array $mainTemplate | ||
*/ | ||
public function __construct( | ||
array $mainTemplate | ||
|
@@ -38,16 +50,16 @@ public function __construct( | |
public static function createFromString(string $aplaJson): APLA | ||
{ | ||
$aplaData = json_decode($aplaJson, true); | ||
|
||
$mainTemplate = $aplaData['mainTemplate'] ?? []; | ||
|
||
return new APLA($mainTemplate); | ||
} | ||
|
||
/** | ||
* @param string $aplFile | ||
* @param string $aplaFile | ||
* | ||
* @return APL | ||
* @return APLA | ||
*/ | ||
public static function createFromFile(string $aplaFile): APLA | ||
{ | ||
|
@@ -77,5 +89,4 @@ public function toArray(): array | |
|
||
return $data; | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,26 @@ | ||
<?php | ||
/** | ||
* Build voice applications for Amazon Alexa with phlexa and PHP | ||
* | ||
* @author Meike Ziesecke <[email protected]> | ||
* @license http://opensource.org/licenses/MIT The MIT License (MIT) | ||
* @link https://github.com/phoice/phlexa | ||
* @link https://www.phoice.tech/ | ||
* @link https://www.travello.audio/ | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Phlexa\Response\Directives\Alexa\Presentation\APLA; | ||
|
||
use Phlexa\Response\Directives\Alexa\Presentation\APLA\Document\APLA; | ||
use Phlexa\Response\Directives\DirectivesInterface; | ||
|
||
/** | ||
* Class RenderDocument | ||
* | ||
* @package Phlexa\Response\Directives\Alexa\Presentation\APLA | ||
*/ | ||
class RenderDocument implements DirectivesInterface | ||
{ | ||
/** Type of directive */ | ||
|
@@ -21,7 +38,7 @@ class RenderDocument implements DirectivesInterface | |
/** | ||
* RenderDocument constructor. | ||
* | ||
* @param APLA $document | ||
* @param APLA $document | ||
* @param string $token | ||
* @param array $datasources | ||
*/ | ||
|
@@ -54,5 +71,4 @@ public function toArray(): array | |
|
||
return $data; | ||
} | ||
|
||
} | ||
} |