Passed
Push — master ( 2afdeb...b846a2 )
by Nikolaos
06:23 queued 03:51
created

AbstractSeries   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 54
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 12
c 1
b 0
f 0
dl 0
loc 54
ccs 11
cts 11
cp 1
rs 10
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __toString() 0 5 1
A __invoke() 0 15 3
1
<?php
2
3
/**
4
 * This file is part of the Phalcon Framework.
5
 *
6
 * For the full copyright and license information, please view the LICENSE.md
7
 * file that was distributed with this source code.
8
 */
9
10
declare(strict_types=1);
11
12
namespace Phalcon\Html\Helper;
13
14
/**
15
 * Class AbstractSeries
16
 *
17
 * @property array $attributes
18
 * @property array $store
19
 */
20
abstract class AbstractSeries extends AbstractHelper
21
{
22
    /**
23
     * @var array
24
     */
25
    protected $attributes = [];
26
27
    /**
28
     * @var array
29
     */
30
    protected $store = [];
31
32
    /**
33
     * @param string $indent
34
     * @param string $delimiter
35
     *
36
     * @return AbstractSeries
37
     */
38 8
    public function __invoke(
39
        string $indent = null,
40
        string $delimiter = null
41
    ): AbstractSeries {
42 8
        if (null !== $delimiter) {
43 4
            $this->delimiter = $delimiter;
44
        }
45
46 8
        if (null !== $indent) {
47 4
            $this->indent = $indent;
48
        }
49
50 8
        $this->store = [];
51
52 8
        return $this;
53
    }
54
55
    /**
56
     * Generates and returns the HTML for the list.
57
     *
58
     * @return string
59
     */
60 8
    public function __toString()
61
    {
62 8
        return $this->renderArrayElements(
63 8
            $this->store,
64 8
            $this->delimiter
65
        );
66
    }
67
68
    /**
69
     * Returns the tag name.
70
     *
71
     * @return string
72
     */
73
    abstract protected function getTag(): string;
74
}
75