Completed
Push — 1.10.x ( 3d9ba2...d7355d )
by
unknown
52:02
created

HTML_QuickForm_hidden::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 6
Ratio 100 %
Metric Value
dl 6
loc 6
rs 9.4285
cc 1
eloc 4
nc 1
nop 3
1
<?php
2
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
4
/**
5
 * HTML class for a hidden type element
6
 *
7
 * PHP versions 4 and 5
8
 *
9
 * LICENSE: This source file is subject to version 3.01 of the PHP license
10
 * that is available through the world-wide-web at the following URI:
11
 * http://www.php.net/license/3_01.txt If you did not receive a copy of
12
 * the PHP License and are unable to obtain it through the web, please
13
 * send a note to [email protected] so we can mail you a copy immediately.
14
 *
15
 * @category    HTML
16
 * @package     HTML_QuickForm
17
 * @author      Adam Daniel <[email protected]>
18
 * @author      Bertrand Mansion <[email protected]>
19
 * @copyright   2001-2009 The PHP Group
20
 * @license     http://www.php.net/license/3_01.txt PHP License 3.01
21
 * @version     CVS: $Id: hidden.php,v 1.12 2009/04/04 21:34:03 avb Exp $
22
 * @link        http://pear.php.net/package/HTML_QuickForm
23
 */
24
25
/**
26
 * HTML class for a hidden type element
27
 *
28
 * @category    HTML
29
 * @package     HTML_QuickForm
30
 * @author      Adam Daniel <[email protected]>
31
 * @author      Bertrand Mansion <[email protected]>
32
 * @version     Release: 3.2.11
33
 * @since       1.0
34
 */
35 View Code Duplication
class HTML_QuickForm_hidden extends HTML_QuickForm_input
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
36
{
37
    // {{{ constructor
38
39
    /**
40
     * Class constructor
41
     *
42
     * @param     string    $elementName    (optional)Input field name attribute
43
     * @param     string    $value          (optional)Input field value
44
     * @param     mixed     $attributes     (optional)Either a typical HTML attribute string
45
     *                                      or an associative array
46
     * @since     1.0
47
     * @access    public
48
     * @return    void
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
49
     */
50
    public function __construct($elementName = null, $value = '', $attributes = null)
51
    {
52
        parent::__construct($elementName, null, $attributes);
53
        $this->setType('hidden');
54
        $this->setValue($value);
55
    } //end constructor
56
57
    // }}}
58
    // {{{ freeze()
59
60
    /**
61
     * Freeze the element so that only its value is returned
62
     *
63
     * @access    public
64
     * @return    void
65
     */
66
    function freeze()
67
    {
68
        return false;
69
    } //end func freeze
70
71
    // }}}
72
    // {{{ accept()
73
74
   /**
75
    * Accepts a renderer
76
    *
77
    * @param HTML_QuickForm_Renderer    renderer object
78
    * @access public
79
    * @return void
80
    */
81
    //function accept(&$renderer)
82
    function accept(&$renderer, $required=false, $error=null)
83
    {
84
        $renderer->renderHidden($this);
85
    } // end func accept
86
87
    // }}}
88
89
} //end class HTML_QuickForm_hidden
90
?>
0 ignored issues
show
Best Practice introduced by
It is not recommended to use PHP's closing tag ?> in files other than templates.

Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore.

A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever.

Loading history...
91