Passed
Push — master ( 2630eb...9b6994 )
by Struan
05:22
created

print_voter()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 5
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 6
rs 10
1
<?php
1 ignored issue
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 4 and the first side effect is on line 15.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
2
3
if (!function_exists('print_voter')) {
4
  function print_voter($vote){
5
    echo sprintf(
6
      '<li><a href="/mp/?p=%d">%s</a> <span class="party">%s</span></li>',
7
      $vote['person_id'],
8
      $vote['name'],
9
      $vote['party']
10
    );
11
  }
12
}
13
14
if (count($votes) > 0) { ?>
15
  <div class="division-section__vote division-section__vote__names">
16
      <h3><?= $vote_title ?>s: A-Z by last name</h3>
17
      <?php $tellers = array(); ?>
18
      <ul class="division-names js-vote-accordion">
19
        <?php foreach ($votes as $vote) {
20
          if ($vote['teller']) {
21
              $tellers[] = $vote;
22
          } else {
23
            print_voter($vote);
24
          }
25
        } ?>
26
      </ul>
27
    <?php if (count($tellers) > 0) { ?>
28
      <h4>Tellers</h4>
29
      <ul class="division-names">
30
        <?php foreach($tellers as $teller) {
31
          print_voter($teller);
32
        } ?>
33
      </p>
34
    <?php } ?>
35
  </div>
36
<?php } ?>
37