Code Duplication    Length = 17-17 lines in 2 locations

lib.php 2 locations

@@ 168-184 (lines=17) @@
165
        }
166
    }
167
168
    if ($bigbluebuttonbn->completionengagementchats) {
169
        if (!$logs) {
170
            // As completion by engagement with chat was required, the activity hasn't been completed.
171
            return false;
172
        }
173
        $engagementchatscount = 0;
174
        foreach ($logs as $log) {
175
            $summary = json_decode($log->meta);
176
            $engagementchatscount += $summary->data->engagement->chats;
177
        }
178
        $value = $bigbluebuttonbn->completionengagementchats <= $engagementchatscount;
179
        if ($type == COMPLETION_AND) {
180
            $result = $result && $value;
181
        } else {
182
            $result = $result || $value;
183
        }
184
    }
185
186
    if ($bigbluebuttonbn->completionengagementtalks) {
187
        if (!$logs) {
@@ 186-202 (lines=17) @@
183
        }
184
    }
185
186
    if ($bigbluebuttonbn->completionengagementtalks) {
187
        if (!$logs) {
188
            // As completion by engagement with talk was required, the activity hasn't been completed.
189
            return false;
190
        }
191
        $engagementtalkscount = 0;
192
        foreach ($logs as $log) {
193
            $summary = json_decode($log->meta);
194
            $engagementtalkscount += $summary->data->engagement->talks;
195
        }
196
        $value = $bigbluebuttonbn->completionengagementtalks <= $engagementtalkscount;
197
        if ($type == COMPLETION_AND) {
198
            $result = $result && $value;
199
        } else {
200
            $result = $result || $value;
201
        }
202
    }
203
204
    return $result;
205
}