Completed
Push — master ( 770142...55698b )
by Armando
01:37
created

PassportData::getData()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 6
c 0
b 0
f 0
ccs 0
cts 5
cp 0
rs 10
cc 2
nc 2
nop 0
crap 6
1
<?php
2
/**
3
 * This file is part of the TelegramBot package.
4
 *
5
 * (c) Avtandil Kikabidze aka LONGMAN <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace Longman\TelegramBot\Entities\TelegramPassport;
12
13
use Longman\TelegramBot\Entities\Entity;
14
15
/**
16
 * Class PassportData
17
 *
18
 * Contains information about Telegram Passport data shared with the bot by the user.
19
 *
20
 * @link https://core.telegram.org/bots/api#passportdata
21
 *
22
 * @method EncryptedCredentials getCredentials() Encrypted credentials required to decrypt the data
23
 **/
24
class PassportData extends Entity
25
{
26
    /**
27
     * {@inheritdoc}
28
     */
29
    protected function subEntities()
30
    {
31
        return [
32
            'data'        => EncryptedPassportElement::class,
33
            'credentials' => EncryptedCredentials::class,
34
        ];
35
    }
36
37
    /**
38
     * Array with information about documents and other Telegram Passport elements that was shared with the bot
39
     *
40
     * This method overrides the default getData method
41
     * and returns a nice array of EncryptedPassportElement objects.
42
     *
43
     * @return null|EncryptedPassportElement[]
44
     */
45
    public function getData()
46
    {
47
        $pretty_array = $this->makePrettyObjectArray(EncryptedPassportElement::class, 'data');
48
49
        return empty($pretty_array) ? null : $pretty_array;
50
    }
51
}
52