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

Report   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 0
cbo 2
dl 0
loc 36
ccs 8
cts 8
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A objectsClassName() 0 3 1
A addNotice() 0 4 1
A addError() 0 4 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
  }