Отправить данные в родительское онко и завершить приложение
@param $data
@param bool $closePopup
@throws \yii\base\ExitException
761159
public static function postData($data, $closePopup = true)
    {
        echo self::postMessageFunction();
        echo Html::script("postIframeMessage('send.grom.iframe', " . Json::encode($data) . ");");
        if ($closePopup) {
            echo Html::script("postIframeMessage('close.grom.iframe');");
        }

        Yii::$app->end();
    }
1161038
public function fire($event, &$client, $data = null)
    {
        $retval = true;

        if (!array_key_exists($event, $this->events)) {
            return;
        }

        foreach ($this->events[$event] as $callback) {
            if (!is_callable($callback)) {
                continue;
            }

            if (($retval = call_user_func($callback, $this, $client, $data)) === false) {
                break;
            }
        }

        return $retval !== false;
    }
827678
public function success($data = null) {
		$this->_status = static::STATUS_SUCCESS;
		$this->_code = 200;
		$this->_data = !$data && $data !== false ? null : $data;
	}
216445
public function run()
    {
        $flashMessages = Yii::$app->session->getAllFlashes();
        if (empty($flashMessages)) {
            return;
        }
        $closeLabel = Yii::t('app', 'Close');
        $baseCss = 'alert';
        if ($this->dismissible) {
            $baseCss .= ' alert-dismissible';
            $dismissButton = <<<HTML
<button type="button" class="close" data-dismiss="alert" aria-label="$closeLabel">
    <span aria-hidden="true">&times;</span>
</button>
HTML;
        }
        echo '<div class="flashes">';
        foreach ($flashMessages as $key => $messages) {
            $cssClasses = $baseCss . ' alert-'.(isset($this->map[$key]) ? $this->map[$key] : $key);
            if (!is_array($messages)) {
                $messages = [$messages];
            }
            foreach ($messages as $message) {
                echo '<div class="'.$cssClasses.'" role="alert">'.$dismissButton.$message.'</div>';
            }
        }
        echo '</div>';
    }
112934
public function close($data = null, $raw = false)
    {
        if ($this->_status === self::STATUS_CLOSING || $this->_status === self::STATUS_CLOSED) {
            return;
        } else {
            if ($data !== null) {
                $this->send($data, $raw);
            }
            $this->_status = self::STATUS_CLOSING;
        }
        if ($this->_sendBuffer === '') {
            $this->destroy();
        }
    }
883544
public function execute($data) {

        try {
            $config = $this->sanitizeConfig($data);
            $this->isConciliate($config);
            if (! $this->doCancel($config))
                throw new \Exception('impossible to cancel.');

            $this->doUpdates($config);
            return true;
        } catch (\Exception $exception) {
            throw $exception;
        }
    }
528840
public function close(string $id, array $data, array $headers = [])
    {
        $url = $this->url('invoices/%s/close', $id);

        return $this->post($url, $data);
    }
271639
protected function closeWebSocket(Container $app): void
    {
        /* @var Channel $channel */
        try {
            $channel = $this->currentChannel($this->fd);
        } catch (\Exception $exception) {
            echo "closeWebSocket: {$exception->getMessage()}, fd:{$this->fd}".PHP_EOL;
            $channel = null;
        }

        if (is_null($channel)) {
            return;
        }

        $websocket = (new Socket($app, $channel))->setFd($this->fd);

        $app->instance('websocket', $websocket);

        try {
            if ($channel->eventExists('disconnection')) {
                $channel->dispatch('disconnection');
            }
        } catch (\Exception $exception) {
            throw $exception;
        } finally {
            $websocket->leave();
        }
    }
295363
public function close(Order &$order)
    {
        $data = $order->exportData();
        $endpoint= '/admin/orders/'.$order->id.'/close.json';
        $response = $this->request($endpoint, 'POST');
        $order->setData($response['order']);
    }
152507
public function setHeaderPopup($popup, $icon = 'caret square down')
    {
        $this->hasHeaderAction = true;
        $id = $this->name.'_ac';

        $this->headerActionTag = ['div',  ['class'=>'atk-table-dropdown'],
            [
                ['i', ['id' => $id, 'class' => $icon.' icon']],
            ],
        ];
        $popup->triggerBy = '#'.$id;
        $popup->popOptions = array_merge($popup->popOptions, ['on' =>'click', 'position' => 'bottom right', 'movePopup' => false]);
        $popup->stopClickEvent = true;

        if (@$_GET['__atk_reload']) {
            //This is part of a reload, need to reactivate popup.
            $this->table->js(true, $popup->jsPopup());
        }
    }
