本文整理汇总了PHP中Closure::call方法的典型用法代码示例。如果您正苦于以下问题:PHP Closure::call方法的具体用法?PHP Closure::call怎么用?PHP Closure::call使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Closure
的用法示例。
在下文中一共展示了Closure::call方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testCorrect
/**
* @param string $type
* @param \Closure $generateImage
* @param \Closure $checkOutput
* @param array $logLevels
* @dataProvider imageProvider
*/
public function testCorrect(string $type, \Closure $generateImage, \Closure $checkOutput, array $logLevels = [])
{
$validator = new ImageValidator($type, '');
$validator->setLogger($this);
$checkOutput->call($this, $validator->correct($generateImage()));
$this->assertEquals($logLevels, $this->logLevels);
}
示例2: __call
/**
* @param string $name
* @param array $Args
* @return Client|string
* @throws \Exception
*/
public function __call($name, array $Args = [])
{
if (is_null($this->namespace)) {
$this->namespace = Src::frcm($name, '-');
return $this;
}
try {
$Bridge = (new Bridge($this->url, Bridge::RM_POST))->withToken($this->token)->withMethod($name)->withNamespace($this->namespace)->withParams($Args);
if (count($this->Watchers) > 0) {
foreach ($this->Watchers as $Watcher) {
$Bridge->with($Watcher->getKey(), $Watcher->watch());
}
}
return !is_null($this->Wrapper) ? $this->Wrapper->call($this, $Bridge->send()) : $Bridge->send();
} finally {
$this->namespace = null;
}
}
示例3: renderJson
/**
* Send immediately
*/
public function renderJson()
{
$totalCount = $this->getDatasource()->totalCount();
$rows = $this->getDatasource()->listRows();
$tmpData = [];
foreach ($rows as $row) {
$tmp = [];
$this->currentRow = new DefaultRow();
if ($this->rowCallback instanceof \Closure) {
$this->rowCallback->call($this, $row);
}
foreach ($this->getColumns() as $key => $column) {
$this->currentColumn = $key;
$tmp[$column->getName()] = $column->format($row);
}
$tmpData[] = $tmp;
}
$data = ['draw' => $this->getRequest()->get('draw'), 'recordsTotal' => $totalCount, 'recordsFiltered' => $totalCount, 'data' => $tmpData];
header('Content-Type: application/json');
echo json_encode($data);
die;
}
示例4: execute
public function execute(\Closure $closure)
{
return $closure->call($this->restrictedEnvironment);
}
示例5: invokeClosure
/**
* @param \Closure $closure
*
* @return TransformInterface
*/
protected final function invokeClosure(\Closure $closure) : TransformInterface
{
$bindTo = $this->isMutable() ? $this : clone $this;
$result = $closure->call($bindTo, $bindTo);
return $this->readyResult($result);
}
示例6: handle
/**
* @param array $path
* @return array
*/
public function handle(array $path) : array
{
return $this->closure->call($this, $path);
}
示例7: __construct
public function __construct(string $dir, string $sourceDir, string $routePath = null, \Closure $fn = null)
{
$this->docDir = $dir;
$this->source = $sourceDir;
if (!is_dir($sourceDir)) {
throw new \Error("Source directory does not exist, or it is not a directory!");
}
if (!empty($routePath)) {
$this->setRoutePath($routePath);
}
if (isset($fn)) {
$fn->call($this);
}
}