class EntityShareClientCliService in Entity Share 8.3
Same name and namespace in other branches
- 8 modules/entity_share_client/src/Service/EntityShareClientCliService.php \Drupal\entity_share_client\Service\EntityShareClientCliService
- 8.2 modules/entity_share_client/src/Service/EntityShareClientCliService.php \Drupal\entity_share_client\Service\EntityShareClientCliService
Service to ease the usage of CLI tools.
@package Drupal\entity_share_client
@internal This service is not an api and may change at any time.
Hierarchy
- class \Drupal\entity_share_client\Service\EntityShareClientCliService
Expanded class hierarchy of EntityShareClientCliService
1 file declares its use of EntityShareClientCliService
- EntityShareClientCommands.php in modules/
entity_share_client/ src/ Commands/ EntityShareClientCommands.php
1 string reference to 'EntityShareClientCliService'
- entity_share_client.services.yml in modules/
entity_share_client/ entity_share_client.services.yml - modules/entity_share_client/entity_share_client.services.yml
1 service uses EntityShareClientCliService
- entity_share_client.cli in modules/
entity_share_client/ entity_share_client.services.yml - Drupal\entity_share_client\Service\EntityShareClientCliService
File
- modules/
entity_share_client/ src/ Service/ EntityShareClientCliService.php, line 18
Namespace
Drupal\entity_share_client\ServiceView source
class EntityShareClientCliService {
/**
* Drupal\Core\StringTranslation\TranslationManager definition.
*
* @var \Drupal\Core\StringTranslation\TranslationManager
*/
protected $stringTranslation;
/**
* The import service.
*
* @var \Drupal\entity_share_client\Service\ImportServiceInterface
*/
protected $importService;
/**
* Constructor.
*
* @param \Drupal\Core\StringTranslation\TranslationInterface $string_translation
* The string translation service.
* @param \Drupal\entity_share_client\Service\ImportServiceInterface $import_service
* The import service.
*/
public function __construct(TranslationInterface $string_translation, ImportServiceInterface $import_service) {
$this->stringTranslation = $string_translation;
$this->importService = $import_service;
}
/**
* Handle the pull interaction.
*
* @param string $remote_id
* The remote website id to import from.
* @param string $channel_id
* The remote channel id to import.
* @param string $import_config_id
* The import config id to import with.
* @param \Symfony\Component\Console\Style\StyleInterface|\ConfigSplitDrush8Io $input_output
* The $io interface of the cli tool calling.
* @param callable $translate
* The translation function akin to t().
*/
public function ioPull($remote_id, $channel_id, $import_config_id, $input_output, callable $translate) {
Timer::start('io-pull');
$import_context = new ImportContext($remote_id, $channel_id, $import_config_id);
$this->importService
->importChannel($import_context);
$batch =& batch_get();
if ($batch) {
drush_backend_batch_process();
Timer::stop('io-pull');
$input_output
->success($translate('Channel successfully pulled. Execution time @time ms.', [
'@time' => Timer::read('io-pull'),
]));
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
EntityShareClientCliService:: |
protected | property | The import service. | |
EntityShareClientCliService:: |
protected | property | Drupal\Core\StringTranslation\TranslationManager definition. | |
EntityShareClientCliService:: |
public | function | Handle the pull interaction. | |
EntityShareClientCliService:: |
public | function | Constructor. |