本文整理汇总了PHP中Call::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Call::create方法的具体用法?PHP Call::create怎么用?PHP Call::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Call
的用法示例。
在下文中一共展示了Call::create方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: callParty
/**
* Add another to a call bridge
*
* @param caller -> PhoneNumber
* @param callee -> PhoneNumber
* @param args -> Call's arguments (see in function)
*/
public function callParty($caller, $callee, $args)
{
$new_call = Call::create($caller, $callee, $this->id, $args);
$this->calls++;
return Constructor::Make($this, $data->get());
}
示例2: doCreateCall
/**
* The call factory
*
* @param string $cmd The command string to be executed
* @param string $path The working directory
* @return Call
*/
protected function doCreateCall($cmd, $path)
{
return Call::create($cmd, $path);
}
示例3: createGitCall
/**
* Create a call to the Git binary for later execution
*
* @param string $path The full path to the Git repository
* @param string $command The Git command, e.g. show, commit or add
* @param array $arguments The command arguments
* @return Call
*/
public function createGitCall($path, $command, array $arguments)
{
$handleArg = function ($key, $value) {
$key = ltrim($key, '-');
if (strlen($key) == 1 || is_numeric($key)) {
$arg = sprintf('-%s', escapeshellarg($key));
if ($value !== null) {
$arg .= ' ' . escapeshellarg($value);
}
} else {
$arg = sprintf('--%s', escapeshellarg($key));
if ($value !== null) {
$arg .= '=' . escapeshellarg($value);
}
}
return $arg;
};
if (!self::isWindows()) {
$binary = escapeshellcmd($this->path);
} else {
$binary = $this->path;
}
if (!empty($command)) {
$command = escapeshellarg($command);
}
$args = array();
$files = array();
$fileMode = false;
foreach ($arguments as $k => $v) {
if ($v === '--' || $k === '--') {
$fileMode = true;
continue;
}
if (is_int($k)) {
if (strpos($v, '-') === 0) {
$args[] = $handleArg($v, null);
} else {
if ($fileMode) {
$files[] = escapeshellarg($v);
} else {
$args[] = escapeshellarg($v);
}
}
} else {
if (strpos($k, '-') === 0) {
$args[] = $handleArg($k, $v);
}
}
}
$cmd = trim(sprintf('%s %s %s', $binary, $command, implode(' ', $args)));
if (count($files) > 0) {
$cmd .= ' -- ' . implode(' ', $files);
}
$call = Call::create($cmd, $path);
return $call;
}