Code Duplication    Length = 66-67 lines in 4 locations

core/domain/services/graphql/connections/EventVenuesConnection.php 1 location

@@ 19-84 (lines=66) @@
16
 * @author  Brent Christensen
17
 * @since   $VID:$
18
 */
19
class EventVenuesConnection implements ConnectionInterface
20
{
21
22
    /**
23
     * @var EEM_Venue $model
24
     */
25
    protected $model;
26
27
28
    /**
29
     * DatetimeConnection constructor.
30
     *
31
     * @param EEM_Venue $model
32
     */
33
    public function __construct(EEM_Venue $model)
34
    {
35
        $this->model = $model;
36
    }
37
38
39
    /**
40
     * @return array
41
     * @since $VID:$
42
     */
43
    public function config()
44
    {
45
        return [
46
            'fromType'           => 'Event',
47
            'toType'             => 'Venue',
48
            'fromFieldName'      => 'venues',
49
            'connectionTypeName' => 'EventVenuesConnection',
50
            'resolve'            => [$this, 'resolveConnection'],
51
            'resolveNode'        => [$this, 'resolveNode'],
52
        ];
53
    }
54
55
56
    /**
57
     * @param $entity
58
     * @param $args
59
     * @param $context
60
     * @param $info
61
     * @return array
62
     * @throws Exception
63
     * @since $VID:$
64
     */
65
    public function resolveConnection($entity, $args, $context, $info)
66
    {
67
        $resolver = new VenueConnectionResolver($entity, $args, $context, $info);
68
        return $resolver->get_connection();
69
    }
70
71
72
    /**
73
     * @param $id
74
     * @param $args
75
     * @param $context
76
     * @param $info
77
     * @return EE_Base_Class
78
     * @since $VID:$
79
     */
80
    public function resolveNode($id, $args, $context, $info)
81
    {
82
        return $this->model->get_one_by_ID($id);
83
    }
84
}
85

core/domain/services/graphql/connections/RootQueryDatetimesConnection.php 1 location

@@ 21-87 (lines=67) @@
18
 * @author  Brent Christensen
19
 * @since   $VID:$
20
 */
21
class RootQueryDatetimesConnection implements ConnectionInterface
22
{
23
24
    /**
25
     * @var EEM_Datetime $model
26
     */
27
    protected $model;
28
29
30
    /**
31
     * DatetimeConnection constructor.
32
     *
33
     * @param EEM_Datetime               $model
34
     */
35
    public function __construct(EEM_Datetime $model)
36
    {
37
        $this->model = $model;
38
    }
39
40
41
    /**
42
     * @return array
43
     * @since $VID:$
44
     */
45
    public function config()
46
    {
47
        return [
48
            'fromType'           => 'RootQuery',
49
            'toType'             => 'Datetime',
50
            'fromFieldName'      => 'datetimes',
51
            'connectionTypeName' => 'RootQueryDatetimesConnection',
52
            'connectionArgs'     => EventDatetimesConnection::get_connection_args(),
53
            'resolve'            => [$this, 'resolveConnection'],
54
            'resolveNode'        => [$this, 'resolveNode']
55
        ];
56
    }
57
58
59
    /**
60
     * @param $entity
61
     * @param $args
62
     * @param $context
63
     * @param $info
64
     * @return array
65
     * @throws Exception
66
     * @since $VID:$
67
     */
68
    public function resolveConnection($entity, $args, $context, $info)
69
    {
70
        $resolver = new DatetimeConnectionResolver($entity, $args, $context, $info);
71
        return $resolver->get_connection();
72
    }
73
74
75
    /**
76
     * @param $id
77
     * @param $args
78
     * @param $context
79
     * @param $info
80
     * @return EE_Base_Class
81
     * @since $VID:$
82
     */
83
    public function resolveNode($id, $args, $context, $info)
84
    {
85
        return $this->model->get_one_by_ID($id);
86
    }
87
}
88

