Completed
Push — spec-0.26 ( bc5589...4c625f )
by Colin
02:50
created

CursorState::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
c 1
b 1
f 0
dl 0
loc 11
rs 9.4285
cc 1
eloc 9
nc 1
nop 8

How to fix   Many Parameters   

Many Parameters

Methods with many parameters are not only hard to understand, but their parameters also often become inconsistent when you need more, or different data.

There are several approaches to avoid long parameter lists:

1
<?php
2
3
/*
4
 * This file is part of the league/commonmark package.
5
 *
6
 * (c) Colin O'Dell <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace League\CommonMark;
13
14
class CursorState
15
{
16
    /**
17
     * @var string
18
     */
19
    private $line;
20
21
    /**
22
     * @var int
23
     */
24
    private $length;
25
26
    /**
27
     * @var int
28
     */
29
    private $currentPosition;
30
31
    /**
32
     * @var int
33
     */
34
    private $previousPosition;
35
36
    /**
37
     * @var int|null
38
     */
39
    private $firstNonSpaceCache;
40
41
    /**
42
     * @var int
43
     */
44
    private $indent;
45
46
    /**
47
     * @var int
48
     */
49
    private $column;
50
51
    /**
52
     * @var bool
53
     */
54
    private $partiallyConsumedTab;
55
56
    /**
57
     * @param string   $line
58
     * @param int      $length
59
     * @param int      $currentPosition
60
     * @param int      $previousPosition
61
     * @param int|null $firstNonSpaceCache
62
     * @param int      $indent
63
     * @param int      $column
64
     * @param bool     $partiallyConsumedTab
65
     */
66
    public function __construct($line, $length, $currentPosition, $previousPosition, $firstNonSpaceCache, $indent, $column, $partiallyConsumedTab)
67
    {
68
        $this->line = $line;
69
        $this->length = $length;
70
        $this->currentPosition = $currentPosition;
71
        $this->previousPosition = $previousPosition;
72
        $this->firstNonSpaceCache = $firstNonSpaceCache;
73
        $this->indent = $indent;
74
        $this->column = $column;
75
        $this->partiallyConsumedTab = $partiallyConsumedTab;
76
    }
77
78
    /**
79
     * @return int
80
     */
81
    public function getCurrentPosition()
82
    {
83
        return $this->currentPosition;
84
    }
85
86
    /**
87
     * @return int
88
     */
89
    public function getLength()
90
    {
91
        return $this->length;
92
    }
93
94
    /**
95
     * @return string
96
     */
97
    public function getLine()
98
    {
99
        return $this->line;
100
    }
101
102
    /**
103
     * @return int
104
     */
105
    public function getPreviousPosition()
106
    {
107
        return $this->previousPosition;
108
    }
109
110
    /**
111
     * @return int|null
112
     */
113
    public function getFirstNonSpaceCache()
114
    {
115
        return $this->firstNonSpaceCache;
116
    }
117
118
    /**
119
     * @return int
120
     */
121
    public function getIndent()
122
    {
123
        return $this->indent;
124
    }
125
126
    /**
127
     * @return int
128
     */
129
    public function getColumn()
130
    {
131
        return $this->column;
132
    }
133
134
    /**
135
     * @return bool
136
     */
137
    public function getPartiallyConsumedTab()
138
    {
139
        return $this->partiallyConsumedTab;
140
    }
141
}
142