本文整理汇总了PHP中Command::addParameter方法的典型用法代码示例。如果您正苦于以下问题:PHP Command::addParameter方法的具体用法?PHP Command::addParameter怎么用?PHP Command::addParameter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Command
的用法示例。
在下文中一共展示了Command::addParameter方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCommand
/**
* Gets command generated for this current
* rsync configuration. You can use it to test
* or execute it later without using the sync method
*
* @param $origin
* @param $target
*
* @return Command
*/
public function getCommand($origin, $target)
{
$command = new Command($this->executable);
if ($this->skipNewerFiles) {
$command->addOption("u");
}
if ($this->followSymLinks) {
$command->addOption("L");
}
if ($this->dryRun) {
$command->addOption("n");
}
if ($this->verbose) {
$command->addOption("v");
}
if ($this->times) {
$command->addArgument('times');
}
if ($this->deleteFromTarget) {
$command->addArgument('delete');
}
if ($this->deleteExcluded) {
$command->addArgument('delete-excluded');
}
if (!empty($this->exclude)) {
foreach ($this->exclude as $excluded) {
$command->addArgument('exclude', $excluded);
}
}
if ($this->archive) {
$command->addOption("a");
}
if (!$this->archive && $this->recursive) {
$command->addOption("r");
}
if (!is_null($this->ssh)) {
$ssh = $this->ssh->getConnectionOptions();
$command->addArgument("rsh", $ssh);
}
$command->addParameter($origin);
if (is_null($this->ssh)) {
$command->addParameter($target);
} else {
$command->addParameter($this->ssh->getHostConnection() . ":" . $target);
}
return $command;
}
示例2: getCommand
/**
* Gets command generated for this current
* rsync configuration. You can use it to test
* or execute it later without using the sync method
*
* @param $origin
* @param $target
*
* @return Command
*/
public function getCommand($origin, $target)
{
$command = new Command($this->executable);
if ($this->skipNewerFiles) {
$command->addOption("u");
}
if ($this->followSymLinks) {
$command->addOption("L");
}
if ($this->dryRun) {
$command->addOption("n");
}
if ($this->verbose) {
$command->addOption("v");
}
if ($this->compression) {
$command->addOption("z");
}
// add any optional options we've specified
$extra_options = $this->getOptionalParameters();
if (!empty($extra_options)) {
// if the extra options were given as a flat string, then convert it to an array
if (is_string($extra_options)) {
$extra_options = str_split($extra_options);
}
// add each extra option we've defined.
if (is_array($extra_options)) {
foreach ($extra_options as $option) {
$command->addOption($option);
}
}
}
if ($this->times) {
$command->addArgument('times');
}
if ($this->deleteFromTarget) {
$command->addArgument('delete');
}
if ($this->removeSource) {
$command->addArgument('remove-source-files');
}
if ($this->deleteExcluded) {
$command->addArgument('delete-excluded');
}
if ($this->info) {
$command->addArgument('info', $this->info);
}
if ($this->compareDest) {
$command->addArgument('compare-dest', $this->compareDest);
}
if (!empty($this->exclude)) {
foreach ($this->exclude as $excluded) {
$command->addArgument('exclude', $excluded);
}
}
if (!empty($this->excludeFrom)) {
$command->addArgument('exclude-from', $this->excludeFrom);
}
if ($this->archive) {
$command->addOption("a");
}
if (!$this->archive && $this->recursive) {
$command->addOption("r");
}
if (!is_null($this->ssh)) {
$ssh = $this->ssh->getConnectionOptions();
$command->addArgument("rsh", $ssh);
}
if (is_null($this->ssh)) {
$command->addParameter($origin);
$command->addParameter($target);
} elseif ($this->remoteOrigin) {
$command->addParameter($this->ssh->getHostConnection() . ":" . $origin);
$command->addParameter($target);
} else {
$command->addParameter($origin);
$command->addParameter($this->ssh->getHostConnection() . ":" . $target);
}
return $command;
}
示例3: getCommand
/**
* Gets commands for this SSH connection
*
* @param bool $hostConnection
*
* @return string
*
* @throws \InvalidArgumentException If you don't specify a SSH username or host
*/
public function getCommand($hostConnection = true)
{
if (is_null($this->username)) {
throw new \InvalidArgumentException("You must specify a SSH username");
}
if (is_null($this->host)) {
throw new \InvalidArgumentException("You must specify a SSH host to connect");
}
$command = new Command($this->executable);
if ($this->port != 22) {
$command->addArgument("p", $this->port);
}
if (!is_null($this->publicKey)) {
$command->addArgument("i", $this->publicKey);
}
if ($hostConnection) {
$command->addParameter($this->getHostConnection());
}
return $command;
}