Code Duplication    Length = 17-17 lines in 2 locations

lib.php 2 locations

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