Code Duplication    Length = 14-14 lines in 3 locations

code/Model/Recipient/EmailRecipientCondition.php 1 location

@@ 130-143 (lines=14) @@
127
     * @param array $args List of arguments passed to canCreate
128
     * @return SiteTree Parent page instance
129
     */
130
    protected function getCanCreateContext($args)
131
    {
132
        // Inspect second parameter to canCreate for a 'Parent' context
133
        if (isset($args[1]['Parent'])) {
134
            return $args[1]['Parent'];
135
        }
136
        // Hack in currently edited page if context is missing
137
        if (Controller::has_curr() && Controller::curr() instanceof CMSMain) {
138
            return Controller::curr()->currentPage();
139
        }
140
141
        // No page being edited
142
        return null;
143
    }
144
145
    /**
146
     * @param Member

code/Model/EditableFormField.php 1 location

@@ 539-552 (lines=14) @@
536
     * @param array $args List of arguments passed to canCreate
537
     * @return SiteTree Parent page instance
538
     */
539
    protected function getCanCreateContext($args)
540
    {
541
        // Inspect second parameter to canCreate for a 'Parent' context
542
        if (isset($args[1]['Parent'])) {
543
            return $args[1]['Parent'];
544
        }
545
        // Hack in currently edited page if context is missing
546
        if (Controller::has_curr() && Controller::curr() instanceof CMSMain) {
547
            return Controller::curr()->currentPage();
548
        }
549
550
        // No page being edited
551
        return null;
552
    }
553
554
    /**
555
     * checks whether record is new, copied from SiteTree

code/Model/EditableCustomRule.php 1 location

@@ 111-124 (lines=14) @@
108
     * @param array $args List of arguments passed to canCreate
109
     * @return DataObject Some parent dataobject to inherit permissions from
110
     */
111
    protected function getCanCreateContext($args)
112
    {
113
        // Inspect second parameter to canCreate for a 'Parent' context
114
        if (isset($args[1]['Parent'])) {
115
            return $args[1]['Parent'];
116
        }
117
        // Hack in currently edited page if context is missing
118
        if (Controller::has_curr() && Controller::curr() instanceof CMSMain) {
119
            return Controller::curr()->currentPage();
120
        }
121
122
        // No page being edited
123
        return null;
124
    }
125
126
    /**
127
     * @param Member $member