Code Duplication    Length = 47-48 lines in 2 locations

lib/RIM/Entity/ManufacturedLabeledDrug.php 1 location

@@ 35-81 (lines=47) @@
32
 *
33
 * @author Julien Fastré <[email protected]>
34
 */
35
class ManufacturedLabeledDrug extends DrugOrMaterial
36
{
37
    /**
38
     *
39
     * @var CodedWithEquivalents 
40
     */
41
    protected $code;
42
    
43
    public function __construct(CodedWithEquivalents $code)
44
    {
45
        $this->setCode($code);
46
    }
47
48
    
49
    public function getCode()
50
    {
51
        return $this->code;
52
    }
53
54
    public function setCode(CodedWithEquivalents $code)
55
    {
56
        $this->code = $code;
57
        return $this;
58
    }
59
60
        
61
    protected function getElementTag(): string
62
    {
63
        return 'manufacturedLabeledDrug';
64
    }
65
66
    public function getDefaultClassCode(): string
67
    {
68
        return 'MMAT';
69
    }
70
71
    public function toDOMElement(\DOMDocument $doc): \DOMElement
72
    {
73
        $el = $this->createElement($doc);
74
        
75
        if ($this->getCode() !== null) {
76
            $el->appendChild((new Code($this->getCode()))->toDOMElement($doc));
77
        }
78
        
79
        return $el;
80
    }
81
}
82

lib/RIM/Role/ManufacturedProduct.php 1 location

@@ 34-81 (lines=48) @@
31
 *
32
 * @author Julien Fastré <[email protected]>
33
 */
34
class ManufacturedProduct extends Role
35
{
36
    /**
37
     *
38
     * @var DrugOrMaterial
39
     */
40
    protected $manufacturedDrugOrOther;
41
    
42
    function __construct(DrugOrMaterial $manufacturedDrugOrOther)
43
    {
44
        $this->setManufacturedDrugOrOther($manufacturedDrugOrOther);
45
    }
46
    
47
    
48
    public function getManufacturedDrugOrOther()
49
    {
50
        return $this->manufacturedDrugOrOther;
51
    }
52
53
    public function setManufacturedDrugOrOther(DrugOrMaterial $manufacturedDrugOrOther)
54
    {
55
        $this->manufacturedDrugOrOther = $manufacturedDrugOrOther;
56
        return $this;
57
    }
58
59
        
60
    protected function getElementTag(): string
61
    {
62
        return 'manufacturedProduct';
63
    }
64
65
    public function getClassCode(): string
66
    {
67
        return 'MANU';
68
    }
69
70
    public function toDOMElement(\DOMDocument $doc): \DOMElement
71
    {
72
        $el = $this->createElement($doc);
73
        
74
        if ($this->getManufacturedDrugOrOther() !== null) {
75
            $el->appendChild($this->getManufacturedDrugOrOther()
76
                ->toDOMElement($doc));
77
        }
78
        
79
        return $el;
80
    }
81
}
82