protected function SjApiClient::inputValidation in Acquia Cloud Site Factory Connector 8
Same name and namespace in other branches
- 8.2 acsf_sj/src/Api/SjApiClient.php \Drupal\acsf_sj\Api\SjApiClient::inputValidation()
Validates/completes the sjadd input.
Parameters
string $drush_command: A drush command to run.
int $timestamp: Unix timestamp when the command should be run or NULL to run ASAP.
string $domain: The domain to use when calling the drush command or NULL for the class to determine.
int $timeout: How long in seconds the process should be allowed to run or NULL for system default.
string $drush_executable: The drush binary to use, 'drush' by default. i.e. drush9.
string $drush_options: A list of drush options that will be applied to the drush command. If none are provided, "-y" will be used.
Throws
\InvalidArgumentException If the input arguments are not all valid.
2 calls to SjApiClient::inputValidation()
- SjApiClient::addJob in acsf_sj/
src/ Api/ SjApiClient.php - Adds a scheduled job.
- SjLocalDevClient::addJob in acsf_sj/
src/ Api/ SjLocalDevClient.php - Adds a scheduled job.
File
- acsf_sj/
src/ Api/ SjApiClient.php, line 88
Class
- SjApiClient
- Provides a Scheduled Jobs API client.
Namespace
Drupal\acsf_sj\ApiCode
protected function inputValidation($drush_command, &$timestamp, &$domain, $timeout = NULL, &$drush_executable = NULL, &$drush_options = NULL) {
if (is_null($timestamp)) {
$timestamp = time();
}
$domain = !empty($domain) ? $domain : $this->domain;
$drush_executable = !empty($drush_executable) ? $drush_executable : 'drush';
if (is_null($drush_options)) {
$drush_options = '-y';
}
if (empty($drush_command) || !is_string($drush_command)) {
throw new \InvalidArgumentException('The command argument must be a non-empty string.');
}
if (!is_numeric($timestamp) || intval($timestamp) < 0) {
throw new \InvalidArgumentException('The timestamp argument must be a positive integer.');
}
if (!is_null($domain) && (empty($domain) || !is_string($domain))) {
throw new \InvalidArgumentException('The domain argument must be a non-empty string.');
}
if (!is_null($timeout) && (!is_numeric($timeout) || intval($timeout) < 0)) {
throw new \InvalidArgumentException('The timeout argument must be a positive integer.');
}
if (!is_null($drush_executable) && (empty($drush_executable) || !is_string($drush_executable))) {
throw new \InvalidArgumentException('The drush_executable argument must be a non-empty string.');
}
if (empty($drush_options) || !is_string($drush_options)) {
throw new \InvalidArgumentException('The drush_options argument must be a non-empty string.');
}
}