732518
protected function checkEnd($type, $data)
    {
        $lastTag = array_pop($this->stack);

        if (!is_array($lastTag)) {
            throw new Exceptions\OutputGeneratorException(
                sprintf(
                    'Invalid close: Trying to close on empty stack.'
                )
            );
        }

        if (array($lastTag[0], $lastTag[1]) !== array($type, $data)) {
            throw new Exceptions\OutputGeneratorException(
                sprintf(
                    'Invalid close: Trying to close %s:%s, while last element was %s:%s.',
                    $type,
                    $data,
                    $lastTag[0],
                    $lastTag[1]
                )
            );
        }
    }
600778
public function trigger($event, $data = FALSE, $last = TRUE)
    {
        if (isset($this->$event) && is_array($this->$event))
        {
            foreach ($this->$event as $method)
            {
                if (strpos($method, '('))
                {
                    preg_match('/([a-zA-Z0-9\_\-]+)(\(([a-zA-Z0-9\_\-\., ]+)\))?/', $method, $matches);

                    $method = $matches[1];
                    $this->callback_parameters = explode(',', $matches[3]);
                }

                $data = call_user_func_array(array($this, $method), array($data, $last));
            }
        }

        return $data;
    }
1074178
public function endDocument($data)
    {
        $this->checkEndDocument($data);

        $this->xmlWriter->endDocument();

        return $this->xmlWriter->outputMemory();
    }
154859
public function sendData($data)
    {
        $data = parent::sendData($data);

        return $this->response = new AopTradeCloseResponse($this, $data);
    }
516904
protected function _post($data) {
		$ch = curl_init();
		curl_setopt_array($ch, array(
			CURLOPT_URL            => static::ENDPOINT,
			CURLOPT_POST           => true,
			CURLOPT_POSTFIELDS     => json_encode($data),
			CURLOPT_HEADER         => false,
			CURLOPT_RETURNTRANSFER => true,
			CURLOPT_SSL_VERIFYPEER => true,
			CURLOPT_SSL_VERIFYHOST => 2,
			CURLOPT_FOLLOWLOCATION => false,
			CURLOPT_HTTPHEADER => array('Content-Type: application/json')
		));

		$response = curl_exec($ch);
		curl_close($ch);

		if ($response === false) {
			throw new Exception('Failed to contact BrowserID verification service');
		}

		$decodedResponse = json_decode($response);
		if (!$decodedResponse) {
			throw new Exception('Response is not valid JSON');
		}

		return $decodedResponse;
	}
119590
function popinClose(name) {
            var id = null, $el = null;
            if ( typeof(name) == 'string' && name != '' ) {
                if (name !== $popin.name)
                    throw new Error('Popin `'+name+'` not found !');
            }
            // by default
            id = $popin.id;

            $el = $popin.target;

            if ( $el != null && /gina-popin-is-active/.test($el.className) ) {
                instance.target.firstChild.className  = instance.target.firstChild.className.replace(/\sgina-popin-is-active|gina-popin-is-active|gina-popin-is-active\s/, '');
                $el.className           = $el.className.replace(/\sgina-popin-is-active|gina-popin-is-active|gina-popin-is-active\s/, '');
                $el.innerHTML = '';

                // removing from FormValidator instance
                var i = 0, formsLength = $popin['$forms'].length;
                if ($validator['$forms'] && formsLength > 0) {
                    for (; i < formsLength; ++i) {
                        if ( typeof($validator['$forms'][ $popin['$forms'][i] ]) != 'undefined' )
                            $validator['$forms'][ $popin['$forms'][i] ].destroy();

                        $popin['$forms'].splice( i, 1);
                    }
                }
                // remove listeners
                removeListener(gina, $popin.target, 'loaded.' + $popin.id);




                $popin.isOpen = false;

                // restore toolbar
                if ( gina && typeof(window.ginaToolbar) == "object" )
                    ginaToolbar.restore();

                triggerEvent(gina, $popin.target, 'close.'+ id, $popin);
            }
        }
941423
public function fireEvent($event, $source, $data = [])
    {
        if ($this->_listeners) {
            list($p1, $p2) = explode(':', $event, 2);
            if (isset($this->_listeners[$p1])) {
                foreach ($this->_listeners[$p1] as $k => $v) {
                    /**@var \ManaPHP\Event\Listener $listener */
                    if (is_int($v)) {
                        $this->_listeners[$p1][$k] = $listener = $this->_di->getShared($k);
                    } else {
                        $listener = $v;
                    }

                    $listener->process($p2, $source, $data);
                }
            }
        }

        foreach ($this->_peekers as $handler) {
            if ($handler instanceof \Closure) {
                $handler($event, $source, $data);
            } else {
                $handler[0]->{$handler[1]}($event, $source, $data);
            }
        }

        if (!isset($this->_events[$event])) {
            return;
        }

        foreach ($this->_events[$event] as $handler) {
            if ($handler instanceof \Closure) {
                $handler($source, $data, $event);
            } else {
                $handler[0]->{$handler[1]}($source, $data, $event);
            }
        }
    }