Code Duplication    Length = 12-13 lines in 3 locations

lib/midcom/db/attachment.php 1 location

@@ 48-59 (lines=12) @@
45
     *
46
     * @return string Parent GUID.
47
     */
48
    public static function get_parent_guid_uncached_static($guid, $classname = __CLASS__)
49
    {
50
        $mc = new midgard_collector('midgard_attachment', 'guid', $guid);
51
        $mc->set_key_property('parentguid');
52
        $mc->execute();
53
        $link_values = $mc->list_keys();
54
        if (empty($link_values))
55
        {
56
            return null;
57
        }
58
        return key($link_values);
59
    }
60
61
    /**
62
     * Opens the attachment for file IO.

lib/midcom/db/parameter.php 1 location

@@ 34-45 (lines=12) @@
31
     *
32
     * @return string Parent GUID or null if there is none.
33
     */
34
    public static function get_parent_guid_uncached_static($guid, $classname = __CLASS__)
35
    {
36
        $mc = new midgard_collector('midgard_parameter', 'guid', $guid);
37
        $mc->set_key_property('parentguid');
38
        $mc->execute();
39
        $link_values = $mc->list_keys();
40
        if (empty($link_values))
41
        {
42
            return null;
43
        }
44
        return key($link_values);
45
    }
46
47
    /**
48
     * Read a parameter without loading the corresponding object.

lib/org/routamc/positioning/location.php 1 location

@@ 63-75 (lines=13) @@
60
     *
61
     * @return string Parent GUID or null if there is none
62
     */
63
    public static function get_parent_guid_uncached_static($guid, $classname = __CLASS__)
64
    {
65
        $mc = new midgard_collector('org_routamc_positioning_location', 'guid', $guid);
66
        $mc->set_key_property('parent');
67
        $mc->execute();
68
        $link_values = $mc->list_keys();
69
        if (empty($link_values))
70
        {
71
            return null;
72
        }
73
74
        return key($link_values);
75
    }
76
77
    /**
78
     * Checks after location cache creation