core/domain/services/graphql/connections/RootQueryTicketsConnection.php 1 location

@@ 21-87 (lines=67) @@
18
 * @author  Brent Christensen
19
 * @since   $VID:$
20
 */
21
class RootQueryTicketsConnection implements ConnectionInterface
22
{
23
24
    /**
25
     * @var EEM_Ticket $model
26
     */
27
    protected $model;
28
29
30
    /**
31
     * TicketConnection constructor.
32
     *
33
     * @param EEM_Ticket               $model
34
     */
35
    public function __construct(EEM_Ticket $model)
36
    {
37
        $this->model = $model;
38
    }
39
40
41
    /**
42
     * @return array
43
     * @since $VID:$
44
     */
45
    public function config()
46
    {
47
        return [
48
            'fromType'           => 'RootQuery',
49
            'toType'             => 'Ticket',
50
            'fromFieldName'      => 'tickets',
51
            'connectionTypeName' => 'RootQueryTicketsConnection',
52
            'connectionArgs'     => DatetimeTicketsConnection::get_connection_args(),
53
            'resolve'            => [$this, 'resolveConnection'],
54
            'resolveNode'        => [$this, 'resolveNode']
55
        ];
56
    }
57
58
59
    /**
60
     * @param $entity
61
     * @param $args
62
     * @param $context
63
     * @param $info
64
     * @return array
65
     * @throws Exception
66
     * @since $VID:$
67
     */
68
    public function resolveConnection($entity, $args, $context, $info)
69
    {
70
        $resolver = new TicketConnectionResolver($entity, $args, $context, $info);
71
        return $resolver->get_connection();
72
    }
73
74
75
    /**
76
     * @param $id
77
     * @param $args
78
     * @param $context
79
     * @param $info
80
     * @return EE_Base_Class
81
     * @since $VID:$
82
     */
83
    public function resolveNode($id, $args, $context, $info)
84
    {
85
        return $this->model->get_one_by_ID($id);
86
    }
87
}
88

core/domain/services/graphql/connections/TicketDatetimesConnection.php 1 location

@@ 20-86 (lines=67) @@
17
 * @author  Brent Christensen
18
 * @since   $VID:$
19
 */
20
class TicketDatetimesConnection implements ConnectionInterface
21
{
22
23
    /**
24
     * @var EEM_Datetime $model
25
     */
26
    protected $model;
27
28
29
    /**
30
     * DatetimeConnection constructor.
31
     *
32
     * @param EEM_Datetime $model
33
     */
34
    public function __construct(EEM_Datetime $model)
35
    {
36
        $this->model = $model;
37
    }
38
39
40
    /**
41
     * @return array
42
     * @since $VID:$
43
     */
44
    public function config()
45
    {
46
        return [
47
            'fromType'           => 'Ticket',
48
            'toType'             => 'Datetime',
49
            'fromFieldName'      => 'datetimes',
50
            'connectionTypeName' => 'TicketDatetimesConnection',
51
            'connectionArgs'     => EventDatetimesConnection::get_connection_args(),
52
            'resolve'            => [$this, 'resolveConnection'],
53
            'resolveNode'        => [$this, 'resolveNode'],
54
        ];
55
    }
56
57
58
    /**
59
     * @param $entity
60
     * @param $args
61
     * @param $context
62
     * @param $info
63
     * @return array
64
     * @throws Exception
65
     * @since $VID:$
66
     */
67
    public function resolveConnection($entity, $args, $context, $info)
68
    {
69
        $resolver = new DatetimeConnectionResolver($entity, $args, $context, $info);
70
        return $resolver->get_connection();
71
    }
72
73
74
    /**
75
     * @param $id
76
     * @param $args
77
     * @param $context
78
     * @param $info
79
     * @return EE_Base_Class
80
     * @since $VID:$
81
     */
82
    public function resolveNode($id, $args, $context, $info)
83
    {
84
        return $this->model->get_one_by_ID($id);
85
    }
86
}
87