Code Duplication    Length = 16-16 lines in 2 locations

core/domain/services/graphql/data/mutations/DatetimeMutation.php 1 location

@@ 65-80 (lines=16) @@
62
     * @param EE_Datetime $entity  The datetime instance.
63
     * @param array       $tickets Array of ticket IDs to relate.
64
     */
65
    public static function setRelatedTickets($entity, array $tickets)
66
    {
67
        $relationName = 'Ticket';
68
        // Remove all the existing related tickets
69
        $entity->_remove_relations($relationName);
70
71
        foreach ($tickets as $ID) {
72
            $parts = Relay::fromGlobalId($ID);
73
            if (! empty($parts['id']) && is_int($parts['id'])) {
74
                $entity->_add_relation_to(
75
                    $parts['id'],
76
                    $relationName
77
                );
78
            }
79
        }
80
    }
81
}
82

core/domain/services/graphql/data/mutations/TicketMutation.php 1 location

@@ 54-69 (lines=16) @@
51
     * @param EE_Ticket $entity    The Ticket instance.
52
     * @param array     $datetimes Array of datetime IDs to relate.
53
     */
54
    public static function setRelatedDatetimes($entity, array $datetimes)
55
    {
56
        $relationName = 'Datetime';
57
        // Remove all the existing related datetimes
58
        $entity->_remove_relations($relationName);
59
60
        foreach ($datetimes as $ID) {
61
            $parts = Relay::fromGlobalId($ID);
62
            if (! empty($parts['id']) && is_int($parts['id'])) {
63
                $entity->_add_relation_to(
64
                    $parts['id'],
65
                    $relationName
66
                );
67
            }
68
        }
69
    }
70
}
71