Test Failed
Pull Request — master (#1564)
by milkmeowo
04:45
created

Crm   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 16
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A __get() 0 7 2
1
<?php
2
3
4
namespace EasyWeChat\Work\Crm;
5
6
7
use EasyWeChat\Kernel\Exceptions\InvalidArgumentException;
8
9
/**
10
 * Class Crm.
11
 *
12
 * @author milkmeowo <[email protected]>
13
 *
14
 * @property \EasyWeChat\Work\Crm\ContactWayClient $contact_way
15
 * @property \EasyWeChat\Work\Crm\DataCubeClient $data_cube
16
 * @property \EasyWeChat\Work\Crm\DimissionClient $dimission
17
 * @property \EasyWeChat\Work\Crm\MessageClient $msg
18
 */
19
class Crm extends Client
20
{
21
    /**
22
     * @param string $property
23
     *
24
     * @return mixed
25
     *
26
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException
27
     */
28
    public function __get($property)
29
    {
30
        if (isset($this->app["crm.{$property}"])) {
0 ignored issues
show
Coding Style Best Practice introduced by
As per coding-style, please use concatenation or sprintf for the variable $property instead of interpolation.

It is generally a best practice as it is often more readable to use concatenation instead of interpolation for variables inside strings.

// Instead of
$x = "foo $bar $baz";

// Better use either
$x = "foo " . $bar . " " . $baz;
$x = sprintf("foo %s %s", $bar, $baz);
Loading history...
31
            return $this->app["crm.{$property}"];
0 ignored issues
show
Coding Style Best Practice introduced by
As per coding-style, please use concatenation or sprintf for the variable $property instead of interpolation.

It is generally a best practice as it is often more readable to use concatenation instead of interpolation for variables inside strings.

// Instead of
$x = "foo $bar $baz";

// Better use either
$x = "foo " . $bar . " " . $baz;
$x = sprintf("foo %s %s", $bar, $baz);
Loading history...
32
        }
33
34
        throw new InvalidArgumentException(sprintf('No crm service named "%s".', $property));
35
    }
36
}