Base::__call()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 14

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 14
ccs 0
cts 6
cp 0
rs 9.7998
c 0
b 0
f 0
cc 2
nc 2
nop 2
crap 6
1
<?php
2
namespace Telegram\Bot\Keyboard;
3
4
use Illuminate\Support\Collection;
5
use Illuminate\Support\Str;
6
7
class Base extends Collection
8
{
9
    /**
10
     * Dynamically build params.
11
     *
12
     * @param string $method
13
     * @param array  $args
14
     *
15
     * @return $this
16
     */
17
    public function __call($method, $args)
18
    {
19
        $action = substr($method, 0, 3);
20
21
        if ($action !== 'set') {
22
            return parent::__call($method, $args);
23
        }
24
25
        $property = Str::snake(substr($method, 3));
26
        $this->items[$property] = $args[0];
27
28
        return $this;
29
30
    }
31
}
32