<commit_before><?php
/**
 * Created by PhpStorm.
 * User: smladeoye
 * Date: 1/11/2017
 * Time: 10:21 AM
 */

namespace components\sml\paystack\widget;

use yii\base\Widget;
use yii\helpers\Html;
use yii\web\View;
use yii\base\InvalidConfigException;
use yii\web\JqueryAsset;

class PaystackWidget extends Widget
{
    public $options;
    public $buttonOptions = [];

    public $buttonText;

    private $jsScript = 'https://js.paystack.co/v1/inline.js';

    public function init()
    {
        parent::init();
        $this->view->registerJs($this->setHandler(),View::POS_END,'paystack');
        $this->view->registerJsFile($this->jsScript,['depends' => [JqueryAsset::className()]]);
    }

    public function run()
    {
        return Html::tag('button',$this->buttonText,array_merge(['class'=>'btn btn-info'],$this->buttonOptions,['onClick'=>'paystack_inline();']));
    }

    public function setHandler()
    {
        $file = __DIR__.DIRECTORY_SEPARATOR.'_paystack.php';

        if (empty($this->options))
        {
            throw new InvalidConfigException('Paystack options must be set');
        }

        return strip_tags($this->view->renderFile($file,['options'=>$this->options]));
    }
}<commit_msg>yii2 paystack<commit_after><?php
/**
 * Created by PhpStorm.
 * User: smladeoye
 * Date: 1/11/2017
 * Time: 10:21 AM
 */

namespace components\sml\paystack\widget;

use yii\base\Widget;
use yii\helpers\Html;
use yii\web\View;
use yii\base\InvalidConfigException;
use yii\web\JqueryAsset;

class PaystackWidget extends Widget
{
    public $options;
    public $buttonOptions = [];

    public $buttonText;

    private $jsScript = 'https://js.paystack.co/v1/inline.js';

    public function init()
    {
        parent::init();
        $this->view->registerJs($this->setHandler(),View::POS_END,'paystack');
        $this->view->registerJsFile($this->jsScript,['depends' => [JqueryAsset::className()]]);
    }

    public function run()
    {
        return Html::tag('button',$this->buttonText,array_merge(['class'=>'btn btn-info'],$this->buttonOptions,['onClick'=>'paystack_inline();']));
    }

    public function setHandler()
    {

        $file = __DIR__.DIRECTORY_SEPARATOR.'_paystack.php';

        if (empty($this->options))
        {
            throw new InvalidConfigException('Paystack options must be set');
        }

        return strip_tags($this->view->renderFile($file,['options'=>$this->options]));
    }
}
{'fraction_non_alphanumeric': 0.16809465524275805, 'fraction_numerical': 0.010199918400652794, 'mean_word_length': 3.4021543985637344, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 35, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3291825', 'n_tokens_mistral': 804, 'n_tokens_neox': 783, 'n_words': 131}