|
@@ -7,7 +7,7 @@ class Response
|
7
|
7
|
|
8
|
8
|
protected $content = array();
|
9
|
9
|
|
10
|
|
- public function __construct($content)
|
|
10
|
+ public function __construct($content = array())
|
11
|
11
|
{
|
12
|
12
|
$this->content = $content;
|
13
|
13
|
}
|
|
@@ -17,9 +17,9 @@ class Response
|
17
|
17
|
return !$this->have($searched);
|
18
|
18
|
}
|
19
|
19
|
|
20
|
|
- public function have($searched, $not_empty = true, $content = null)
|
|
20
|
+ public function have($searched, $not_empty = true, $content = array())
|
21
|
21
|
{
|
22
|
|
- if (!$content)
|
|
22
|
+ if (!$content || !count($content))
|
23
|
23
|
$content = $this->content;
|
24
|
24
|
|
25
|
25
|
if (is_array($searched))
|
|
@@ -30,24 +30,27 @@ class Response
|
30
|
30
|
}
|
31
|
31
|
}
|
32
|
32
|
|
33
|
|
- if (array_key_exists($searched, $content))
|
|
33
|
+ if ($content)
|
34
|
34
|
{
|
35
|
|
- if ($not_empty)
|
|
35
|
+ if (array_key_exists($searched, $content))
|
36
|
36
|
{
|
37
|
|
- if ((is_null($content[$searched]) || !count($content[$searched]) || !$content[$searched]) && ($content[$searched] !== 0 && $content[$searched] !== '0'))
|
38
|
|
- {
|
39
|
|
- return false;
|
40
|
|
- }
|
41
|
|
- if (is_string($content[$searched]))
|
|
37
|
+ if ($not_empty)
|
42
|
38
|
{
|
43
|
|
- if (trim($content[$searched]) == '')
|
|
39
|
+ if ((is_null($content[$searched]) || !count($content[$searched]) || !$content[$searched]) && ($content[$searched] !== 0 && $content[$searched] !== '0'))
|
44
|
40
|
{
|
45
|
41
|
return false;
|
46
|
42
|
}
|
|
43
|
+ if (is_string($content[$searched]))
|
|
44
|
+ {
|
|
45
|
+ if (trim($content[$searched]) == '')
|
|
46
|
+ {
|
|
47
|
+ return false;
|
|
48
|
+ }
|
|
49
|
+ }
|
47
|
50
|
}
|
|
51
|
+
|
|
52
|
+ return true;
|
48
|
53
|
}
|
49
|
|
-
|
50
|
|
- return true;
|
51
|
54
|
}
|
52
|
55
|
|
53
|
56
|
return false;
|