本文整理汇总了PHP中Call类的典型用法代码示例。如果您正苦于以下问题:PHP Call类的具体用法?PHP Call怎么用?PHP Call使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Call类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: toString
public function toString(\b2\Quote $quote)
{
if (!$this->cases) {
throw new \b2\Exception('IN is empty');
}
$call = new Call('IN', $this->cases);
return $this->expression->toString($quote) . ' ' . $call->toString($quote);
}
示例2: createCall
public static function createCall()
{
$time = mt_rand();
$name = 'Call';
$call = new Call();
$call->name = $name . $time;
$call->save();
self::$_createdCalls[] = $call;
return $call;
}
示例3: run
public function run()
{
$data = new Call();
$data->level_id = 1;
$data->function = 'backgroundObj';
$data->x = 0;
$data->y = 85;
$data->width = 700;
$data->height = 15;
$data->color = 'black';
$data->save();
}
示例4: test_treeByTeams
public function test_treeByTeams()
{
/** === Test Data === */
$asCustId = 'customer';
$asParentId = 'parent';
$id1 = 1;
$id2 = 2;
$id3 = 3;
$data = [[$asCustId => $id1, $asParentId => $id1], [$asCustId => $id2, $asParentId => $id1], [$asCustId => $id3, $asParentId => $id2]];
/** === Setup Mocks === */
/** === Call and asserts === */
$req = new Request\TreeByTeams();
$req->setDataToMap($data);
$req->setAsCustomerId($asCustId);
$req->setAsParentId($asParentId);
$resp = $this->obj->treeByTeams($req);
$this->assertTrue($resp->isSucceed());
$mapped = $resp->getMapped();
$this->assertTrue(is_array($mapped));
$this->assertEquals(2, count($mapped));
$custId = reset($mapped[$id1]);
$this->assertEquals($id2, $custId);
$custId = reset($mapped[$id2]);
$this->assertEquals($id3, $custId);
}
示例5: indexAction
public function indexAction()
{
$model = new SettingsModel();
$form = Call::form('Index');
$countrysList = $model->getCountryList();
if (isPost()) {
if ($form->isValid(allPost()) and (isset($form->data["email"]) or isset($form->data["password"]) and isset($form->data["password1"]))) {
if (Request::getParam('user')->password == md5($form->data['password'])) {
$data = [];
if ($form->data['password1'] != '') {
$data['password'] = md5($form->data['password1']);
}
if (isset($form->data['email'])) {
$data['email'] = $form->data["email"];
}
if ($form->data['news'] == 1) {
$data['newsletter'] = $form->data["news"];
}
$model->setSettings(Request::getParam('user')->id, $data);
redirect(url('settings'));
}
} else {
$this->view->error = printError($form->error, 'INDEX_ERROR_');
}
}
$this->view->countrysList = $countrysList;
$this->view->title = Lang::translate('INDEX_TITLE');
}
示例6: push
/**
* Add a Call object to the CallChain
*
* @param mixed $call Either a Call object, or a table name (from which a Call object will be created)
* @param array $plugins (Optional) An array of plugins
*
* @return void
*/
public function push($call, array $plugins = array())
{
if (! ($call instanceof Call))
{
$table = (string) $call;
$call = new Call();
$call->table = $table;
}
foreach ($plugins as $plugin)
{
$call->apply($plugin);
}
$this->_calls[] = $call;
return;
}
示例7: optimize
public function optimize(array $expression, Call $call, CompilationContext $context)
{
/**
* Process the expected symbol to be returned
*/
$call->processExpectedReturn($context);
$symbolVariable = $call->getSymbolVariable();
if ($symbolVariable->isNotVariableAndString()) {
throw new CompilerException("Returned values by functions can only be assigned to variant variables", $expression);
}
if ($call->mustInitSymbolVariable()) {
$symbolVariable->initVariant($context);
}
$context->headersManager->add('my_mandelbrot');
$symbolVariable->setDynamicTypes('bool');
$resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);
$context->codePrinter->output('ZVAL_BOOL(' . $symbolVariable->getRealName() . ', my_mandelbrot_to_file(' . $resolvedParams[0] . ', ' . $resolvedParams[1] . ', ' . $resolvedParams[2] . ', ' . $resolvedParams[3] . '));');
return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression);
}
示例8: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
// $validator = new Validator::make(Input::all(), ObjectsData::$rules);
// if( $validator->fails())
// {
// return Redirect::back()->withInput()->withErrors($validator);
// } else {
// $oldData = ObjectsData::were('level_id', 1)->get();
// dd($oldData);
$prev = Level::where('next_level', '=', NULL)->first();
$lvl = new Level();
$lvl->game_id = 1;
$lvl->level_name = Input::get('level_name');
$lvl->next_level = null;
$lvl->save();
$prev->next_level = $lvl->id;
$prev->save();
// $oldData = Call::where('level_id', $lvl->id)->get();
// foreach($oldData as $old)
// {
// $old->destroy($old->id);
// }
$lines = explode('*', Input::get('csvString'));
foreach ($lines as $line) {
$data = explode(',', $line);
$submit = new Call();
$submit->level_id = $lvl->id;
$submit->function = $data[0];
$submit->x = $data[1];
$submit->y = $data[2];
$submit->width = $data[3];
$submit->height = $data[4];
$submit->color = $data[5];
$submit->save();
}
if ($submit) {
return Redirect::action('GamesController@show', $lvl->id);
} else {
return Redirect::action('GamesController@create')->withInput();
}
// }
}
示例9: process
public function process()
{
parent::process();
$params = $this->initParams();
$call = new Call();
try {
$result = $call->createTransaction($params);
} catch (Exception $e) {
//d($e);
}
if (isset($result->CreateTransactionResult) && isset($result->CreateTransactionResult->TransportKey) && $result->CreateTransactionResult->TransportKey != '') {
self::$smarty->assign('formLink', $this->_paymentLink[Configuration::get('MERCHANT_WARE_MODE')]);
self::$smarty->assign('transportKey', Tools::safeOutput($result->CreateTransactionResult->TransportKey));
} elseif (isset($result->CreateTransactionResult)) {
Logger::addLog('Module merchantware: ' . $result->CreateTransactionResult->Messages->Message[0]->Information, 2);
self::$smarty->assign('error', true);
} else {
self::$smarty->assign('error', true);
Logger::addLog('Module merchantware: no message returned', 2);
}
}
示例10: process
/**
* Führt den Request aus
*
* Gibt die Ausgabe des Calls vom Controller zurück
* wenn man den Request nicht selbst erstellen will, kann man
*
* \Psc\URL\Service\Request::infer();
*
* benutzen.
*/
public function process(Request $request)
{
// required
$service = $this->getRegisteredService($request->getPart(1));
$call = new Call(mb_strtolower($request->getMethod()));
// identifier ist optional
if (($identifier = $request->getPart(2)) !== NULL) {
$call->addParameter($identifier);
/* alle Subs weitergeben als weitere Parameter */
foreach ($request->getPartsFrom(3) as $p) {
$call->addParameter($p);
}
} else {
$call->setName('index');
}
if ($request->getMethod() === Request::POST || $request->getMethod() === Request::PUT) {
$call->addParameter($request->getBody());
}
$this->call = $call;
$this->service = $service;
return $this->call();
}
示例11: test_getCurrentStock_noCustomer_noLink
public function test_getCurrentStock_noCustomer_noLink()
{
/** === Test Data === */
$CUST_ID = 21;
$STOCK_ID = 32;
$LINK = new \Praxigento\Warehouse\Data\Entity\Customer();
$LINK->setStockRef($STOCK_ID);
/** === Setup Mocks === */
// $custId = $this->_session->getCustomerId();
$this->mSession->shouldReceive('getCustomerId')->once()->andReturn($CUST_ID);
// $link = $this->_repoCustomer->getById($custId);
$this->mRepoCustomer->shouldReceive('getById')->once()->andReturn(null);
// $stockId = $this->_subRepo->getStockId();
$this->mSubRepo->shouldReceive('getStockId')->once()->andReturn($STOCK_ID);
// $this->_repoCustomer->create($data);
$this->mRepoCustomer->shouldReceive('create')->once();
/** === Call and asserts === */
$req = new Request\GetCurrentStock();
$resp = $this->obj->getCurrentStock($req);
$this->assertTrue($resp->isSucceed());
$this->assertEquals($STOCK_ID, $resp->getStockId());
}
示例12: test_reset
public function test_reset()
{
/** === Test Data === */
$DATESTAMP_FROM = '20151123';
$ROWS_DELETED = 5;
/** === Setup Mocks === */
// $rows = $this->_repoBalance->delete($where);
$this->mRepoBalance->shouldReceive('delete')->once()->andReturn($ROWS_DELETED);
/** === Call and asserts === */
$req = new Request\Reset();
$req->setDateFrom($DATESTAMP_FROM);
$res = $this->obj->reset($req);
$this->assertTrue($res->isSucceed());
$this->assertEquals($ROWS_DELETED, $res->getRowsDeleted());
}
示例13: test_getStateOnDate
public function test_getStateOnDate()
{
/** === Test Data === */
$dstamp = '20151206';
$rows = 'rows';
/** === Setup Mocks === */
// $rows = $this->_repoSnap->getStateOnDate($dateOn);
$this->mRepoSnap->shouldReceive('getStateOnDate')->once()->andReturn($rows);
/** === Call and asserts === */
$req = new Request\GetStateOnDate();
$req->setDatestamp($dstamp);
$resp = $this->obj->getStateOnDate($req);
$this->assertTrue($resp->isSucceed());
$this->assertEquals($rows, $resp->getData());
}
示例14: test_registerSale
public function test_registerSale()
{
/** === Test Data === */
$ITEM_ID = 32;
$PROD_ID = 16;
$STOCK_ID = 2;
$QTY = 4;
$REQ = $this->_mock(Request\RegisterSale::class);
/** === Setup Mocks === */
// $def = $this->_manTrans->begin();
$mDef = $this->_mockTransactionDefinition();
$this->mManTrans->shouldReceive('begin')->once()->andReturn($mDef);
// $reqItems = $req->getSaleItems();
$mReqItem = $this->_mock(\Praxigento\Warehouse\Service\QtyDistributor\Data\Item::class);
$REQ->shouldReceive('getSaleItems')->once()->andReturn([$mReqItem]);
// $itemId = $item->getItemId();
$mReqItem->shouldReceive('getItemId')->once()->andReturn($ITEM_ID);
// $prodId = $item->getProductId();
$mReqItem->shouldReceive('getProductId')->once()->andReturn($PROD_ID);
// $stockId = $item->getStockId();
$mReqItem->shouldReceive('getStockId')->once()->andReturn($STOCK_ID);
// $qty = $item->getQuantity();
$mReqItem->shouldReceive('getQuantity')->once()->andReturn($QTY);
// $lots = $this->_subRepo->getLotsByProductId($prodId, $stockId);
$mLots = ['lots'];
$this->mSubRepo->shouldReceive('getLotsByProductId')->once()->andReturn($mLots);
// $this->_subRepo->registerSaleItemQty($itemId, $qty, $lots);
$this->mSubRepo->shouldReceive('registerSaleItemQty')->once()->with($ITEM_ID, $QTY, $mLots);
// $this->_manTrans->commit($def);
$this->mManTrans->shouldReceive('commit')->once()->with($mDef);
// $this->_manTrans->end($def);
$this->mManTrans->shouldReceive('end')->once()->with($mDef);
/** === Call and asserts === */
$res = $this->obj->registerSale($REQ);
$this->assertTrue($res->isSucceed());
}
示例15: destroy
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return Response
*/
public function destroy($id)
{
if (Auth::check()) {
$level = Level::find($id);
$previous = Level::where('next_level', '=', $level->id)->first();
$previous->next_level = $level->next_level;
$previous->save();
$calls = Call::where('level_id', '=', $id)->get();
foreach ($calls as $call) {
$call->delete();
}
$level = Level::find($id);
$level->delete();
return $this->index();
}
return 'you are not authorized to do this';
}