Passed
Push — master ( 554f4f...40d218 )
by James
03:44 queued 16s
created

ManageMessages::listMessages()   A

Complexity

Conditions 4
Paths 4

Size

Total Lines 11
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 11
rs 10
cc 4
nc 4
nop 2
1
<?php
2
declare(strict_types=1);
3
4
5
namespace App\Console;
6
7
/**
8
 * Trait ManageMessages
9
 */
10
trait ManageMessages
11
{
12
13
    /**
14
     * @param string $key
15
     * @param array  $messages
16
     */
17
    protected function listMessages(string $key, array $messages): void
18
    {
19
        if (count($messages) > 0) {
20
            /**
21
             * @var int   $index
22
             * @var array $error
23
             */
24
            foreach ($messages as $index => $list) {
25
                /** @var string $line */
26
                foreach ($list as $line) {
27
                    $this->error(sprintf('%s in line #%d: %s', $key, $index + 1, $line));
0 ignored issues
show
Bug introduced by
It seems like error() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

27
                    $this->/** @scrutinizer ignore-call */ 
28
                           error(sprintf('%s in line #%d: %s', $key, $index + 1, $line));
Loading history...
28
                }
29
            }
30
        }
31
    }
32
}