Code Duplication    Length = 26-26 lines in 2 locations

class/Form/Elements/SmartFormFileUploadElement.php 1 location

@@ 20-45 (lines=26) @@
17
/**
18
 * Class SmartFormFileUploadElement
19
 */
20
class SmartFormFileUploadElement extends Smartobject\Form\Elements\SmartFormUploadElement
21
{
22
    /**
23
     * SmartFormFileUploadElement constructor.
24
     * @param string $object
25
     * @param string $key
26
     */
27
    public function __construct($object, $key)
28
    {
29
        $this->SmartFormFileElement($object, $key);
30
        // Override name for upload purposes
31
        $this->setName('upload_' . $key);
32
    }
33
34
    /**
35
     * prepare HTML for output
36
     *
37
     * @return string HTML
38
     */
39
    public function render()
40
    {
41
        return "<input type='hidden' name='MAX_FILE_SIZE' value='" . $this->getMaxFileSize() . "'>
42
        <input type='file' name='upload_" . $this->getName() . "' id='upload_" . $this->getName() . "'" . $this->getExtra() . ">
43
        <input type='hidden' name='smart_upload_file[]' id='smart_upload_file[]' value='" . $this->getName() . "'>";
44
    }
45
}
46

class/Form/Elements/SmartFormImageUploadElement.php 1 location

@@ 20-45 (lines=26) @@
17
/**
18
 * Class SmartFormImageUploadElement
19
 */
20
class SmartFormImageUploadElement extends Smartobject\Form\Elements\SmartFormUploadElement
21
{
22
    /**
23
     * SmartFormImageUploadElement constructor.
24
     * @param string $object
25
     * @param string $key
26
     */
27
    public function __construct($object, $key)
28
    {
29
        $this->SmartFormFileElement($object, $key);
30
        // Override name for upload purposes
31
        $this->setName('upload_' . $key);
32
    }
33
34
    /**
35
     * prepare HTML for output
36
     *
37
     * @return string HTML
38
     */
39
    public function render()
40
    {
41
        return "<input type='hidden' name='MAX_FILE_SIZE' value='" . $this->getMaxFileSize() . "'>
42
        <input type='file' name='" . $this->getName() . "' id='" . $this->getName() . "'" . $this->getExtra() . ">
43
        <input type='hidden' name='smart_upload_image[]' id='smart_upload_image[]' value='" . $this->getName() . "'>";
44
    }
45
}
46