<commit_before><?php
/**
 *
 * Licensed under The MIT License
 * For full copyright and license information, please see the LICENSE file
 * Redistributions of files must retain the above copyright notice.
 * You may obtain a copy of the License at
 *
 *     https://opensource.org/licenses/mit-license.php
 *
 *
 * @copyright Copyright (c) <NAME> (https://typename.fr)
 * @license https://opensource.org/licenses/mit-license.php MIT License
 */
namespace Bootstrap\View\Helper;

use Cake\View\Helper;

/**
 * Modal helper library.
 *
 * Automatic generation of Bootstrap HTML modals.
 *
 * @property \Bootstrap\View\Helper\BootstrapHtmlHelper $Html
 */
class BootstrapModalHelper extends Helper {

    use \Cake\View\StringTemplateTrait;
    use EasyIconTrait;
    use BootstrapTrait;

    /**
     * Other helpers used by BootstrapModalHelper.
     *
     * @var array
     */
    public $helpers = [
        'Html' => [
            'className' => 'BootstrapBootstrapHtml'
        ]
    ];

    /**
     * Default configuration for the BootstrapModalHelper.
     *
     * @var array
     */
    public $_defaultConfig = [
        'templates' => [
            'modalStart' => '<div class="modal fade{{attrs.class}}" tabindex="-1" role="dialog"{{attrs}}>{{dialogStart}}{{contentStart}}',
            'modalEnd' => '{{contentEnd}}{{dialogEnd}}</div>',
            'modalDialogStart' => '<div class="modal-dialog{{attrs.class}}" role="document"{{attrs}}>',
            'modalDialogEnd' => '</div>',
            'modalContentStart' => '<div class="modal-content{{attrs.class}}"{{attrs}}>',
            'modalContentEnd' => '</div>',
            'headerStart' => '<div class="modal-header{{attrs.class}}"{{attrs}}>',
            'headerEnd' => '</div>',
            'modalHeaderCloseButton' =>
                '<button type="button" class="close{{attrs.class}}" data-dismiss="modal" aria-label="{{label}}"{{attrs}}>{{content}}</button>',
            'modalHeaderCloseContent' => '<span aria-hidden="true">&times;</span>',
            'modalTitle' => '<h4 class="modal-title{{attrs.class}}"{{attrs}}>{{content}}</h4>',
            'bodyStart' => '<div class="modal-body{{attrs.class}}"{{attrs}}>',
            'bodyEnd' => '</div>',
            'footerStart' => '<div class="modal-footer{{attrs.class}}"{{attrs}}>',
            'footerEnd' => '</div>',
            'modalFooterCloseButton' => '<button type="button" class="btn btn-default{{attrs.class}}" data-dismiss="modal"{{attrs}}>{{content}}</button>'
        ],
        'templateClass' => 'Bootstrap\View\BootstrapStringTemplate'
    ];

    /**
     * Current part of the modal(`null`, `'header'`, `'body'`, `'footer'`).
     *
     * @var string
     */
    protected $_current = null;

    /**
     * Current id of the modal.
     *
     * @var mixed
     */
    protected $_currentId = null;

