Card::__get()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 3
nc 2
nop 1
dl 0
loc 7
ccs 4
cts 4
cp 1
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
/*
4
 * This file is part of the overtrue/wechat.
5
 *
6
 * (c) overtrue <[email protected]>
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace EasyWeChat\OfficialAccount\Card;
13
14
use EasyWeChat\Kernel\Exceptions\InvalidArgumentException;
15
16
/**
17
 * Class Card.
18
 *
19
 * @author overtrue <[email protected]>
20
 *
21
 * @property \EasyWeChat\OfficialAccount\Card\CodeClient          $code
22
 * @property \EasyWeChat\OfficialAccount\Card\MeetingTicketClient $meeting_ticket
23
 * @property \EasyWeChat\OfficialAccount\Card\MemberCardClient    $member_card
24
 * @property \EasyWeChat\OfficialAccount\Card\GeneralCardClient   $general_card
25
 * @property \EasyWeChat\OfficialAccount\Card\MovieTicketClient   $movie_ticket
26
 * @property \EasyWeChat\OfficialAccount\Card\CoinClient          $coin
27
 * @property \EasyWeChat\OfficialAccount\Card\SubMerchantClient   $sub_merchant
28
 * @property \EasyWeChat\OfficialAccount\Card\BoardingPassClient  $boarding_pass
29
 * @property \EasyWeChat\OfficialAccount\Card\JssdkClient         $jssdk
30
 * @property \EasyWeChat\OfficialAccount\Card\GiftCardClient      $gift_card
31
 * @property \EasyWeChat\OfficialAccount\Card\GiftCardOrderClient $gift_card_order
32
 * @property \EasyWeChat\OfficialAccount\Card\GiftCardPageClient  $gift_card_page
33
 * @property \EasyWeChat\OfficialAccount\Card\InvoiceClient       $invoice
34
 */
35
class Card extends Client
36
{
37
    /**
38
     * @param string $property
39
     *
40
     * @return mixed
41
     *
42
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException
43
     */
44 1
    public function __get($property)
45
    {
46 1
        if (isset($this->app["card.{$property}"])) {
47 1
            return $this->app["card.{$property}"];
48
        }
49
50 1
        throw new InvalidArgumentException(sprintf('No card service named "%s".', $property));
51
    }
52
}
53