Test Failed
Push — master ( 299cbe...c555d0 )
by Maxim
01:58
created

Menu   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 16
Duplicated Lines 56.25 %

Importance

Changes 0
Metric Value
wmc 3
dl 9
loc 16
c 0
b 0
f 0
rs 10

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
/**
3
 * This file is a part of "Axessors" library.
4
 *
5
 * @author <[email protected]>
6
 * @package NoOne4rever\Axessors
7
 * @license GPL
8
 */
9
10
namespace NoOne4rever\Axessors\Examples;
11
12
/**
13
 * Class Menu.
14
 *
15
 * App menu.
16
 */
17
class Menu
18
{
19
    /**
20
     * Shows all employees.
21
     *
22
     * @param Employee[] $employees employees to show
23
     */
24
    public static function showEmployees(array $employees): void
25
    {
26
        echo "List of employees:";
27
        foreach ($employees as $employee) {
28
            if ($employee instanceof Employee) {
29
                echo PHP_EOL . "{$employee->getName()} - {$employee->getPosition()}";
30
            }
31
        }
32
        echo '.' . PHP_EOL;
33
    }
34
}