Declaration   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 36
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
addStmt() 0 1 ?
A addStmts() 0 7 2
A setDocComment() 0 7 1
1
<?php
2
3
namespace PhpParser\Builder;
4
5
use PhpParser;
6
use PhpParser\Node;
7
use PhpParser\Node\Stmt;
8
9
abstract class Declaration extends PhpParser\BuilderAbstract
10
{
11
    protected $attributes = array();
12
13
    abstract public function addStmt($stmt);
14
15
    /**
16
     * Adds multiple statements.
17
     *
18
     * @param array $stmts The statements to add
19
     *
20
     * @return $this The builder instance (for fluid interface)
21
     */
22
    public function addStmts(array $stmts) {
23
        foreach ($stmts as $stmt) {
24
            $this->addStmt($stmt);
25
        }
26
27
        return $this;
28
    }
29
30
    /**
31
     * Sets doc comment for the declaration.
32
     *
33
     * @param PhpParser\Comment\Doc|string $docComment Doc comment to set
34
     *
35
     * @return $this The builder instance (for fluid interface)
36
     */
37
    public function setDocComment($docComment) {
38
        $this->attributes['comments'] = array(
39
            $this->normalizeDocComment($docComment)
40
        );
41
42
        return $this;
43
    }
44
}