Skip to content

Commit

Permalink
mv to PHP 7.4
Browse files Browse the repository at this point in the history
  • Loading branch information
jeyroik committed Mar 17, 2020
1 parent c9a28e9 commit c2f23b2
Show file tree
Hide file tree
Showing 45 changed files with 199 additions and 195 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# alice-extas

# Внимание! Данный пакет `deprecated`, пожалуйста, используйте [jeyroik/extas-alice](https://github.com/jeyroik/extas-alice)

Библиотека для создания навыков для голосового помощника Алисы от компании Яндекс.

Данная библиотека поддерживает сценарии (см. руководство ниже).
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"name": "jeyroik/alice-extas",
"description": "Yandex.Alice Extas package",
"require": {
"jeyroik/extas-foundation": "*",
"jeyroik/extas-installer": "*",
"jeyroik/extas-base": "*",
"jeyroik/extas-foundation": "2.*",
"jeyroik/extas-installer": "2.*",
"jeyroik/extas-base": "1.*",
"vlucas/phpdotenv": "*"
},
"autoload": {
Expand Down
10 changes: 5 additions & 5 deletions src/components/plugins/alice/PluginInstallButtons.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
*/
class PluginInstallButtons extends PluginInstallDefault
{
protected $selfItemClass = Button::class;
protected $selfName = 'button';
protected $selfSection = 'buttons';
protected $selfUID = Button::FIELD__TITLE;
protected $selfRepositoryClass = IButtonRepository::class;
protected string $selfItemClass = Button::class;
protected string $selfName = 'button';
protected string $selfSection = 'buttons';
protected string $selfUID = Button::FIELD__TITLE;
protected string $selfRepositoryClass = IButtonRepository::class;
}
10 changes: 5 additions & 5 deletions src/components/plugins/alice/PluginInstallCards.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
*/
class PluginInstallCards extends PluginInstallDefault
{
protected $selfRepositoryClass = ICardRepository::class;
protected $selfItemClass = Card::class;
protected $selfUID = Card::FIELD__NAME;
protected $selfSection = 'cards';
protected $selfName = 'card';
protected string $selfRepositoryClass = ICardRepository::class;
protected string $selfItemClass = Card::class;
protected string $selfUID = Card::FIELD__NAME;
protected string $selfSection = 'cards';
protected string $selfName = 'card';
}
10 changes: 5 additions & 5 deletions src/components/plugins/alice/PluginInstallScenarios.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
*/
class PluginInstallScenarios extends PluginInstallDefault
{
protected $selfRepositoryClass = IScenarioRepository::class;
protected $selfItemClass = Scenario::class;
protected $selfUID = Scenario::FIELD__NAME;
protected $selfSection = 'scenarios';
protected $selfName = 'scenario';
protected string $selfRepositoryClass = IScenarioRepository::class;
protected string $selfItemClass = Scenario::class;
protected string $selfUID = Scenario::FIELD__NAME;
protected string $selfSection = 'scenarios';
protected string $selfName = 'scenario';
}
10 changes: 5 additions & 5 deletions src/components/plugins/alice/PluginInstallSkills.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
*/
class PluginInstallSkills extends PluginInstallDefault
{
protected $selfName = 'skill';
protected $selfSection = 'skills';
protected $selfUID = AliceSkill::FIELD__ID;
protected $selfItemClass = AliceSkill::class;
protected $selfRepositoryClass = IAliceSkillRepository::class;
protected string $selfName = 'skill';
protected string $selfSection = 'skills';
protected string $selfUID = AliceSkill::FIELD__ID;
protected string $selfItemClass = AliceSkill::class;
protected string $selfRepositoryClass = IAliceSkillRepository::class;
}
10 changes: 5 additions & 5 deletions src/components/plugins/alice/PluginInstallSteps.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
*/
class PluginInstallSteps extends PluginInstallDefault
{
protected $selfRepositoryClass = IStepRepository::class;
protected $selfItemClass = Step::class;
protected $selfUID = Step::FIELD__TITLE;
protected $selfSection = 'steps';
protected $selfName = 'step';
protected string $selfRepositoryClass = IStepRepository::class;
protected string $selfItemClass = Step::class;
protected string $selfUID = Step::FIELD__TITLE;
protected string $selfSection = 'steps';
protected string $selfName = 'step';
}
1 change: 1 addition & 0 deletions src/components/yandex/THasVersion.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php
namespace extas\components\yandex;

use extas\interfaces\yandex\IHasVersion;

/**
Expand Down
14 changes: 7 additions & 7 deletions src/components/yandex/responses/AliceResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public function isEndOfTalking(): bool
*
* @return $this
*/
public function setSession(ISession $session)
public function setSession(ISession $session): IAliceResponse
{
$this->config[static::FIELD__SESSION] = $session->__toArray();

Expand All @@ -123,7 +123,7 @@ public function setSession(ISession $session)
*
* @return $this
*/
public function setButtons(array $buttons)
public function setButtons(array $buttons): IAliceResponse
{
$buttonsData = [];

Expand All @@ -143,7 +143,7 @@ public function setButtons(array $buttons)
*
* @return $this
*/
public function addButton(IButton $button)
public function addButton(IButton $button): IAliceResponse
{
$this->config[static::FIELD__BUTTONS] = $this->config[static::FIELD__BUTTONS] ?? [];
$this->config[static::FIELD__BUTTONS][] = $button->__toArray();
Expand All @@ -156,7 +156,7 @@ public function addButton(IButton $button)
*
* @return $this
*/
public function setCard(ICard $card)
public function setCard(ICard $card): IAliceResponse
{
$this->config[static::FIELD__CARD] = $card->__toArray();

Expand All @@ -168,7 +168,7 @@ public function setCard(ICard $card)
*
* @return $this
*/
public function setText(string $text)
public function setText(string $text): IAliceResponse
{
$this->config[static::FIELD__TEXT] = $text;

Expand All @@ -180,7 +180,7 @@ public function setText(string $text)
*
* @return $this
*/
public function setTts(string $tts)
public function setTts(string $tts): IAliceResponse
{
$this->config[static::FIELD__TTS] = $tts;

Expand All @@ -192,7 +192,7 @@ public function setTts(string $tts)
*
* @return $this
*/
public function setIsEndOfTalking(bool $isEndOfTalking)
public function setIsEndOfTalking(bool $isEndOfTalking): IAliceResponse
{
$this->config[static::FIELD__IS_END_OF_TALKING] = $isEndOfTalking;

Expand Down
10 changes: 5 additions & 5 deletions src/components/yandex/responses/buttons/ButtonRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
*/
class ButtonRepository extends Repository implements IButtonRepository
{
protected $scope = 'alice';
protected $name = 'buttons';
protected $pk = Button::FIELD__NAME;
protected $idAs = '';
protected $itemClass = Button::class;
protected string $scope = 'alice';
protected string $name = 'buttons';
protected string $pk = Button::FIELD__NAME;
protected string $idAs = '';
protected string $itemClass = Button::class;
}
10 changes: 5 additions & 5 deletions src/components/yandex/responses/cards/CardRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
*/
class CardRepository extends Repository
{
protected $itemClass = Card::class;
protected $idAs = '';
protected $pk = Card::FIELD__NAME;
protected $name = 'cards';
protected $scope = 'alice';
protected string $itemClass = Card::class;
protected string $idAs = '';
protected string $pk = Card::FIELD__NAME;
protected string $name = 'cards';
protected string $scope = 'alice';
}
2 changes: 1 addition & 1 deletion src/components/yandex/responses/cards/lists/ListFooter.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class ListFooter extends Item implements IListFooter
*
* @var string
*/
protected $buttonClass = SingleButton::class;
protected string $buttonClass = SingleButton::class;

/**
* @return string
Expand Down
10 changes: 5 additions & 5 deletions src/components/yandex/skills/AliceSkillRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
*/
class AliceSkillRepository extends Repository implements IAliceSkillRepository
{
protected $itemClass = AliceSkill::class;
protected $pk = AliceSkill::FIELD__ID;
protected $name = 'skills';
protected $scope = 'alice';
protected $idAs = '';
protected string $itemClass = AliceSkill::class;
protected string $pk = AliceSkill::FIELD__ID;
protected string $name = 'skills';
protected string $scope = 'alice';
protected string $idAs = '';
}
6 changes: 3 additions & 3 deletions src/components/yandex/skills/scenarios/Scenario.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class Scenario extends Item implements IScenario
* @param IAliceCall $call
* @param IAliceResponse $response
*/
public function play($messageId, IAliceCall $call, IAliceResponse &$response)
public function play($messageId, IAliceCall $call, IAliceResponse &$response): void
{
$schema = $this->getSchema();

Expand Down Expand Up @@ -118,7 +118,7 @@ public function getSkill(): ?IAliceSkill
*
* @return $this
*/
public function setSchema(array $schema)
public function setSchema(array $schema): IScenario
{
$this->config[static::FIELD__SCHEMA] = $schema;

Expand All @@ -130,7 +130,7 @@ public function setSchema(array $schema)
*
* @return $this
*/
public function setSkillName(string $skillName)
public function setSkillName(string $skillName): IScenario
{
$this->config[static::FIELD__SKILL_NAME] = $skillName;

Expand Down
10 changes: 5 additions & 5 deletions src/components/yandex/skills/scenarios/ScenarioRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
*/
class ScenarioRepository extends Repository
{
protected $scope = 'alice';
protected $name = 'scenarios';
protected $pk = Scenario::FIELD__NAME;
protected $idAs = '';
protected $itemClass = Scenario::class;
protected string $scope = 'alice';
protected string $name = 'scenarios';
protected string $pk = Scenario::FIELD__NAME;
protected string $idAs = '';
protected string $itemClass = Scenario::class;
}
10 changes: 5 additions & 5 deletions src/components/yandex/skills/steps/StepRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
*/
class StepRepository extends Repository implements IStepRepository
{
protected $itemClass = Step::class;
protected $idAs = '';
protected $pk = Step::FIELD__NAME;
protected $name = 'steps';
protected $scope = 'alice';
protected string $itemClass = Step::class;
protected string $idAs = '';
protected string $pk = Step::FIELD__NAME;
protected string $name = 'steps';
protected string $scope = 'alice';
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
*/
interface ICardExtensionImageList
{
const FIELD__HEADER = 'header';
const FIELD__ITEMS = 'items';
const FIELD__FOOTER = 'footer';
public const FIELD__HEADER = 'header';
public const FIELD__ITEMS = 'items';
public const FIELD__FOOTER = 'footer';

/**
* @return IListHeader
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php
namespace extas\interfaces\extensions\alice\responses\cards;

use extas\interfaces\IHasDescription;
use extas\interfaces\yandex\responses\buttons\IHasButton;

Expand All @@ -11,7 +12,7 @@
*/
interface ICardExtensionImageSingle extends IHasButton, IHasDescription
{
const FIELD__IMAGE_ID = 'image_id';
public const FIELD__IMAGE_ID = 'image_id';

/**
* @return string
Expand Down
4 changes: 2 additions & 2 deletions src/interfaces/yandex/IAlice.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
*/
interface IAlice extends IItem
{
const SUBJECT = 'yandex.alice';
public const SUBJECT = 'yandex.alice';

const OPTION__THROW_ON_ERROR = 'throw_on_error';
public const OPTION__THROW_ON_ERROR = 'throw_on_error';

/**
* @return mixed
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/yandex/IHasVersion.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/
interface IHasVersion
{
const FIELD__VERSION = 'version';
public const FIELD__VERSION = 'version';

/**
* @return string
Expand Down
8 changes: 4 additions & 4 deletions src/interfaces/yandex/calls/IAliceCall.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
*/
interface IAliceCall extends IItem, IHasVersion
{
const SUBJECT = 'yandex.alice.call';
public const SUBJECT = 'yandex.alice.call';

const FIELD__META = 'meta';
const FIELD__REQUEST = 'request';
const FIELD__SESSION = 'session';
public const FIELD__META = 'meta';
public const FIELD__REQUEST = 'request';
public const FIELD__SESSION = 'session';

/**
* @return IMeta
Expand Down
10 changes: 5 additions & 5 deletions src/interfaces/yandex/calls/metas/IMeta.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
*/
interface IMeta extends IItem
{
const SUBJECT = 'alice.call.meta';
public const SUBJECT = 'alice.call.meta';

const FIELD__LOCALE = 'locale';
const FIELD__TIMEZONE = 'timezone';
const FIELD__CLIENT_ID = 'client_id';
const FIELD__INTERFACES = 'interfaces';
public const FIELD__LOCALE = 'locale';
public const FIELD__TIMEZONE = 'timezone';
public const FIELD__CLIENT_ID = 'client_id';
public const FIELD__INTERFACES = 'interfaces';

/**
* @return string
Expand Down
4 changes: 2 additions & 2 deletions src/interfaces/yandex/calls/metas/IMetaInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/
interface IMetaInterface extends IItem, IHasName
{
const SUBJECT = 'alice.call.meta.interface';
public const SUBJECT = 'alice.call.meta.interface';

const INTERFACE__SCREEN = 'screen';
public const INTERFACE__SCREEN = 'screen';
}
18 changes: 9 additions & 9 deletions src/interfaces/yandex/calls/requests/IRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@
*/
interface IRequest extends IItem
{
const SUBJECT = 'alice.call.request';
public const SUBJECT = 'alice.call.request';

const FIELD__COMMAND = 'command';
const FIELD__ORIGINAL_UTTERANCE = 'original_utterance';
const FIELD__TYPE = 'type';
const FIELD__MARKUP = 'markup';
const FIELD__PAYLOAD = 'payload';
const FIELD__NLU = 'nlu';
public const FIELD__COMMAND = 'command';
public const FIELD__ORIGINAL_UTTERANCE = 'original_utterance';
public const FIELD__TYPE = 'type';
public const FIELD__MARKUP = 'markup';
public const FIELD__PAYLOAD = 'payload';
public const FIELD__NLU = 'nlu';

const TYPE__VOICE = 'SimpleUtterance';
const TYPE__BUTTON = 'ButtonPressed';
public const TYPE__VOICE = 'SimpleUtterance';
public const TYPE__BUTTON = 'ButtonPressed';

/**
* @return string
Expand Down
Loading

0 comments on commit c2f23b2

Please sign in to comment.