Completed
Push — master ( 6ebd1c...df9bae )
by John
10:14
created

Fixer::chain()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
/*
3
 * This file is part of the KleijnWeb\SwaggerBundle package.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 */
8
9
namespace KleijnWeb\SwaggerBundle\Dev\DocumentFixer;
10
11
use KleijnWeb\SwaggerBundle\Document\SwaggerDocument;
12
13
abstract class Fixer
14
{
15
    /**
16
     * @var Fixer
17
     */
18
    private $next;
19
20
    /**
21
     * @param SwaggerDocument $document
22
     */
23
    public function fix(SwaggerDocument $document)
24
    {
25
        $this->process($document);
26
27
        if ($this->next) {
28
            $this->next->fix($document);
29
        }
30
    }
31
32
    /**
33
     * @param Fixer $next
34
     *
35
     * @return $this
36
     */
37
    public function chain(Fixer $next)
38
    {
39
        $this->next = $next;
40
41
        return $this;
42
    }
43
44
    /**
45
     * @param SwaggerDocument $document
46
     *
47
     * @return void
48
     */
49
    abstract public function process(SwaggerDocument $document);
50
}
51