aboutsummaryrefslogtreecommitdiff
path: root/app/class/optlist.php
blob: cf68fa75ded110cf5785e09f1c695614d63a64c7 (plain)
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<?php

class Optlist extends Opt
{
    private $description = 0;
    private $thumbnail = 0;
    private $date = 0;
    private $author = 0;
    private $style = 0;


    /**
     * New constructor dedicated to parse input string
     * 
     * @param string|array $parsedstring parsed query string
     */
    public function __construct($datas = [])
    {
        if(is_string($datas)) {
            $datas = parse_str($this->options, $datas);

        }
        $this->hydrate($datas);
    }


    /**
     * Get the query as http string
     * 
     * @return string The resulted query
     */
    public function getquery() : string
    {
        $class = get_class_vars(get_class($this));
        $object = get_object_vars($this);
        $class['artvarlist'] = $object['artvarlist'];
        $class['taglist'] = $object['taglist'];
        $class['authorlist'] = $object['authorlist'];
        $query = array_diff_assoc_recursive($object, $class);

        return urldecode(http_build_query($query));
    }

    /**
     * Get the code to insert directly
     */
    public function getcode() : string
    {
        return '%LIST?' . $this->getquery() . '%';
    }



    // _______________________________________ G E T _____________________________________


    public function description()
    {
        return $this->description;
    }

    public function thumbnail()
    {
        return $this->thumbnail;
    }

    public function date()
    {
        return $this->date;
    }

    public function author()
    {
        return $this->author;
    }

    public function style()
    {
        return $this->style;
    }



    // _______________________________________ S E T _____________________________________

    public function setdescription($description)
    {
        $this->description = intval($description);
    }

    public function setthumbnail($thumbnail)
    {
        $this->thumbnail = intval($thumbnail);
    }

    public function setdate($date)
    {
        $this->date = intval($date);
    }

    public function setauthor($author)
    {
        $this->author = intval($author);
    }

    public function setstyle($style)
    {
        $this->style = intval($style);
    }
}



?>