phpMv
-UI toolkit 2.4.12
jQuery, jQuery UI, Twitter Bootstrap and Semantic-UI library for php & php MVC Frameworks
Loading...
Searching...
No Matches
SearchResult.php
Go to the documentation of this file.
1
<?php
2
3
namespace
Ajax\semantic\components\search
;
4
5
class
SearchResult
implements
\JsonSerializable {
6
private
$id
;
7
private
$title
;
8
private
$description
;
9
private
$image
;
10
private
$price
;
11
12
public
function
__construct
(
$id
=NULL,
$title
=NULL,
$description
=NULL,
$image
=NULL,
$price
=NULL) {
13
if
(\is_array(
$id
)) {
14
$this->
fromArray
(
$id
);
15
}
else
{
16
$this->
id
=
$id
;
17
$this->title=
$title
;
18
$this->description=
$description
;
19
$this->image=
$image
;
20
$this->price=
$price
;
21
}
22
}
23
24
public
function
getId
() {
25
return
$this->id
;
26
}
27
28
public
function
setId
(
$id
) {
29
$this->
id
=
$id
;
30
return
$this;
31
}
32
33
public
function
getTitle
() {
34
return
$this->title
;
35
}
36
37
public
function
setTitle
(
$title
) {
38
$this->title=
$title
;
39
return
$this;
40
}
41
42
public
function
getDescription
() {
43
return
$this->description
;
44
}
45
46
public
function
setDescription
(
$description
) {
47
$this->description=
$description
;
48
return
$this;
49
}
50
51
public
function
getImage
() {
52
return
$this->image
;
53
}
54
55
public
function
setImage
(
$image
) {
56
$this->image=
$image
;
57
return
$this;
58
}
59
60
public
function
getPrice
() {
61
return
$this->price
;
62
}
63
64
public
function
setPrice
(
$price
) {
65
$this->price=
$price
;
66
return
$this;
67
}
68
69
public
function
fromArray
($array) {
70
foreach
( $array as $key => $value ) {
71
$this->{$key}=$value;
72
}
73
return
$this;
74
}
75
76
public
function
asArray
() {
77
return
$this->
JsonSerialize
();
78
}
79
80
public
function
JsonSerialize
() {
81
$vars=get_object_vars($this);
82
$result=array ();
83
foreach
( $vars as $k => $v ) {
84
if
(isset($v))
85
$result[$k]=$v;
86
}
87
return
$result;
88
}
89
90
public
function
search
($query, $field=
"title"
) {
91
$value=$this->$field;
92
return \stripos($value, $query) !==
false
;
93
}
94
}
Ajax\semantic\components\search\SearchResult
Definition
SearchResult.php:5
Ajax\semantic\components\search\SearchResult\getId
getId()
Definition
SearchResult.php:24
Ajax\semantic\components\search\SearchResult\asArray
asArray()
Definition
SearchResult.php:76
Ajax\semantic\components\search\SearchResult\$price
$price
Definition
SearchResult.php:10
Ajax\semantic\components\search\SearchResult\getImage
getImage()
Definition
SearchResult.php:51
Ajax\semantic\components\search\SearchResult\JsonSerialize
JsonSerialize()
Definition
SearchResult.php:80
Ajax\semantic\components\search\SearchResult\setPrice
setPrice($price)
Definition
SearchResult.php:64
Ajax\semantic\components\search\SearchResult\getDescription
getDescription()
Definition
SearchResult.php:42
Ajax\semantic\components\search\SearchResult\setDescription
setDescription($description)
Definition
SearchResult.php:46
Ajax\semantic\components\search\SearchResult\getPrice
getPrice()
Definition
SearchResult.php:60
Ajax\semantic\components\search\SearchResult\fromArray
fromArray($array)
Definition
SearchResult.php:69
Ajax\semantic\components\search\SearchResult\setId
setId($id)
Definition
SearchResult.php:28
Ajax\semantic\components\search\SearchResult\$description
$description
Definition
SearchResult.php:8
Ajax\semantic\components\search\SearchResult\setTitle
setTitle($title)
Definition
SearchResult.php:37
Ajax\semantic\components\search\SearchResult\getTitle
getTitle()
Definition
SearchResult.php:33
Ajax\semantic\components\search\SearchResult\$image
$image
Definition
SearchResult.php:9
Ajax\semantic\components\search\SearchResult\$title
$title
Definition
SearchResult.php:7
Ajax\semantic\components\search\SearchResult\search
search($query, $field="title")
Definition
SearchResult.php:90
Ajax\semantic\components\search\SearchResult\$id
$id
Definition
SearchResult.php:6
Ajax\semantic\components\search\SearchResult\__construct
__construct($id=NULL, $title=NULL, $description=NULL, $image=NULL, $price=NULL)
Definition
SearchResult.php:12
Ajax\semantic\components\search\SearchResult\setImage
setImage($image)
Definition
SearchResult.php:55
Ajax\semantic\components\search
Definition
AbstractSearchResult.php:3
Ajax
semantic
components
search
SearchResult.php
Generated on Sun Dec 10 2023 16:16:00 for
phpMv-UI
by
doxygen
1.9.8