    /**
     * Open a modal
     *
     * If `$title` is a string, the modal header is created using `$title` as its
     * content and default options.
     *
     * ```php
     * echo $this->Modal->create('My Modal Title');
     * ```
     *
     * If the modal header is created, the modal body is automatically opened after
     * it, except if the `body` options is specified(see below).
     *
     * If `$title` is an array, it is used as `$options`.
     *
     * ```php
     * echo $this->Modal->create(['class' => 'my-modal-class']);
     * ```
     *
     * ### Options
     *
     * - `body` If `$title` is a string, set to `false` to not open the body after
       * the panel header. Default is `true`.
     * - `close` Set to `false` to not add a close button to the modal. Default is `true`.
     * - `id` Identifier of the modal. If specified, a `aria-labelledby` HTML attribute
     * will be added to the modal and the header will be set accordingly.
     * - `size` Size of the modal. Either a shortcut(`'lg'`/`'large'`/`'modal-lg'` or
     *(`'sm'`/`'small'`/`'modal-sm'`) or `false`(no size specified) or a custom class.
     * Other options will be passed to the `Html::div` method for creating the
     * outer modal `<div>`.
     *
     * @param array|string $title The modal title or an array of options.
     * @param array $options Array of options. See above.
     *
     * @return An HTML string containing opening elements for a modal.
     */
    public function create($title = null, $options = []) {

        if(is_array($title)) {
            $options = $title;<commit_msg>[doc] Fix doc of create().<commit_after><?php
/**
 *
 * Licensed under The MIT License
 * For full copyright and license information, please see the LICENSE file
 * Redistributions of files must retain the above copyright notice.
 * You may obtain a copy of the License at
 *
 *     https://opensource.org/licenses/mit-license.php
 *
 *
 * @copyright Copyright (c) <NAME> (https://typename.fr)
 * @license https://opensource.org/licenses/mit-license.php MIT License
 */
namespace Bootstrap\View\Helper;

use Cake\View\Helper;

/**
 * Modal helper library.
 *
 * Automatic generation of Bootstrap HTML modals.
 *
 * @property \Bootstrap\View\Helper\BootstrapHtmlHelper $Html
 */
class BootstrapModalHelper extends Helper {

    use \Cake\View\StringTemplateTrait;
    use EasyIconTrait;
    use BootstrapTrait;

    /**
     * Other helpers used by BootstrapModalHelper.
     *
     * @var array
     */
    public $helpers = [
        'Html' => [
            'className' => 'BootstrapBootstrapHtml'
        ]
    ];

    /**
     * Default configuration for the BootstrapModalHelper.
     *
     * @var array
     */
    public $_defaultConfig = [
        'templates' => [
            'modalStart' => '<div class="modal fade{{attrs.class}}" tabindex="-1" role="dialog"{{attrs}}>{{dialogStart}}{{contentStart}}',
            'modalEnd' => '{{contentEnd}}{{dialogEnd}}</div>',
            'modalDialogStart' => '<div class="modal-dialog{{attrs.class}}" role="document"{{attrs}}>',
            'modalDialogEnd' => '</div>',
            'modalContentStart' => '<div class="modal-content{{attrs.class}}"{{attrs}}>',
            'modalContentEnd' => '</div>',
            'headerStart' => '<div class="modal-header{{attrs.class}}"{{attrs}}>',
            'headerEnd' => '</div>',
            'modalHeaderCloseButton' =>
                '<button type="button" class="close{{attrs.class}}" data-dismiss="modal" aria-label="{{label}}"{{attrs}}>{{content}}</button>',
            'modalHeaderCloseContent' => '<span aria-hidden="true">&times;</span>',
            'modalTitle' => '<h4 class="modal-title{{attrs.class}}"{{attrs}}>{{content}}</h4>',
            'bodyStart' => '<div class="modal-body{{attrs.class}}"{{attrs}}>',
            'bodyEnd' => '</div>',
            'footerStart' => '<div class="modal-footer{{attrs.class}}"{{attrs}}>',
            'footerEnd' => '</div>',
            'modalFooterCloseButton' => '<button type="button" class="btn btn-default{{attrs.class}}" data-dismiss="modal"{{attrs}}>{{content}}</button>'
        ],
        'templateClass' => 'Bootstrap\View\BootstrapStringTemplate'
    ];

    /**
     * Current part of the modal(`null`, `'header'`, `'body'`, `'footer'`).
     *
     * @var string
     */
    protected $_current = null;

    /**
     * Current id of the modal.
     *
     * @var mixed
     */
    protected $_currentId = null;

    /**
     * Open a modal
     *
     * If `$title` is a string, the modal header is created using `$title` as its
     * content and default options.
     *
     * ```php
     * echo $this->Modal->create('My Modal Title');
     * ```
     *
     * If the modal header is created, the modal body is automatically opened after
     * it, except if the `body` options is specified(see below).
     *
     * If `$title` is an array, it is used as `$options`.
     *
     * ```php
     * echo $this->Modal->create(['class' => 'my-modal-class']);
     * ```
     *
     * ### Options
     *
     * - `body` If `$title` is a string, set to `false` to not open the body after
       * the panel header. Default is `true`.
     * - `close` Set to `false` to not add a close button to the modal. Default is `true`.
     * - `id` Identifier of the modal. If specified, a `aria-labelledby` HTML attribute
     * will be added to the modal and the header will be set accordingly.
     * - `size` Size of the modal. Either a shortcut(`'lg'`/`'large'`/`'modal-lg'` or
     *(`'sm'`/`'small'`/`'modal-sm'`) or `false`(no size specified) or a custom class.
     * Other options will be passed to the `Html::div` method for creating the
     * outer modal `<div>`.
     *
     * @param array|string $title The modal title or an array of options.
     * @param array $options Array of options. See above.
     *
     * @return string An HTML string containing opening elements for a modal.
     */
    public function create($title = null, $options = []) {

        if(is_array($title)) {
            $options = $title;
{'fraction_non_alphanumeric': 0.1669652855543113, 'fraction_numerical': 0.0006718924972004479, 'mean_word_length': 2.626065773447016, 'pattern_counts': {'":': 0, '<': 49, '<?xml version=': 0, '>': 97, 'https://': 6, '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': '2544795', 'n_tokens_mistral': 2629, 'n_tokens_neox': 2616, 'n_words': 732}