Completed
Push — master ( 50ef2b...3bc0ea )
by Shcherbak
05:22
created

Report::addError()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 3
nc 1
nop 4
crap 1
1
<?php
2
3
  namespace Funivan\Cs\Message;
4
5
  use Funivan\Cs\FileFinder\FileInfo;
6
  use Funivan\Cs\FileProcessor\FileTool;
7
  use Fiv\Collection\ObjectCollection;
8
9
  /**
10
   * @method FileMessage current()
11
   *
12
   
13
   * @author Ivan Shcherbak <[email protected]> 2016
14
   */
15
  class Report extends ObjectCollection {
16
17
    /**
18
     * @inheritdoc
19
     */
20 8
    public function objectsClassName() {
21 8
      return FileMessage::class;
22
    }
23
24
25
    /**
26
     * @param FileInfo $file
27
     * @param FileTool $tool
28
     * @param string $message
29
     * @param int|null $line
30
     * @return $this
31
     */
32 3
    public function addError(FileInfo $file, FileTool $tool, $message, $line = null) {
33 3
      $this[] = new FileMessage($file, $tool, $message, $line, FileMessage::LEVEL_ERROR);
34 3
      return $this;
35
    }
36
37
38
    /**
39
     * @param FileInfo $file
40
     * @param FileTool $tool
41
     * @param string $message
42
     * @param int|null $line
43
     * @return $this
44
     */
45 5
    public function addNotice(FileInfo $file, FileTool $tool, $message, $line = null) {
46 5
      $this[] = new FileMessage($file, $tool, $message, $line, FileMessage::LEVEL_NOTICE);
47 5
      return $this;
48
    }
49
50
  }