Code Duplication    Length = 13-15 lines in 2 locations

Translatable/Entity/BaseEntity.php 2 locations

@@ 47-61 (lines=15) @@
44
        return in_array($locale, array_keys($this->localeArr));
45
    }
46
47
    public function __get($property)
48
    {
49
        if (!method_exists($this, 'get'.ucfirst($property))) {
50
            $locale = Sludio::getDefaultLocale();
51
        } else {
52
            $locale = strtolower(substr($property, -2));
53
            $property = substr($property, 0, -2);
54
        }
55
56
        if ($this->check($locale)) {
57
            return $this->getVariableByLocale($property, $this->localeArr[$locale]);
58
        }
59
60
        return $this->{$property};
61
    }
62
63
    public function __set($property, $value)
64
    {
@@ 63-75 (lines=13) @@
60
        return $this->{$property};
61
    }
62
63
    public function __set($property, $value)
64
    {
65
        if (!method_exists($this, 'set'.ucfirst($property))) {
66
            $locale = strtolower(substr($property, -2));
67
            if ($this->check($locale)) {
68
                $property = substr($property, 0, -2);
69
                Sludio::updateTranslations(get_class($this), $this->localeArr[$locale], $property, $value, $this->getId());
70
            }
71
        }
72
        $this->{$property} = $value;
73
74
        return $this;
75
    }
76
77
    protected function getTranslations()
78
    {