@@ 29-133 (lines=105) @@ | ||
26 | * @package Elastification\Client\Response\V090x |
|
27 | * @author Daniel Wendlandt |
|
28 | */ |
|
29 | class DocumentResponse extends Response |
|
30 | { |
|
31 | ||
32 | const PROP_ID = '_id'; |
|
33 | const PROP_SOURCE = '_source'; |
|
34 | const PROP_EXISTS = 'exists'; |
|
35 | const PROP_VERSION = '_version'; |
|
36 | const PROP_INDEX = '_index'; |
|
37 | const PROP_TYPE = '_type'; |
|
38 | ||
39 | /** |
|
40 | * checks if source exists |
|
41 | * |
|
42 | * @return bool |
|
43 | * @author Daniel Wendlandt |
|
44 | */ |
|
45 | public function hasSource() |
|
46 | { |
|
47 | $this->processData(); |
|
48 | ||
49 | return $this->has(self::PROP_SOURCE); |
|
50 | } |
|
51 | ||
52 | /** |
|
53 | * gets the source of the response |
|
54 | * |
|
55 | * @return array |
|
56 | * @throws \Elastification\Client\Exception\ResponseException |
|
57 | * @author Daniel Wendlandt |
|
58 | */ |
|
59 | public function getSource() |
|
60 | { |
|
61 | if (!$this->hasSource()) { |
|
62 | throw new ResponseException(self::PROP_SOURCE . ' is not set.'); |
|
63 | } |
|
64 | ||
65 | return $this->get(self::PROP_SOURCE); |
|
66 | } |
|
67 | ||
68 | /** |
|
69 | * Getter Method |
|
70 | * |
|
71 | * @return mixed |
|
72 | * @author Daniel Wendlandt |
|
73 | */ |
|
74 | public function exists() |
|
75 | { |
|
76 | $this->processData(); |
|
77 | ||
78 | return $this->get(self::PROP_EXISTS); |
|
79 | } |
|
80 | ||
81 | /** |
|
82 | * Getter Method |
|
83 | * |
|
84 | * @return mixed |
|
85 | * @author Daniel Wendlandt |
|
86 | */ |
|
87 | public function getId() |
|
88 | { |
|
89 | $this->processData(); |
|
90 | ||
91 | return $this->get(self::PROP_ID); |
|
92 | } |
|
93 | ||
94 | /** |
|
95 | * Getter Method |
|
96 | * |
|
97 | * @return mixed |
|
98 | * @author Daniel Wendlandt |
|
99 | */ |
|
100 | public function getVersion() |
|
101 | { |
|
102 | $this->processData(); |
|
103 | ||
104 | return $this->get(self::PROP_VERSION); |
|
105 | } |
|
106 | ||
107 | /** |
|
108 | * Getter Method |
|
109 | * |
|
110 | * @return mixed |
|
111 | * @author Daniel Wendlandt |
|
112 | */ |
|
113 | public function getIndex() |
|
114 | { |
|
115 | $this->processData(); |
|
116 | ||
117 | return $this->get(self::PROP_INDEX); |
|
118 | } |
|
119 | ||
120 | /** |
|
121 | * Getter Method |
|
122 | * |
|
123 | * @return mixed |
|
124 | * @author Daniel Wendlandt |
|
125 | */ |
|
126 | public function getType() |
|
127 | { |
|
128 | $this->processData(); |
|
129 | ||
130 | return $this->get(self::PROP_TYPE); |
|
131 | } |
|
132 | ||
133 | } |
|
134 |
@@ 27-97 (lines=71) @@ | ||
24 | * @package Elastification\Client\Response\V1x |
|
25 | * @author Daniel Wendlandt |
|
26 | */ |
|
27 | class DocumentResponse extends Response |
|
28 | { |
|
29 | const PROP_ID = '_id'; |
|
30 | const PROP_SOURCE = '_source'; |
|
31 | const PROP_FOUND = 'found'; |
|
32 | const PROP_VERSION = '_version'; |
|
33 | const PROP_INDEX = '_index'; |
|
34 | const PROP_TYPE = '_type'; |
|
35 | ||
36 | /** |
|
37 | * checks if source exists |
|
38 | * |
|
39 | * @return bool |
|
40 | */ |
|
41 | public function hasSource() |
|
42 | { |
|
43 | $this->processData(); |
|
44 | ||
45 | return $this->has(self::PROP_SOURCE); |
|
46 | } |
|
47 | ||
48 | /** |
|
49 | * gets the source of the response |
|
50 | * |
|
51 | * @return array |
|
52 | * @throws \Elastification\Client\Exception\ResponseException |
|
53 | */ |
|
54 | public function getSource() |
|
55 | { |
|
56 | if (!$this->hasSource()) { |
|
57 | throw new ResponseException(self::PROP_SOURCE . ' is not set.'); |
|
58 | } |
|
59 | ||
60 | return $this->get(self::PROP_SOURCE); |
|
61 | } |
|
62 | ||
63 | public function found() |
|
64 | { |
|
65 | $this->processData(); |
|
66 | ||
67 | return $this->get(self::PROP_FOUND); |
|
68 | } |
|
69 | ||
70 | public function getId() |
|
71 | { |
|
72 | $this->processData(); |
|
73 | ||
74 | return $this->get(self::PROP_ID); |
|
75 | } |
|
76 | ||
77 | public function getVersion() |
|
78 | { |
|
79 | $this->processData(); |
|
80 | ||
81 | return $this->get(self::PROP_VERSION); |
|
82 | } |
|
83 | ||
84 | public function getIndex() |
|
85 | { |
|
86 | $this->processData(); |
|
87 | ||
88 | return $this->get(self::PROP_INDEX); |
|
89 | } |
|
90 | ||
91 | public function getType() |
|
92 | { |
|
93 | $this->processData(); |
|
94 | ||
95 | return $this->get(self::PROP_TYPE); |
|
96 | } |
|
97 | } |
|
98 |
@@ 27-97 (lines=71) @@ | ||
24 | * @package Elastification\Client\Response\V2x |
|
25 | * @author Daniel Wendlandt |
|
26 | */ |
|
27 | class DocumentResponse extends Response |
|
28 | { |
|
29 | const PROP_ID = '_id'; |
|
30 | const PROP_SOURCE = '_source'; |
|
31 | const PROP_FOUND = 'found'; |
|
32 | const PROP_VERSION = '_version'; |
|
33 | const PROP_INDEX = '_index'; |
|
34 | const PROP_TYPE = '_type'; |
|
35 | ||
36 | /** |
|
37 | * checks if source exists |
|
38 | * |
|
39 | * @return bool |
|
40 | */ |
|
41 | public function hasSource() |
|
42 | { |
|
43 | $this->processData(); |
|
44 | ||
45 | return $this->has(self::PROP_SOURCE); |
|
46 | } |
|
47 | ||
48 | /** |
|
49 | * gets the source of the response |
|
50 | * |
|
51 | * @return array |
|
52 | * @throws \Elastification\Client\Exception\ResponseException |
|
53 | */ |
|
54 | public function getSource() |
|
55 | { |
|
56 | if (!$this->hasSource()) { |
|
57 | throw new ResponseException(self::PROP_SOURCE . ' is not set.'); |
|
58 | } |
|
59 | ||
60 | return $this->get(self::PROP_SOURCE); |
|
61 | } |
|
62 | ||
63 | public function found() |
|
64 | { |
|
65 | $this->processData(); |
|
66 | ||
67 | return $this->get(self::PROP_FOUND); |
|
68 | } |
|
69 | ||
70 | public function getId() |
|
71 | { |
|
72 | $this->processData(); |
|
73 | ||
74 | return $this->get(self::PROP_ID); |
|
75 | } |
|
76 | ||
77 | public function getVersion() |
|
78 | { |
|
79 | $this->processData(); |
|
80 | ||
81 | return $this->get(self::PROP_VERSION); |
|
82 | } |
|
83 | ||
84 | public function getIndex() |
|
85 | { |
|
86 | $this->processData(); |
|
87 | ||
88 | return $this->get(self::PROP_INDEX); |
|
89 | } |
|
90 | ||
91 | public function getType() |
|
92 | { |
|
93 | $this->processData(); |
|
94 | ||
95 | return $this->get(self::PROP_TYPE); |
|
96 | } |
|
97 | } |
|
98 |