|
2 | 2 |
|
3 | 3 | // Fixture: candidate limit multiplier derived from count() |
4 | 4 |
|
| 5 | +// ============================================================ |
| 6 | +// TRUE POSITIVE — count() multiplied into a limit value |
| 7 | +// ============================================================ |
| 8 | + |
5 | 9 | function hcc_fixture_limit_multiplier_from_count( array $user_ids ) { |
6 | 10 | $candidate_limit = count( $user_ids ) * 10 * 5; |
7 | 11 | return $candidate_limit; |
8 | 12 | } |
| 13 | + |
| 14 | +// ============================================================ |
| 15 | +// FALSE POSITIVE GUARDS — count() used for display, comparison, or assignment |
| 16 | +// These should NOT be flagged by limit-multiplier-from-count |
| 17 | +// ============================================================ |
| 18 | + |
| 19 | +// FP: count() used in echo/display context |
| 20 | +function display_pending_count( $pending ) { |
| 21 | + echo "\nPending submissions: " . count($pending) . "\n"; |
| 22 | +} |
| 23 | + |
| 24 | +// FP: count() used as array value for logging/display |
| 25 | +function build_summary_array( $person ) { |
| 26 | + return [ |
| 27 | + 'Phone_Count' => isset($person['ContactPhoneNumbers']) ? count($person['ContactPhoneNumbers']) : 0, |
| 28 | + 'Email_Count' => isset($person['ContactEmailAddresses']) ? count($person['ContactEmailAddresses']) : 0, |
| 29 | + ]; |
| 30 | +} |
| 31 | + |
| 32 | +// FP: count() used in while-loop comparison (not a LIMIT multiplier) |
| 33 | +function normalize_array( $normalized, $length ) { |
| 34 | + while (count($normalized) < $length) { |
| 35 | + $normalized[] = ''; |
| 36 | + } |
| 37 | + return $normalized; |
| 38 | +} |
| 39 | + |
| 40 | +// FP: count() used in HTML output |
| 41 | +function render_log_summary( $request_files, $response_files ) { |
| 42 | + echo '<p><strong>Request Logs:</strong> ' . count($request_files) . ' file(s)</p>'; |
| 43 | + echo '<p><strong>Response Logs:</strong> ' . count($response_files) . ' file(s)</p>'; |
| 44 | +} |
| 45 | + |
| 46 | +// FP: count() used in if-condition (not multiplied) |
| 47 | +function trim_submissions( $pending_submissions ) { |
| 48 | + if (count($pending_submissions) > 10) { |
| 49 | + $pending_submissions = array_slice($pending_submissions, 0, 10); |
| 50 | + } |
| 51 | + return $pending_submissions; |
| 52 | +} |
0 commit comments