Code Duplication    Length = 19-20 lines in 2 locations

Alpha/View/Widget/TextBox.php 1 location

@@ 113-132 (lines=20) @@
110
     *
111
     * @throws Alpha\Exception\IllegalArguementException
112
     */
113
    public function __construct($text, $label, $name, $rows = 5, $identifier = 0)
114
    {
115
        $config = ConfigProvider::getInstance();
116
117
        if ($text instanceof Text) {
118
            $this->textObject = $text;
119
        } else {
120
            throw new IllegalArguementException('Text object passed ['.var_export($text, true).'] is not a valid Text object!');
121
        }
122
123
        $this->label = $label;
124
        $this->rows = $rows;
125
        $this->identifier = $identifier;
126
127
        if ($config->get('security.encrypt.http.fieldnames')) {
128
            $this->name = base64_encode(SecurityUtils::encrypt($name));
129
        } else {
130
            $this->name = $name;
131
        }
132
    }
133
134
    /**
135
     * Renders the HTML and javascript for the text box.

Alpha/View/Widget/SmallTextBox.php 1 location

@@ 103-121 (lines=19) @@
100
     *
101
     * @throws Alpha\Exception\IllegalArguementException
102
     */
103
    public function __construct($string, $label, $name, $size = 0)
104
    {
105
        $config = ConfigProvider::getInstance();
106
107
        if ($string instanceof SmallText) {
108
            $this->stringObject = $string;
109
        } else {
110
            throw new IllegalArguementException('String object passed ['.var_export($string, true).'] is not a valid String object!');
111
        }
112
113
        $this->label = $label;
114
        $this->size = $size;
115
116
        if ($config->get('security.encrypt.http.fieldnames')) {
117
            $this->name = base64_encode(SecurityUtils::encrypt($name));
118
        } else {
119
            $this->name = $name;
120
        }
121
    }
122
123
    /**
124
     * Renders the HTML and javascript for the string box.