@@ 148-160 (lines=13) @@ | ||
145 | * @param bool|null $asrows |
|
146 | * @return int |
|
147 | */ |
|
148 | public function getDepth($asrows = null) |
|
149 | { |
|
150 | if (! $this->hasChildren()) { |
|
151 | return 0; |
|
152 | } |
|
153 | $level = 0; |
|
154 | foreach ($this->children as $child) { |
|
155 | if (null === $asrows || $asrows == $child->isrow) { |
|
156 | $level = max($level, $child->getDepth() + 1); |
|
157 | } |
|
158 | } |
|
159 | return $level; |
|
160 | } |
|
161 | ||
162 | public function getCurrentDepth() |
|
163 | { |
|
@@ 174-186 (lines=13) @@ | ||
171 | * @param bool|null $asrows |
|
172 | * @return int |
|
173 | */ |
|
174 | public function getHorizontalDepth($asrows = null) |
|
175 | { |
|
176 | if (! $this->hasChildren()) { |
|
177 | return 1; |
|
178 | } |
|
179 | $sum = 0; |
|
180 | foreach ($this->children as $child) { |
|
181 | if (null === $asrows || $asrows === $child->isrow) { |
|
182 | $sum += $child->getHorizontalDepth(); |
|
183 | } |
|
184 | } |
|
185 | return $sum; |
|
186 | } |
|
187 | ||
188 | public function copy($childrenLevels) |
|
189 | { |