Source of file InputPassword.php

Size: 1,171 Bytes - Last Modified: 2015-12-22T09:42:40-05:00

../src/View/Helper/InputPassword.php

1234567891011121314151617181920212223242526272829303132333435
Covered by 1 test(s):
  • MvcLite\ViewHelperInputPasswordTest::testRender with data set #0
36
Covered by 1 test(s):
  • MvcLite\ViewHelperInputPasswordTest::testRender with data set #0
37
Covered by 1 test(s):
  • MvcLite\ViewHelperInputPasswordTest::testRender with data set #0
3839
Covered by 1 test(s):
  • MvcLite\ViewHelperInputPasswordTest::testRender with data set #0
40
Covered by 1 test(s):
  • MvcLite\ViewHelperInputPasswordTest::testRender with data set #0
41
Covered by 1 test(s):
  • MvcLite\ViewHelperInputPasswordTest::testRender with data set #0
42
Covered by 1 test(s):
  • MvcLite\ViewHelperInputPasswordTest::testRender with data set #0
43
Covered by 1 test(s):
  • MvcLite\ViewHelperInputPasswordTest::testRender with data set #0
444546
<?php
/**
 * Password Input View Helper
 *
 * @category    MvcLite
 * @package     Lib
 * @subpackage  View_Helper
 * @since       File available since release 1.1.x
 * @author      Cory Collier <corycollier@corycollier.com>
 */

namespace MvcLite\View\Helper;

use MvcLite\View\Helper\InputElementAbstract as InputElementAbstract;

/**
 * Password Input View Helper class
 *
 * @category    MvcLite
 * @package     Lib
 * @subpackage  View_Helper
 * @since       Class available since release 1.1.x
 * @author      Cory Collier <corycollier@corycollier.com>
 */
class InputPassword extends InputElementAbstract
{
    /**
     * method to render a input[type=password] element
     *
     * @param array $attribs
     * @return string
     */
    public function render($name, $attribs = [])
    {
        $defaults = $this->getDefaultAttribs($name, 'password');
        $attribs  = array_merge($defaults, $attribs);
        $template = $this->getStandardTemplate();

        return strtr($template, [
            '!id'       => $attribs['id'],
            '!label'    => $attribs['label'],
            '!attribs'  => $this->getHtmlAttribs($attribs),
        ]);
    }
}