[
  {
    "path": ".gitattributes",
    "content": "# Path-based git attributes\n# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html\n\n# Ignore all test and documentation with \"export-ignore\".\n/.gitattributes     export-ignore\n/.gitignore         export-ignore\n/.travis.yml        export-ignore\n/phpunit.xml.dist   export-ignore\n/.scrutinizer.yml   export-ignore\n/tests              export-ignore\n/composer.lock      export-ignore\n"
  },
  {
    "path": ".gitignore",
    "content": "build\n#composer.lock\ndocs\nvendor\n\n# cache directories\nThumbs.db\n*.DS_Store\n*.empty\n\n#phpstorm project files\n.idea\n\n#netbeans project files\nnbproject\n\n#eclipse, zend studio, aptana or other eclipse like project files\n.buildpath\n.project\n.settings\n\n\n# mac deployment helpers\nswitch\nindex"
  },
  {
    "path": ".scrutinizer.yml",
    "content": "filter:\n    excluded_paths: [tests/*]\nchecks:\n    php:\n        code_rating: true\n        remove_extra_empty_lines: true\n        remove_php_closing_tag: true\n        remove_trailing_whitespace: true\n        fix_use_statements:\n            remove_unused: true\n            preserve_multiple: false\n            preserve_blanklines: true\n            order_alphabetically: true\n        fix_php_opening_tag: true\n        fix_linefeed: true\n        fix_line_ending: true\n        fix_identation_4spaces: true\n        fix_doc_comments: true\ntools:\n    external_code_coverage:\n        timeout: 600\n        runs: 3\n    php_analyzer: true\n    php_code_coverage: false\n    php_code_sniffer:\n        config:\n            standard: PSR2\n        filter:\n            paths: ['src']\n    php_loc:\n        enabled: true\n        excluded_dirs: [vendor, tests]\n    php_cpd:\n        enabled: true\n        excluded_dirs: [vendor, tests]\n"
  },
  {
    "path": ".travis.yml",
    "content": "language: php\n\nphp:\n  - 5.5\n  - 5.6\n\ninstall:\n  - composer self-update\n  - composer global require \"fxp/composer-asset-plugin:^1.2.0\"\n  - composer install\n\nbefore_script:\n  - travis_retry composer self-update\n  - travis_retry composer install --no-interaction --prefer-source --dev\n\nscript:\n  - phpunit --coverage-text --coverage-clover=coverage.clover\n\nafter_script:\n  - wget https://scrutinizer-ci.com/ocular.phar\n  - php ocular.phar code-coverage:upload --format=php-clover coverage.clover\n"
  },
  {
    "path": "CHANGELOG.md",
    "content": "# Changelog\n\n## 1.0.5 - 2015-04-02\n\n## Changed \n- Added CHANGELOG.md file\n\n## Fixed \n- Fixed asset registration bug when using form\n"
  },
  {
    "path": "CONTRIBUTING.md",
    "content": "# Contributing\n\nContributions are **welcome** and will be fully **credited**.\n\nWe accept contributions via Pull Requests on [Github](https://github.com/2amigos/yii2-datepicker-widget).\n\n\n## Pull Requests\n\n- **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** - The easiest way to apply the conventions is to install [PHP Code Sniffer](http://pear.php.net/package/PHP_CodeSniffer).\n\n- **Add tests!** - Your patch won't be accepted if it doesn't have tests.\n\n- **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date.\n\n- **Consider our release cycle** - We try to follow [SemVer v2.0.0](http://semver.org/). Randomly breaking public APIs is not an option.\n\n- **Create feature branches** - Don't ask us to pull from your master branch.\n\n- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests.\n\n- **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please squash them before submitting.\n\n\n## Running Tests\n\n``` bash\n$ phpunit\n```\n\n\n**Happy coding**!\n"
  },
  {
    "path": "LICENSE.md",
    "content": "# The BSD License (BSD)\n\nCopyright (c) 2013-2015, 2amigOS! Consulting Group LLC.\n\n> Redistribution and use in source and binary forms, with or without modification,\n> are permitted provided that the following conditions are met:\n>\n>  Redistributions of source code must retain the above copyright notice, this\n>  list of conditions and the following disclaimer.\n>\n>  Redistributions in binary form must reproduce the above copyright notice, this\n>  list of conditions and the following disclaimer in the documentation and/or\n>  other materials provided with the distribution.\n>\n>  Neither the name of 2amigOS! Consulting Group, LLC. nor the names of its\n>  contributors may be used to endorse or promote products derived from\n>  this software without specific prior written permission.\n>\n>THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\n>ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n>WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n>DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR\n>ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n>(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n>LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON\n>ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n>(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n>SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n"
  },
  {
    "path": "README.md",
    "content": "Bootstrap DatePicker Widget for Yii2\n====================================\n\n[![Latest Version](https://img.shields.io/github/tag/2amigos/yii2-date-picker-widget.svg?style=flat-square&label=release)](https://github.com/2amigos/yii2-date-picker-widget/tags)\n[![Software License](https://img.shields.io/badge/license-BSD-brightgreen.svg?style=flat-square)](LICENSE.md)\n[![Build Status](https://img.shields.io/travis/2amigos/yii2-date-picker-widget/master.svg?style=flat-square)](https://travis-ci.org/2amigos/yii2-date-picker-widget)\n[![Coverage Status](https://img.shields.io/scrutinizer/coverage/g/2amigos/yii2-date-picker-widget.svg?style=flat-square)](https://scrutinizer-ci.com/g/2amigos/yii2-date-picker-widget/code-structure)\n[![Quality Score](https://img.shields.io/scrutinizer/g/2amigos/yii2-date-picker-widget.svg?style=flat-square)](https://scrutinizer-ci.com/g/2amigos/yii2-date-picker-widget)\n[![Total Downloads](https://img.shields.io/packagist/dt/2amigos/yii2-date-picker-widget.svg?style=flat-square)](https://packagist.org/packages/2amigos/yii2-date-picker-widget)\n\n\nRenders a [Bootstrap DatePicker plugin](http://bootstrapformhelpers.com/datepicker/).\n\nInstallation\n------------\nThe preferred way to install this extension is through [composer](http://getcomposer.org/download/).\n\nEither run\n\n```bash\n$ composer require 2amigos/yii2-date-picker-widget:~1.0\n```\nor add\n\n```json\n\"2amigos/yii2-date-picker-widget\" : \"~1.0\"\n```\n\nto the require section of your application's `composer.json` file.\n\nUsage\n-----\nThe widget comes in two flavors: \n\n- DatePicker\n- DateRangePicker\n\n**DatePicker**\n\nThis widget renders a Bootstrap DatePicker input control. Best suitable for model with date string attribute.\n\n***Example of use with a form***  \nThere are two ways of using it, with an `ActiveForm` instance or as a widget setting up its `model` and `attribute`.\n\n```php\n<?php\nuse dosamigos\\datepicker\\DatePicker;\n\n// as a widget\n?>\n\n<?= DatePicker::widget([\n    'model' => $model,\n    'attribute' => 'date',\n    'template' => '{addon}{input}',\n        'clientOptions' => [\n            'autoclose' => true,\n            'format' => 'dd-M-yyyy'\n        ]\n]);?>\n\n<?php \n// with an ActiveForm instance \n?>\n<?= $form->field($model, 'date')->widget(\n    DatePicker::className(), [\n        // inline too, not bad\n         'inline' => true, \n         // modify template for custom rendering\n        'template' => '<div class=\"well well-sm\" style=\"background-color: #fff; width:250px\">{input}</div>',\n        'clientOptions' => [\n            'autoclose' => true,\n            'format' => 'dd-M-yyyy'\n        ]\n]);?>\n```  \n***Example of use without a model***\n\n```php\n<?php\nuse dosamigos\\datepicker\\DatePicker;\n?>\n<?= DatePicker::widget([\n    'name' => 'Test',\n    'value' => '02-16-2012',\n    'template' => '{addon}{input}',\n        'clientOptions' => [\n            'autoclose' => true,\n            'format' => 'dd-M-yyyy'\n        ]\n]);?>\n```\n**DateRangePicker**  \n\nThis widget renders a Bootstrap DateRangePicker Input control. \n\n***Example of use with a form***  \nThe following example works with a model that has two attributes named `date_from` and `date_to`.\n\n```php\n<?php\nuse dosamigos\\datepicker\\DateRangePicker;\n?>\n<?= $form->field($tour, 'date_from')->widget(DateRangePicker::className(), [\n    'attributeTo' => 'date_to', \n    'form' => $form, // best for correct client validation\n    'language' => 'es',\n    'size' => 'lg',\n    'clientOptions' => [\n        'autoclose' => true,\n        'format' => 'dd-M-yyyy'\n    ]\n]);?>\n```  \n***Example of use without a model***\n\n```php  \n<?php\nuse dosamigos\\datepicker\\DateRangePicker;\n?>\n<?= DateRangePicker::widget([\n    'name' => 'date_from',\n    'value' => '02-16-2012',\n    'nameTo' => 'name_to',\n    'valueTo' => '02-20-2012'\n]);?>\n```\n\nTesting\n-------\n\nTo test the extension, is better to clone this repository on your computer. After, go to the extensions folder and do\nthe following (assuming you have `composer` installed on your computer): \n\n```bash \n$ composer install --no-interaction --prefer-source --dev\n```\nOnce all required libraries are installed then do: \n\n```bash \n$ vendor/bin/phpunit\n```\n\nI would recommend to have `phpunit` globally installed together with `xdebug` so you can have code coverage analysis too.\n\nFurther Information\n-------------------\nPlease, check the [Bootstrap DatePicker site](http://bootstrap-datepicker.readthedocs.io/en/latest/) documentation for further information about its configuration options. \n\nContributing\n------------\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) for details.\n\nCredits\n-------\n\n- [Antonio Ramirez](https://github.com/tonydspaniard)\n- [All Contributors](../../contributors)\n\nLicense\n-------\n\nThe BSD License (BSD). Please see [License File](LICENSE.md) for more information.\n\n\n> [![2amigOS!](http://www.gravatar.com/avatar/55363394d72945ff7ed312556ec041e0.png)](http://www.2amigos.us)  \n<i>Web development has never been so fun!</i>  \n[www.2amigos.us](http://www.2amigos.us)\n"
  },
  {
    "path": "composer.json",
    "content": "{\n    \"name\": \"2amigos/yii2-date-picker-widget\",\n    \"description\": \"Bootstrap DatePicker widget for Yii2.\",\n    \"type\": \"yii2-extension\",\n    \"keywords\": [\n        \"2amigos\",\n        \"yii\",\n        \"yii2\",\n        \"yii 2\",\n        \"extension\",\n        \"widget\",\n        \"datepicker\"\n    ],\n    \"homepage\": \"http://yiiwheels.com/extension/bootstrap-datepicker\",\n    \"license\": \"BSD-3-Clause\",\n    \"authors\": [\n        {\n            \"name\": \"2amigOS! Consulting Group\",\n            \"email\": \"hola@2amigos.us\",\n            \"homepage\": \"http://2amigos.us\",\n            \"role\": \"Developer\"\n        }\n    ],\n    \"support\": {\n        \"issues\": \"https://github.com/2amigos/yii2-date-picker-widget/issues\",\n        \"source\": \"https://github.com/2amigos/yii2-date-picker-widget\"\n    },\n    \"require\": {\n        \"yiisoft/yii2\": \">=2.0.9\",\n        \"yiisoft/yii2-bootstrap\": \"*\",\n        \"bower-asset/bootstrap-datepicker\": \"1.7.0\"\n    },\n    \"require-dev\": {\n        \"phpunit/phpunit\": \"4.*\"\n    },\n    \"autoload\": {\n        \"psr-4\": {\n            \"dosamigos\\\\datepicker\\\\\": \"src\"\n        }\n    },\n    \"extra\": {\n        \"branch-alias\": {\n            \"dev-master\": \"1.0-dev\"\n        },\n        \"asset-installer-paths\": {\n            \"bower-asset-library\": \"vendor/bower\"\n        }\n    }\n}\n"
  },
  {
    "path": "phpunit.xml.dist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<phpunit bootstrap=\"./tests/functional/bootstrap.php\"\n         backupGlobals=\"false\"\n         backupStaticAttributes=\"false\"\n         colors=\"true\"\n         verbose=\"true\"\n         convertErrorsToExceptions=\"true\"\n         convertNoticesToExceptions=\"true\"\n         convertWarningsToExceptions=\"true\"\n         processIsolation=\"false\"\n         stopOnFailure=\"false\">\n    <testsuites>\n        <testsuite name=\"Yii2 DatePicker Test Suite\">\n            <directory>./tests/functional</directory>\n        </testsuite>\n    </testsuites>\n    <filter>\n        <whitelist>\n            <directory suffix=\".php\">./src/</directory>\n        </whitelist>\n    </filter>\n    <logging>\n        <log type=\"tap\" target=\"build/report.tap\"/>\n        <log type=\"junit\" target=\"build/report.junit.xml\"/>\n        <log type=\"coverage-html\" target=\"build/coverage\" charset=\"UTF-8\" yui=\"true\" highlight=\"true\"/>\n        <log type=\"coverage-text\" target=\"build/coverage.txt\"/>\n        <log type=\"coverage-clover\" target=\"build/logs/clover.xml\"/>\n    </logging>\n</phpunit>\n"
  },
  {
    "path": "src/DatePicker.php",
    "content": "<?php\n/**\n * @copyright Copyright (c) 2013-2016 2amigOS! Consulting Group LLC\n * @link http://2amigos.us\n * @license http://www.opensource.org/licenses/bsd-license.php New BSD License\n */\nnamespace dosamigos\\datepicker;\n\nuse yii\\helpers\\Html;\nuse yii\\helpers\\Json;\nuse yii\\widgets\\InputWidget;\n\n/**\n * DatePicker renders a DatePicker input.\n *\n * @author Antonio Ramirez <amigo.cobos@gmail.com>\n * @link http://www.ramirezcobos.com/\n * @link http://www.2amigos.us/\n * @package dosamigos\\datepicker\n */\nclass DatePicker extends InputWidget\n{\n    use DatePickerTrait;\n\n    /**\n     * @var string the addon markup if you wish to display the input as a component. If you don't wish to render as a\n     * component then set it to null or false.\n     */\n    public $addon = '<i class=\"glyphicon glyphicon-calendar\"></i>';\n    /**\n     * @var string the template to render the input.\n     */\n    public $template = '{input}{addon}';\n    /**\n     * @var bool whether to render the input as an inline calendar\n     */\n    public $inline = false;\n\n    /**\n     * @inheritdoc\n     */\n    public function init()\n    {\n        parent::init();\n\n        if ($this->inline) {\n            $this->options['readonly'] = 'readonly';\n            Html::addCssClass($this->options, 'text-center');\n        }\n        if ($this->size) {\n            Html::addCssClass($this->options, 'input-' . $this->size);\n            Html::addCssClass($this->containerOptions, 'input-group-' . $this->size);\n        }\n        Html::addCssClass($this->options, 'form-control');\n        Html::addCssClass($this->containerOptions, 'input-group date');\n    }\n\n    /**\n     * @inheritdoc\n     */\n    public function run()\n    {\n\n        $input = $this->hasModel()\n            ? Html::activeTextInput($this->model, $this->attribute, $this->options)\n            : Html::textInput($this->name, $this->value, $this->options);\n\n        if ($this->inline) {\n            $input .= '<div></div>';\n        }\n        if ($this->addon && !$this->inline) {\n            $addon = Html::tag('span', $this->addon, ['class' => 'input-group-addon']);\n            $input = strtr($this->template, ['{input}' => $input, '{addon}' => $addon]);\n            $input = Html::tag('div', $input, $this->containerOptions);\n        }\n        if ($this->inline) {\n            $input = strtr($this->template, ['{input}' => $input, '{addon}' => '']);\n        }\n        echo $input;\n\n        $this->registerClientScript();\n    }\n\n    /**\n     * Registers required script for the plugin to work as DatePicker\n     */\n    public function registerClientScript()\n    {\n        $js = [];\n        $view = $this->getView();\n\n        // @codeCoverageIgnoreStart\n        if ($this->language !== null && $this->language !== 'en') {\n            $this->clientOptions['language'] = $this->language;\n            DatePickerLanguageAsset::register($view)->js[] = 'bootstrap-datepicker.' . $this->language . '.min.js';\n        } else {\n            DatePickerAsset::register($view);\n        }\n        // @codeCoverageIgnoreEnd\n\n        $id = $this->options['id'];\n        $selector = \";jQuery('#$id')\";\n\n        if ($this->addon || $this->inline) {\n            $selector .= \".parent()\";\n        }\n\n        $options = !empty($this->clientOptions) ? Json::encode($this->clientOptions) : '';\n\n        if ($this->inline) {\n            $this->clientEvents['changeDate'] = \"function (e){ jQuery('#$id').val(e.format());}\";\n        }\n\n        $js[] = \"$selector.datepicker($options);\";\n\n        if (!empty($this->clientEvents)) {\n            foreach ($this->clientEvents as $event => $handler) {\n                $js[] = \"$selector.on('$event', $handler);\";\n            }\n        }\n        $view->registerJs(implode(\"\\n\", $js));\n    }\n\n}\n"
  },
  {
    "path": "src/DatePickerAsset.php",
    "content": "<?php\n/**\n * @copyright Copyright (c) 2013-2016 2amigOS! Consulting Group LLC\n * @link http://2amigos.us\n * @license http://www.opensource.org/licenses/bsd-license.php New BSD License\n */\nnamespace dosamigos\\datepicker;\n\nuse yii\\web\\AssetBundle;\n\n/**\n * DatePickerAsset\n *\n * @author Antonio Ramirez <amigo.cobos@gmail.com>\n * @link http://www.ramirezcobos.com/\n * @link http://www.2amigos.us/\n * @package dosamigos\\datepicker\n */\nclass DatePickerAsset extends AssetBundle\n{\n    public $sourcePath = '@bower/bootstrap-datepicker/dist';\n\n    public $css = [\n        'css/bootstrap-datepicker3.css',\n    ];\n\n    public $js = [\n        'js/bootstrap-datepicker.js'\n    ];\n\n    public $depends = [\n        'yii\\bootstrap\\BootstrapPluginAsset'\n    ];\n}\n"
  },
  {
    "path": "src/DatePickerLanguageAsset.php",
    "content": "<?php\n/**\n * @copyright Copyright (c) 2013-2016 2amigOS! Consulting Group LLC\n * @link http://2amigos.us\n * @license http://www.opensource.org/licenses/bsd-license.php New BSD License\n */\nnamespace dosamigos\\datepicker;\n\nuse yii\\web\\AssetBundle;\n\n/**\n * DatePickerLanguageAsset\n *\n * @author Antonio Ramirez <amigo.cobos@gmail.com>\n * @link http://www.ramirezcobos.com/\n * @link http://www.2amigos.us/\n * @package dosamigos\\datepicker\n */\nclass DatePickerLanguageAsset extends AssetBundle\n{\n    public $sourcePath = '@bower/bootstrap-datepicker/dist/locales';\n\n    public $depends = [\n        'dosamigos\\datepicker\\DateRangePickerAsset'\n    ];\n}\n"
  },
  {
    "path": "src/DatePickerTrait.php",
    "content": "<?php\n/**\n * @copyright Copyright (c) 2013-2016 2amigOS! Consulting Group LLC\n * @link http://2amigos.us\n * @license http://www.opensource.org/licenses/bsd-license.php New BSD License\n */\nnamespace dosamigos\\datepicker;\n\n/**\n * DatePickerTrait holds common attributes\n *\n * @author Antonio Ramirez <amigo.cobos@gmail.com>\n * @link http://www.ramirezcobos.com/\n * @link http://www.2amigos.us/\n * @package dosamigos\\datepicker\n */\ntrait DatePickerTrait\n{\n    /**\n     * @var string the language to use\n     */\n    public $language;\n    /**\n     * @var array the options for the Bootstrap DatePicker plugin.\n     * Please refer to the Bootstrap DatePicker plugin Web page for possible options.\n     * @see http://bootstrap-datepicker.readthedocs.org/en/release/options.html\n     */\n    public $clientOptions = [];\n    /**\n     * @var array the event handlers for the underlying Bootstrap DatePicker plugin.\n     * Please refer to the [DatePicker](http://bootstrap-datepicker.readthedocs.org/en/release/events.html) plugin\n     * Web page for possible events.\n     */\n    public $clientEvents = [];\n    /**\n     * @var string the size of the input ('lg', 'md', 'sm', 'xs')\n     */\n    public $size;\n    /**\n     * @var array HTML attributes to render on the container\n     */\n    public $containerOptions = [];\n}\n"
  },
  {
    "path": "src/DateRangePicker.php",
    "content": "<?php\n/**\n * @copyright Copyright (c) 2013-2016 2amigOS! Consulting Group LLC\n * @link http://2amigos.us\n * @license http://www.opensource.org/licenses/bsd-license.php New BSD License\n */\nnamespace dosamigos\\datepicker;\n\nuse yii\\base\\InvalidConfigException;\nuse yii\\helpers\\Html;\nuse yii\\helpers\\Json;\nuse yii\\widgets\\InputWidget;\n\n/**\n * DateRangePicker renders a DatePicker range input.\n *\n * @author Antonio Ramirez <amigo.cobos@gmail.com>\n * @link http://www.ramirezcobos.com/\n * @link http://www.2amigos.us/\n * @package dosamigos\\datepicker\n */\nclass DateRangePicker extends InputWidget\n{\n    use DatePickerTrait;\n\n    /**\n     * @var string the attribute name for date range (to Date)\n     */\n    public $attributeTo;\n    /**\n     * @var string the name for date range (to Date)\n     */\n    public $nameTo;\n    /**\n     * @var string the value for date range (to Date value)\n     */\n    public $valueTo;\n    /**\n     * @var array HTML attributes for the date to input\n     */\n    public $optionsTo;\n    /**\n     * @var string the label to. Defaults to 'to'.\n     */\n    public $labelTo = 'to';\n    /**\n     * @var \\yii\\widgets\\ActiveForm useful for client validation of attributeTo\n     */\n    public $form;\n    /**\n     * @var string the template to render. Used internally.\n     */\n    protected $_template = '{inputFrom}<span class=\"input-group-addon\">{labelTo}</span>{inputTo}';\n\n\n    /**\n     * @inheritdoc\n     * @throws \\yii\\base\\InvalidConfigException\n     */\n    public function init()\n    {\n        parent::init();\n        if ((!$this->hasModel() && $this->nameTo === null) || ($this->hasModel() && $this->attributeTo === null)) {\n            // @codeCoverageIgnoreStart\n            throw new InvalidConfigException(\"Either 'nameTo', or 'model' and 'attributeTo' properties must be specified.\");\n            // @codeCoverageIgnoreEnd\n        }\n        if ($this->size) {\n            Html::addCssClass($this->options, 'input-' . $this->size);\n            Html::addCssClass($this->optionsTo, 'input-' . $this->size);\n            Html::addCssClass($this->containerOptions, 'input-group-' . $this->size);\n        }\n        Html::addCssClass($this->containerOptions, 'input-group input-daterange');\n        Html::addCssClass($this->options, 'form-control');\n        Html::addCssClass($this->optionsTo, 'form-control');\n    }\n\n    /**\n     * @inheritdoc\n     */\n    public function run()\n    {\n        if ($this->form) {\n            Html::addCssClass($this->options, 'datepicker-from');\n            Html::addCssClass($this->optionsTo, 'datepicker-to');\n            $inputFrom = $this->form->field(\n                $this->model,\n                $this->attribute,\n                [\n                    'template' => '{input}{error}',\n                    'options' => ['class' => 'input-group datepicker-range'],\n                ]\n            )->textInput($this->options);\n            $inputTo = $this->form->field(\n                $this->model,\n                $this->attributeTo,\n                [\n                    'template' => '{input}{error}',\n                    'options' => ['class' => 'input-group datepicker-range'],\n                ]\n            )->textInput($this->optionsTo);\n        } else {\n            $inputFrom = $this->hasModel()\n                ? Html::activeTextInput($this->model, $this->attribute, $this->options)\n                : Html::textInput($this->name, $this->value, $this->options);\n            $inputTo = $this->hasModel()\n                ? Html::activeTextInput($this->model, $this->attributeTo, $this->optionsTo)\n                : Html::textInput($this->nameTo, $this->valueTo, $this->optionsTo);\n        }\n        echo Html::tag(\n            'div',\n            strtr(\n                $this->_template,\n                ['{inputFrom}' => $inputFrom, '{labelTo}' => $this->labelTo, '{inputTo}' => $inputTo]\n            ), $this->containerOptions);\n\n        $this->registerClientScript();\n    }\n\n    /**\n     * Registers required script for the plugin to work as DateRangePicker\n     */\n    public function registerClientScript()\n    {\n        $js = [];\n        $view = $this->getView();\n\n        // @codeCoverageIgnoreStart\n        if($this->language !== null) {\n            $this->clientOptions['language'] = $this->language;\n            DatePickerLanguageAsset::register($view)->js[] = 'bootstrap-datepicker.' . $this->language . '.min.js';\n        } else {\n            DateRangePickerAsset::register($view);\n        }\n        // @codeCoverageIgnoreEnd\n\n        $id = $this->options['id'];\n        $selector = \";jQuery('#$id').parent()\";\n        if($this->form && $this->hasModel()) {\n            // @codeCoverageIgnoreStart\n            $selector .= '.parent()';\n            $class = \"field-\" . Html::getInputId($this->model, $this->attribute);\n            $js[] = \"$selector.closest('.$class').removeClass('$class');\";\n            // @codeCoverageIgnoreEnd\n        }\n\n        $options = !empty($this->clientOptions) ? Json::encode($this->clientOptions) : '';\n\n        $js[] = \"$selector.datepicker($options);\";\n\n        // @codeCoverageIgnoreStart\n        if (!empty($this->clientEvents)) {\n            foreach ($this->clientEvents as $event => $handler) {\n                $js[] = \"$selector.on('$event', $handler);\";\n            }\n        }\n        // @codeCoverageIgnoreEnd\n        $view->registerJs(implode(\"\\n\", $js));\n    }\n\n}\n"
  },
  {
    "path": "src/DateRangePickerAsset.php",
    "content": "<?php\n/**\n * @copyright Copyright (c) 2013-2016 2amigOS! Consulting Group LLC\n * @link http://2amigos.us\n * @license http://www.opensource.org/licenses/bsd-license.php New BSD License\n */\nnamespace dosamigos\\datepicker;\n\nuse yii\\web\\AssetBundle;\n\n/**\n * DateRangePickerAsset\n *\n * @author Antonio Ramirez <amigo.cobos@gmail.com>\n * @link http://www.ramirezcobos.com/\n * @link http://www.2amigos.us/\n * @package dosamigos\\datepicker\n */\nclass DateRangePickerAsset extends AssetBundle\n{\n    public $sourcePath = '@vendor/2amigos/yii2-date-picker-widget/src/assets';\n\n    public $css = [\n        'css/bootstrap-daterangepicker.css'\n    ];\n\n    public $depends = [\n        'dosamigos\\datepicker\\DatePickerAsset'\n    ];\n\n}\n"
  },
  {
    "path": "src/assets/css/bootstrap-daterangepicker.css",
    "content": "/*!\n * Custom styling. Removing padding when using DateRangePicker.\n */\n.datepicker {\n    z-index: 1151 !important;\n}\n\n.datepicker-range {\n    padding: 0 !important;\n    border: 0 !important;\n    text-align: left !important;\n}\n\n.datepicker-from {\n    border-radius: 4px !important;\n    border-top-right-radius: 0 !important;\n    border-bottom-right-radius: 0 !important;\n    text-align: left !important;\n}\n\n.datepicker-to {\n    border-radius: 4px !important;\n    border-top-left-radius: 0 !important;\n    border-bottom-left-radius: 0 !important;\n    text-align: left !important;\n}\n\ndiv.datepicker-range {\n    width: 100%;\n}\n"
  },
  {
    "path": "tests/functional/AssetManager.php",
    "content": "<?php\n/**\n * @link https://github.com/2amigos/yii2-date-picker-widget\n * @copyright Copyright (c) 2013-2016 2amigOS! Consulting Group LLC\n * @license http://opensource.org/licenses/BSD-3-Clause\n */\n\nnamespace tests;\n\n/**\n * AssetManager\n */\nclass AssetManager extends \\yii\\web\\AssetManager\n{\n    private $_hashes = [];\n    private $_counter = 0;\n\n    /**\n     * @inheritdoc\n     */\n    public function hash($path) {\n        if (!isset($this->_hashes[$path])) {\n            $this->_hashes[$path] = $this->_counter++;\n        }\n\n        return $this->_hashes[$path];\n    }\n}\n"
  },
  {
    "path": "tests/functional/DatePickerAssetTest.php",
    "content": "<?php\n\nnamespace tests;\n\n\nuse dosamigos\\datepicker\\DatePickerAsset;\nuse yii\\web\\AssetBundle;\n\nclass DatePickerAssetTest extends TestCase\n{\n    public function testRegister()\n    {\n        $view = $this->getView();\n        $this->assertEmpty($view->assetBundles);\n        DatePickerAsset::register($view);\n        $this->assertEquals(4, count($view->assetBundles));\n        $this->assertArrayHasKey('yii\\\\web\\\\JqueryAsset', $view->assetBundles);\n        $this->assertTrue($view->assetBundles['dosamigos\\\\datepicker\\\\DatePickerAsset'] instanceof AssetBundle);\n        $content = $view->render('//layouts/rawlayout.php');\n        $this->assertContains('jquery.js', $content);\n        $this->assertContains('bootstrap.js', $content);\n        $this->assertContains('bootstrap-datepicker.js', $content);\n        $this->assertContains('bootstrap-datepicker3.css', $content);\n\n    }\n}\n"
  },
  {
    "path": "tests/functional/DatePickerLanguageAssetTest.php",
    "content": "<?php\n\nnamespace tests;\n\n\nuse tests\\overrides\\TestDatePickerLanguageAsset;\nuse yii\\web\\AssetBundle;\n\nclass DatePickerLanguageAssetTest extends TestCase\n{\n    public function testRegister()\n    {\n        $view = $this->getView();\n        $this->assertEmpty($view->assetBundles);\n        TestDatePickerLanguageAsset::register($view)->js[] = 'bootstrap-datepicker.es.min.js';\n        $this->assertEquals(6, count($view->assetBundles));\n        $this->assertTrue($view->assetBundles['tests\\overrides\\TestDatePickerLanguageAsset'] instanceof AssetBundle);\n        $content = $view->render('//layouts/rawlayout.php');\n        $this->assertContains('jquery.js', $content);\n        $this->assertContains('bootstrap-datepicker.es.min.js', $content);\n\n    }\n}\n"
  },
  {
    "path": "tests/functional/DatePickerTest.php",
    "content": "<?php\n\nnamespace tests;\n\n\nuse dosamigos\\datepicker\\DatePicker;\nuse tests\\models\\Post;\nuse tests\\overrides\\TestDatePicker;\nuse yii\\web\\JsExpression;\nuse yii\\web\\View;\nuse Yii;\n\nclass DatePickerTest extends TestCase\n{\n\n    public function testRenderWithModel()\n    {\n        $model = new Post();\n        $model->create_time = 1425807308;\n        $out = DatePicker::widget([\n            'model' => $model,\n            'attribute' => 'create_time'\n        ]);\n        $expected = '<div class=\"input-group date\"><input type=\"text\" id=\"post-create_time\" class=\"form-control\" name=\"Post[create_time]\" value=\"1425807308\"><span class=\"input-group-addon\"><i class=\"glyphicon glyphicon-calendar\"></i></span></div>';\n\n        $this->assertEqualsWithoutLE($expected, $out);\n    }\n\n    public function testRenderWithNameAndValue()\n    {\n        $out = DatePicker::widget([\n            'id' => 'test',\n            'name' => 'test-editor-name',\n            'value' => '02-16-2012'\n        ]);\n        $expected = '<div class=\"input-group date\"><input type=\"text\" id=\"test\" class=\"form-control\" name=\"test-editor-name\" value=\"02-16-2012\"><span class=\"input-group-addon\"><i class=\"glyphicon glyphicon-calendar\"></i></span></div>';\n\n        $this->assertEqualsWithoutLE($expected, $out);\n    }\n\n    public function testRenderInline()\n    {\n        $out = DatePicker::widget([\n            'id' => 'test',\n            'name' => 'test-editor-name',\n            'value' => 'test-editor-value',\n            'inline' => true\n        ]);\n        $expected = '<input type=\"text\" id=\"test\" class=\"text-center form-control\" name=\"test-editor-name\" value=\"test-editor-value\" readonly=\"readonly\"><div></div>';\n\n        $this->assertEqualsWithoutLE($expected, $out);\n    }\n\n    public function testRenderWithSize()\n    {\n        $out = DatePicker::widget([\n            'id' => 'test',\n            'name' => 'test-editor-name',\n            'value' => 'test-editor-value',\n            'size' => 'lg'\n        ]);\n        $expected = '<div class=\"input-group-lg input-group date\"><input type=\"text\" id=\"test\" class=\"input-lg form-control\" name=\"test-editor-name\" value=\"test-editor-value\"><span class=\"input-group-addon\"><i class=\"glyphicon glyphicon-calendar\"></i></span></div>';\n\n        $this->assertEqualsWithoutLE($expected, $out);\n    }\n\n\n    public function testDatePickerRegisterPluginScriptMethod()\n    {\n        $class = new \\ReflectionClass('tests\\\\overrides\\\\TestDatePicker');\n        $method = $class->getMethod('registerClientScript');\n        $method->setAccessible(true);\n\n        $model = new Post();\n        $model->create_time = 1425807308;\n\n        $widget = TestDatePicker::begin(\n            [\n                'model' => $model,\n                'attribute' => 'create_time',\n                'language' => 'es',\n                'clientEvents' => [\n                    'changeDate' => new JsExpression('function(ev){console.log(ev);}')\n                ]\n            ]\n        );\n        $class->getProperty('language')->setValue($widget, 'es');\n        $view = $this->getView();\n        $widget->setView($view);\n        $method->invoke($widget);\n\n        $test = <<<JS\n;jQuery('#post-create_time').parent().datepicker({\"language\":\"es\"});\n;jQuery('#post-create_time').parent().on('changeDate', function(ev){console.log(ev);});\nJS;\n        $this->assertEquals($test, $view->js[View::POS_READY]['test-datepicker-js']);\n    }\n\n    public function testWidget()\n    {\n        $model = new Post();\n        $view = Yii::$app->getView();\n        $content = $view->render('//datepicker-widget', ['model' => $model]);\n        $actual = $view->render('//layouts/main', ['content' => $content]);\n        $expected = file_get_contents(__DIR__ . '/data/test-datepicker-widget.bin');\n        $this->assertEquals($expected, $actual);\n    }\n}\n"
  },
  {
    "path": "tests/functional/DateRangePickerAssetTest.php",
    "content": "<?php\n\nnamespace tests;\n\nuse tests\\overrides\\TestDateRangePickerAsset;\nuse yii\\web\\AssetBundle;\n\nclass DateRangePickerAssetTest extends TestCase\n{\n    public function testRegister()\n    {\n        $view = $this->getView();\n        $this->assertEmpty($view->assetBundles);\n        TestDateRangePickerAsset::register($view);\n        $this->assertEquals(5, count($view->assetBundles));\n        $this->assertArrayHasKey('yii\\\\web\\\\JqueryAsset', $view->assetBundles);\n        $this->assertTrue($view->assetBundles['tests\\\\overrides\\\\TestDateRangePickerAsset'] instanceof AssetBundle);\n        $content = $view->render('//layouts/rawlayout.php');\n        $this->assertContains('jquery.js', $content);\n        $this->assertContains('bootstrap.js', $content);\n        $this->assertContains('bootstrap-daterangepicker.css', $content);\n\n    }\n}\n"
  },
  {
    "path": "tests/functional/DateRangePickerTest.php",
    "content": "<?php\n\nnamespace tests;\n\nuse Yii;\nuse dosamigos\\datepicker\\DateRangePicker;\nuse tests\\models\\Post;\nuse tests\\overrides\\TestDateRangePicker;\nuse yii\\bootstrap\\ActiveForm;\nuse yii\\web\\JsExpression;\nuse yii\\web\\View;\n\nclass DateRangePickerTest extends TestCase\n{\n\n    public function testRenderWithModel()\n    {\n        $model = new Post();\n        $out = TestDateRangePicker::widget([\n            'form' => new ActiveForm(),\n            'model' => $model,\n            'attribute' => 'date_from',\n            'attributeTo' => 'date_to'\n        ]);\n        $expected = '<div class=\"input-group input-daterange\"><div class=\"input-group datepicker-range field-post-date_from\">\n<input type=\"text\" id=\"post-date_from\" class=\"form-control datepicker-from\" name=\"Post[date_from]\"><p class=\"help-block help-block-error\"></p>\n</div><span class=\"input-group-addon\">to</span><div class=\"input-group datepicker-range field-post-date_to\">\n<input type=\"text\" id=\"post-date_to\" class=\"form-control datepicker-to\" name=\"Post[date_to]\"><p class=\"help-block help-block-error\"></p>\n</div></div>';\n\n        $this->assertEqualsWithoutLE($expected, $out);\n    }\n\n    public function testRenderWithNameAndValue()\n    {\n        $out = TestDateRangePicker::widget([\n            'name' => 'name_from',\n            'value' => '02-16-2015',\n            'nameTo' => 'name_to',\n            'valueTo' => '02-18-2015'\n        ]);\n        $expected = '<div class=\"input-group input-daterange\"><input type=\"text\" id=\"w1\" class=\"form-control\" name=\"name_from\" value=\"02-16-2015\"><span class=\"input-group-addon\">to</span><input type=\"text\" class=\"form-control\" name=\"name_to\" value=\"02-18-2015\"></div>';\n\n        $this->assertEqualsWithoutLE($expected, $out);\n    }\n\n\n    public function testRenderWithSize()\n    {\n        $out = TestDateRangePicker::widget([\n            'name' => 'name_from',\n            'value' => '02-16-2015',\n            'nameTo' => 'name_to',\n            'valueTo' => '02-18-2015',\n            'size' => 'lg'\n        ]);\n        $expected = '<div class=\"input-group-lg input-group input-daterange\"><input type=\"text\" id=\"w2\" class=\"input-lg form-control\" name=\"name_from\" value=\"02-16-2015\"><span class=\"input-group-addon\">to</span><input type=\"text\" class=\"input-lg form-control\" name=\"name_to\" value=\"02-18-2015\"></div>';\n\n        $this->assertEqualsWithoutLE($expected, $out);\n    }\n\n    public function testWrongConfig() {\n        $this->setExpectedException('yii\\base\\InvalidConfigException');\n        $out = DateRangePicker::begin([]);\n    }\n\n\n    public function testDateRangePickerRegisterPluginScriptMethod()\n    {\n        $class = new \\ReflectionClass('tests\\\\overrides\\\\TestDateRangePicker');\n        $method = $class->getMethod('registerClientScript');\n        $method->setAccessible(true);\n\n        $model = new Post();\n        $model->create_time = 1425807308;\n\n        $widget = TestDateRangePicker::begin(\n            [\n                'form' => new ActiveForm(),\n                'model' => $model,\n                'attribute' => 'date_from',\n                'attributeTo' => 'date_to',\n                'language' => 'es',\n                'clientEvents' => [\n                    'changeDate' => new JsExpression('function(ev){console.log(ev);}')\n                ]\n            ]\n        );\n        $class->getProperty('language')->setValue($widget, 'es');\n        $view = $this->getView();\n        $widget->setView($view);\n        $method->invoke($widget);\n\n        $test = <<<JS\n;jQuery('#post-date_from').parent().parent().closest('.field-post-date_from').removeClass('field-post-date_from');\n;jQuery('#post-date_from').parent().parent().datepicker({\"language\":\"es\"});\n;jQuery('#post-date_from').parent().parent().on('changeDate', function(ev){console.log(ev);});\nJS;\n        $this->assertEquals($test, $view->js[View::POS_READY]['test-daterangepicker-js']);\n    }\n\n    public function testWidget()\n    {\n        $model = new Post();\n        $view = Yii::$app->getView();\n        $content = $view->render('//daterangepicker-widget', ['model' => $model]);\n        $actual = $view->render('//layouts/main', ['content' => $content]);\n        $expected = file_get_contents(__DIR__ . '/data/test-daterangepicker-widget.bin');\n        $this->assertEquals($expected, $actual);\n    }\n}\n"
  },
  {
    "path": "tests/functional/TestCase.php",
    "content": "<?php\n\nnamespace tests;\n\nuse yii\\helpers\\ArrayHelper;\nuse yii\\web\\View;\n\n/**\n * This is the base class for all tests.\n */\nabstract class TestCase extends \\PHPUnit_Framework_TestCase\n{\n    public static $params;\n\n    /**\n     * Mock application prior running tests.\n     */\n    protected function setUp()\n    {\n        $this->mockWebApplication(\n            [\n                'components' => [\n                    'request' => [\n                        'class' => 'yii\\web\\Request',\n                        'url' => '/test',\n                        'enableCsrfValidation' => false,\n                    ],\n                    'response' => [\n                        'class' => 'yii\\web\\Response',\n                    ],\n                ],\n            ]\n        );\n    }\n\n    /**\n     * Clean up after test.\n     * By default the application created with [[mockApplication]] will be destroyed.\n     */\n    protected function tearDown()\n    {\n        parent::tearDown();\n        $this->destroyApplication();\n    }\n\n    protected function mockApplication($config = [], $appClass = '\\yii\\console\\Application')\n    {\n        new $appClass(\n            ArrayHelper::merge(\n                [\n                    'id' => 'testapp',\n                    'basePath' => __DIR__,\n                    'vendorPath' => $this->getVendorPath(),\n                ],\n                $config\n            )\n        );\n    }\n\n    protected function mockWebApplication($config = [], $appClass = '\\yii\\web\\Application')\n    {\n        new $appClass(ArrayHelper::merge([\n            'id' => 'testapp',\n            'basePath' => __DIR__,\n            'vendorPath' => $this->getVendorPath(),\n            'components' => [\n                'request' => [\n                    'cookieValidationKey' => 'wefJDF8sfdsfSDefwqdxj9oq',\n                    'scriptFile' => __DIR__ .'/index.php',\n                    'scriptUrl' => '/index.php',\n                ],\n                'assetManager' => [\n                    'class' => 'tests\\AssetManager',\n                    'basePath' => '@tests/assets',\n                    'baseUrl' => '/',\n                ]\n            ]\n        ], $config));\n    }\n\n    protected function getVendorPath()\n    {\n        return dirname(dirname(__DIR__)) . '/vendor';\n    }\n\n    /**\n     * Destroys application in Yii::$app by setting it to null.\n     */\n    protected function destroyApplication()\n    {\n        \\Yii::$app = null;\n    }\n\n    /**\n     * Creates a view for testing purposes\n     *\n     * @return View\n     */\n    protected function getView()\n    {\n        $view = new View();\n        $view->setAssetManager(new AssetManager([\n            'basePath' => '@tests/assets',\n            'baseUrl' => '/',\n        ]));\n        return $view;\n    }\n\n    /**\n     * Asserting two strings equality ignoring line endings\n     *\n     * @param string $expected\n     * @param string $actual\n     */\n    public function assertEqualsWithoutLE($expected, $actual)\n    {\n        $expected = str_replace(\"\\r\\n\", \"\\n\", $expected);\n        $actual = str_replace(\"\\r\\n\", \"\\n\", $actual);\n        $this->assertEquals($expected, $actual);\n    }\n}\n"
  },
  {
    "path": "tests/functional/assets/.gitignore",
    "content": "*\n!.gitignore\n"
  },
  {
    "path": "tests/functional/bootstrap.php",
    "content": "<?php\nerror_reporting(-1);\ndefine('YII_ENABLE_ERROR_HANDLER', false);\ndefine('YII_DEBUG', true);\n$_SERVER['SCRIPT_NAME'] = '/' . __DIR__;\n$_SERVER['SCRIPT_FILENAME'] = __FILE__;\nrequire_once(__DIR__ . '/../../vendor/autoload.php');\nrequire_once(__DIR__ . '/../../vendor/yiisoft/yii2/Yii.php');\nYii::setAlias('@tests', __DIR__);\nrequire_once(__DIR__ . '/TestCase.php');\n"
  },
  {
    "path": "tests/functional/models/Post.php",
    "content": "<?php\n\nnamespace tests\\models;\n\n\nuse yii\\db\\ActiveRecord;\n\nclass Post extends ActiveRecord\n{\n    public $date_from;\n    public $date_to;\n    public $create_time;\n\n    public static $db;\n\n    public static function getDb()\n    {\n        return self::$db;\n    }\n}\n"
  },
  {
    "path": "tests/functional/overrides/TestDatePicker.php",
    "content": "<?php\nnamespace tests\\overrides;\n\nuse dosamigos\\datepicker\\DatePicker;\nuse dosamigos\\datepicker\\DatePickerAsset;\nuse yii\\helpers\\Json;\nuse yii\\web\\View;\n\nclass TestDatePicker extends DatePicker\n{\n    /**\n     * Registers required script for the plugin to work as a DateTimePicker\n     */\n    public function registerClientScript()\n    {\n\n        $view = $this->getView();\n\n        if ($this->language !== null) {\n            $this->clientOptions['language'] = $this->language;\n            DatePickerAsset::register($view)->js[] = 'js/locales/bootstrap-datepicker.' . $this->language . '.js';\n        } else {\n            DatePickerAsset::register($view);\n        }\n\n        $id = $this->options['id'];\n        $selector = \";jQuery('#$id')\";\n\n        if ($this->addon || $this->inline) {\n            $selector .= \".parent()\";\n        }\n\n        $options = !empty($this->clientOptions) ? Json::encode($this->clientOptions) : '';\n\n        if ($this->inline) {\n            $this->clientEvents['changeDate'] = \"function (e){ jQuery('#$id').val(e.format());}\";\n        }\n\n        $js[] = \"$selector.datepicker($options);\";\n\n        if (!empty($this->clientEvents)) {\n            foreach ($this->clientEvents as $event => $handler) {\n                $js[] = \"$selector.on('$event', $handler);\";\n            }\n        }\n        $view->registerJs(implode(\"\\n\", $js), View::POS_READY, 'test-datepicker-js');\n    }\n}\n"
  },
  {
    "path": "tests/functional/overrides/TestDatePickerLanguageAsset.php",
    "content": "<?php\n\nnamespace tests\\overrides;\n\nuse dosamigos\\datepicker\\DatePickerLanguageAsset;\n\nclass TestDatePickerLanguageAsset extends DatePickerLanguageAsset\n{\n    public $depends = [\n        'tests\\overrides\\TestDateRangePickerAsset'\n    ];\n}\n"
  },
  {
    "path": "tests/functional/overrides/TestDateRangePicker.php",
    "content": "<?php\nnamespace tests\\overrides;\n\nuse dosamigos\\datepicker\\DateRangePicker;\nuse yii\\helpers\\Html;\nuse yii\\helpers\\Json;\nuse yii\\web\\View;\n\nclass TestDateRangePicker extends DateRangePicker\n{\n    /**\n     * Registers required script for the plugin to work as a DateTimePicker\n     */\n    public function registerClientScript()\n    {\n\n        $view = $this->getView();\n\n        if($this->language !== null) {\n            $this->clientOptions['language'] = $this->language;\n            TestDatePickerLanguageAsset::register($view)->js[] = 'bootstrap-datepicker.' . $this->language . '.min.js';\n        } else {\n            TestDateRangePickerAsset::register($view);\n        }\n\n        $id = $this->options['id'];\n        $selector = \";jQuery('#$id').parent()\";\n        if($this->form && $this->hasModel()) {\n            $selector .= '.parent()';\n            $class = \"field-\" . Html::getInputId($this->model, $this->attribute);\n            $js[] = \"$selector.closest('.$class').removeClass('$class');\";\n        }\n\n        $options = !empty($this->clientOptions) ? Json::encode($this->clientOptions) : '';\n\n        $js[] = \"$selector.datepicker($options);\";\n\n        if (!empty($this->clientEvents)) {\n            foreach ($this->clientEvents as $event => $handler) {\n                $js[] = \"$selector.on('$event', $handler);\";\n            }\n        }\n        $view->registerJs(implode(\"\\n\", $js), View::POS_READY, 'test-daterangepicker-js');\n    }\n}\n"
  },
  {
    "path": "tests/functional/overrides/TestDateRangePickerAsset.php",
    "content": "<?php\n/**\n *\n * TestDateRangePickerAssset.php\n *\n * Date: 20/03/15\n * Time: 13:38\n * @author Antonio Ramirez <amigo.cobos@gmail.com>\n * @link http://www.ramirezcobos.com/\n * @link http://www.2amigos.us/\n */\n\nnamespace tests\\overrides;\n\n\nuse dosamigos\\datepicker\\DateRangePickerAsset;\n\nclass TestDateRangePickerAsset extends DateRangePickerAsset\n{\n    public $sourcePath = '@tests/../../src/assets';\n}\n"
  },
  {
    "path": "tests/functional/views/datepicker-widget.php",
    "content": "<?php\n\nuse dosamigos\\datepicker\\DatePicker;\n\n/* @var $this yii\\web\\View */\n/* @var $model tests\\models\\Post */\n?>\n\n<?= DatePicker::widget([\n    'model' => $model,\n    'attribute' => 'create_time',\n]) ?>\n"
  },
  {
    "path": "tests/functional/views/daterangepicker-widget.php",
    "content": "<?php\nuse tests\\overrides\\TestDateRangePicker;\n\n/* @var $this yii\\web\\View */\n/* @var $model tests\\models\\Post */\n?>\n\n<?= TestDateRangePicker::widget([\n    'model' => $model,\n    'attribute' => 'date_from',\n    'attributeTo' => 'date_to'\n]) ?>\n"
  },
  {
    "path": "tests/functional/views/layouts/main.php",
    "content": "<?php\n/* @var $this \\yii\\web\\View */\n/* @var $content string */\n?>\n\n<?php $this->beginPage() ?>\n<!DOCTYPE html>\n<html>\n<head>\n<?php $this->head() ?>\n</head>\n<body>\n<?php $this->beginBody() ?>\n<?= $content ?>\n<?php $this->endBody() ?>\n</body>\n</html>\n<?php $this->endPage() ?>\n"
  },
  {
    "path": "tests/functional/views/layouts/rawlayout.php",
    "content": "<?php\n/* @var $this \\yii\\web\\View */\n?><?php $this->beginPage(); ?>1<?php $this->head(); ?>2<?php $this->beginBody(); ?>3<?php $this->endBody(); ?>4<?php $this->endPage(); ?>\n"
  }
]