Code Duplication    Length = 15-17 lines in 2 locations

src/MaterialField.php 2 locations

@@ 44-58 (lines=15) @@
41
     * @param string $locale Locale identifier
42
     * @return bool|self[]  Field instance or null if 3rd parameter not passed
43
     */
44
    public static function byMaterialID(
45
        QueryInterface $query,
46
        $materialID,
47
        &$return = null,
48
        $locale = DEFAULT_LOCALE
49
    ) {
50
        $return = $query->entity(get_called_class())
51
            ->where('MaterialID', $materialID)
52
            ->where('Active', 1)
53
            ->where('locale', $locale)
54
            ->exec();
55
56
        // If only one argument is passed - return null, otherwise bool
57
        return func_num_args() > 1 ? sizeof($return) : $return;
58
    }
59
60
    /**
61
     * Find additional field value database record by its material and field identifiers.
@@ 72-88 (lines=17) @@
69
     * @param string $locale Locale identifier
70
     * @return bool|null|self[]  Field instance or null if 3rd parameter not passed
71
     */
72
    public static function byFieldIDAndMaterialID(
73
        QueryInterface $query,
74
        $materialID,
75
        $fieldID,
76
        &$return = null,
77
        $locale = DEFAULT_LOCALE
78
    ) {
79
        $return = $query->entity(get_called_class())
80
            ->where('MaterialID', $materialID)
81
            ->where('FieldID', $fieldID)
82
            ->where('locale', $locale)
83
            ->where('Active', 1)
84
            ->exec();
85
86
        // If only one argument is passed - return null, otherwise bool
87
        return func_num_args() > 1 ? sizeof($return): $return;
88
    }
89
}
90