Code Duplication    Length = 14-14 lines in 3 locations

src/Model/Common/LocalizedString.php 1 location

@@ 87-100 (lines=14) @@
84
     * @param Context $context
85
     * @return string
86
     */
87
    public function get(Context $context = null)
88
    {
89
        if (is_null($context)) {
90
            $context = $this->getContext();
91
        }
92
        $locale = $this->getLanguage($context);
93
        if (!isset($this->values[$locale])) {
94
            if (!$context->isGraceful()) {
95
                throw new InvalidArgumentException(Message::NO_VALUE_FOR_LOCALE);
96
            }
97
            return '';
98
        }
99
        return $this->values[$locale];
100
    }
101
102
    /**
103
     * @param string $locale

src/Model/Product/LocalizedSearchKeywords.php 1 location

@@ 55-68 (lines=14) @@
52
     * @param Context $context
53
     * @return SearchKeywords
54
     */
55
    public function get(Context $context = null)
56
    {
57
        if (is_null($context)) {
58
            $context = $this->getContext();
59
        }
60
        $locale = $this->getLanguage($context);
61
        if (!isset($this[$locale])) {
62
            if (!$context->isGraceful()) {
63
                throw new InvalidArgumentException(Message::NO_VALUE_FOR_LOCALE);
64
            }
65
            return new SearchKeywords();
66
        }
67
        return $this->getAt($locale);
68
    }
69
70
    /**
71
     * @param $object

src/Model/Product/LocalizedSuggestionCollection.php 1 location

@@ 56-69 (lines=14) @@
53
     * @param Context $context
54
     * @return SuggestionCollection
55
     */
56
    public function get(Context $context = null)
57
    {
58
        if (is_null($context)) {
59
            $context = $this->getContext();
60
        }
61
        $locale = $this->getLanguage($context);
62
        if (!isset($this[$locale])) {
63
            if (!$context->isGraceful()) {
64
                throw new InvalidArgumentException(Message::NO_VALUE_FOR_LOCALE);
65
            }
66
            return new SuggestionCollection();
67
        }
68
        return $this->getAt($locale);
69
    }
70
}
71