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

InlineBaseObject   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 1
dl 0
loc 25
ccs 0
cts 7
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __call() 0 13 2
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