Code Duplication    Length = 15-17 lines in 2 locations

src/MaterialField.php 2 locations

@@ 34-48 (lines=15) @@
31
     * @param string $locale Locale identifier
32
     * @return bool|self[]  Field instance or null if 3rd parameter not passed
33
     */
34
    public static function byMaterialID(
35
        QueryInterface $query,
36
        $materialID,
37
        &$return = null,
38
        $locale = DEFAULT_LOCALE
39
    ) {
40
        $return = $query->entity(get_called_class())
41
            ->where(Material::F_PRIMARY, $materialID)
42
            ->where(Material::F_DELETION, true)
43
            ->where(self::F_LOCALE, $locale)
44
            ->exec();
45
46
        // If only one argument is passed - return null, otherwise bool
47
        return func_num_args() > 2 ? sizeof($return) : $return;
48
    }
49
50
    /**
51
     * Find additional field value database record by its material and field identifiers.
@@ 62-78 (lines=17) @@
59
     * @param string $locale Locale identifier
60
     * @return bool|null|self  Field instance or null if 3rd parameter not passed
61
     */
62
    public static function byFieldIDAndMaterialID(
63
        QueryInterface $query,
64
        $materialID,
65
        $fieldID,
66
        &$return = null,
67
        $locale = null
68
    ) {
69
        $return = $query->entity(get_called_class())
70
            ->where(Material::F_PRIMARY, $materialID)
71
            ->where(Field::F_PRIMARY, $fieldID)
72
            ->where(self::F_LOCALE, $locale)
73
            ->where(Material::F_DELETION, 1)
74
            ->exec();
75
76
        // If only one argument is passed - return null, otherwise bool
77
        return func_num_args() > 3 ? sizeof($return): $return;
78
    }
79
}
80