Xmlrpc_client::setVar()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 2
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
//
3
// ------------------------------------------------------------------------ //
4
// This program is free software; you can redistribute it and/or modify     //
5
// it under the terms of the GNU General Public License as published by     //
6
// the Free Software Foundation; either version 2 of the License, or        //
7
// (at your option) any later version.                                      //
8
//                                                                          //
9
// You may not change or alter any portion of this comment or credits       //
10
// of supporting developers from this source code or any supporting         //
11
// source code which is considered copyrighted (c) material of the          //
12
// original comment or credit authors.                                      //
13
//                                                                          //
14
// This program is distributed in the hope that it will be useful,          //
15
// but WITHOUT ANY WARRANTY; without even the implied warranty of           //
16
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            //
17
// GNU General Public License for more details.                             //
18
//                                                                          //
19
// You should have received a copy of the GNU General Public License        //
20
// along with this program; if not, write to the Free Software              //
21
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
22
// ------------------------------------------------------------------------ //
23
// Author: phppp (D.J., [email protected])                                  //
24
// URL: https://xoops.org                         //
25
// Project: Article Project                                                 //
26
// ------------------------------------------------------------------------ //
27
28
// defined('XOOPS_ROOT_PATH') || die('Restricted access');
29
require_once __DIR__ . '/../include/vars.php';
30
//mod_loadFunctions('', $GLOBALS['moddirname']);
31
32
if (!class_exists('Xmlrpc_client')) {
33
    /**
34
     * Class Xmlrpc_client
35
     */
36
    class Xmlrpc_client
37
    {
38
        /**
39
         * Xmlrpc_client constructor.
40
         */
41
        public function __construct()
42
        {
43
        }
44
45
        /**
46
         * @param $article
47
         */
48
        public function setObject(&$article)
0 ignored issues
show
Unused Code introduced by
The parameter $article is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
49
        {
50
            $this->$var = $val;
0 ignored issues
show
Bug introduced by
The variable $var does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
Bug introduced by
The variable $val does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
51
        }
52
53
        /**
54
         * @param $var
55
         * @param $val
56
         */
57
        public function setVar($var, $val)
58
        {
59
            $this->$var = $val;
60
        }
61
62
        /**
63
         * @param $var
64
         * @return mixed
65
         */
66
        public function getVar($var)
67
        {
68
            return $this->$var;
69
        }
70
    }
71
}
72
73
if (!class_exists('Xmlrpc_server')) {
74
    /**
75
     * Class Xmlrpc_server
76
     */
77
    class Xmlrpc_server
78
    {
79
        /**
80
         * Xmlrpc_server constructor.
81
         */
82
        public function __construct()
83
        {
84
        }
85
86
        /**
87
         * @param $var
88
         * @param $val
89
         */
90
        public function setVar($var, $val)
91
        {
92
            $this->$var = $val;
93
        }
94
95
        /**
96
         * @param $var
97
         * @return mixed
98
         */
99
        public function getVar($var)
100
        {
101
            return $this->$var;
102
        }
103
    }
104
}
105
106
PlanetUtility::planetParseClass('
107
class [CLASS_PREFIX]XmlrpcHandler
108
{
109
    public function &get($type="c")
110
    {
111
        switch (strtolower($type)) {
112
            case "s":
113
            case "server":
114
            return new Xmlrpc_server();
115
            case "c":
116
            case "client":
117
            return new Xmlrpc_client();
118
        }
119
    }
120
121
    public function display(&$feed, $filename="")
122
    {
123
        if(!is_object($feed)) return null;
124
        $filename=empty($filename)?$feed->filename:$filename;
125
        echo $feed->saveFeed($feed->version, $filename);
126
    }
127
128
    public function utf8_encode(&$feed)
129
    {
130
        if(!is_object($feed)) return null;
131
        $text = xoops_utf8_encode(serialize($feed));
132
        $feed = unserialize($text);
133
    }
134
}
135
');
136