Share.php
823 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
/**
 * Created by PhpStorm.
 * User: Hanson
 * Date: 2017/1/15
 * Time: 12:29
 */
namespace Hanson\Vbot\Message\Entity;
use Hanson\Vbot\Message\MessageInterface;
class Share extends Message implements MessageInterface
{
    public $title;
    public $description;
    public $url;
    public $app;
    public function __construct($msg)
    {
        parent::__construct($msg);
        $this->make();
    }
    public function make()
    {
        $array = (array)simplexml_load_string($this->msg['Content'], 'SimpleXMLElement', LIBXML_NOCDATA);
        $info = (array)$array['appmsg'];
        $this->title = $info['title'];
        $this->description = $info['des'];
        $appInfo = (array)$array['appinfo'];
        $this->app = $appInfo['appname'];
        $this->url = $this->msg['Url'];
    }
}