Completed
Push — master ( a1f3e5...eb9bcc )
by Irfaq
02:42
created

InlineBaseObject::__call()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 13
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 13
ccs 0
cts 7
cp 0
rs 9.4285
cc 2
eloc 7
nc 2
nop 2
crap 6
1
<?php
2
namespace Telegram\Bot\Objects\InlineQuery;
3
4
use BadMethodCallException;
5
use Illuminate\Support\Collection;
6
7
abstract class InlineBaseObject extends Collection
8
{
9
10
    /**
11
     * Magic method to set properties dynamically.
12
     *
13
     * @param $name
14
     * @param $arguments
15
     *
16
     * @return $this|mixed
17
     */
18
    public function __call($name, $arguments)
19
    {
20
        $action = substr($name, 0, 3);
21
22
        if ($action === 'set') {
23
            $property = snake_case(substr($name, 3));
24
            $this->put($property, $arguments[0]);
25
26
            return $this;
27
        }
28
29
        throw new BadMethodCallException("Method {$name} does not exist.");
30
    }
31
}
32