Code Duplication    Length = 7-8 lines in 2 locations

src/Charcoal/Property/ObjectProperty.php 1 location

@@ 771-777 (lines=7) @@
768
            return '';
769
        }
770
771
        if ($lang === null) {
772
            $lang = $this->translator()->getLocale();
773
        } elseif (!is_string($lang)) {
774
            throw new InvalidArgumentException(
775
                'The language to render as must be a string.'
776
            );
777
        }
778
779
        $origLang = $this->translator()->getLocale();
780
        $this->translator()->setLocale($lang);

src/Charcoal/Property/AbstractProperty.php 1 location

@@ 279-286 (lines=8) @@
276
            ));
277
        }
278
279
        if ($lang === null) {
280
            $lang = $this->translator()->getLocale();
281
        } elseif (!is_string($lang)) {
282
            throw new InvalidArgumentException(sprintf(
283
                'Language must be a string for Property "%s"',
284
                $this->ident
285
            ));
286
        }
287
288
        return sprintf('%1$s_%2$s', $this->ident, $lang);
289
    }