コード例 #1
0
ファイル: VkJs.php プロジェクト: AleksandrKuporosov/VkApiPHP
 /**
  * We wanna send our current VkJs to Vk execute
  * @return RequestTransaction|Api
  */
 public function execute()
 {
     $execute = $this->dataString;
     if ($this->requests) {
         foreach ($this->requests as $request) {
             $execute .= ',' . $request->dataString;
         }
         $execute = '[' . $execute . ']';
         if (!$this->callback && !$this->vk->jsCallback) {
             $this->vk->jsCallback = true;
             $oldCallback = $this->vk->callback;
             $this->callback = function ($data) use(&$oldCallback) {
                 $std = new stdClass();
                 $std->response = $data;
                 return new Api($std, $oldCallback);
             };
             $this->vk->createAs($this->callback);
         }
     }
     return $this->vk->request('execute', ['code' => sprintf('return %s;', $execute)]);
 }