vendor/pimcore/pimcore/lib/Google/Cse/Item.php line 21

Open in your IDE?
  1. <?php
  2. /**
  3. * Pimcore
  4. *
  5. * This source file is available under two different licenses:
  6. * - GNU General Public License version 3 (GPLv3)
  7. * - Pimcore Commercial License (PCL)
  8. * Full copyright and license information is available in
  9. * LICENSE.md which is distributed with this source code.
  10. *
  11. * @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org)
  12. * @license http://www.pimcore.org/license GPLv3 and PCL
  13. */
  14. namespace Pimcore\Google\Cse;
  15. use Google\Service\CustomSearchAPI\Result;
  16. use Pimcore\Model;
  17. trigger_deprecation('pimcore/pimcore', '10.6', 'The "%s" class is deprecated and will be removed in Pimcore 11.', Item::class);
  18. /**
  19. * @deprecated since Pimcore 10.6 and will be removed in Pimcore 11
  20. */
  21. class Item
  22. {
  23. /**
  24. * @var Result
  25. */
  26. public $raw;
  27. /**
  28. * @var string
  29. */
  30. public $title;
  31. /**
  32. * @var string
  33. */
  34. public $htmlTitle;
  35. /**
  36. * @var string
  37. */
  38. public $link;
  39. /**
  40. * @var string
  41. */
  42. public $displayLink;
  43. /**
  44. * @var string
  45. */
  46. public $snippet;
  47. /**
  48. * @var string
  49. */
  50. public $htmlSnippet;
  51. /**
  52. * @var string
  53. */
  54. public $formattedUrl;
  55. /**
  56. * @var string
  57. */
  58. public $htmlFormattedUrl;
  59. /**
  60. * @var Model\Asset\Image|string|null
  61. */
  62. public $image;
  63. /**
  64. * @var Model\Document|null
  65. */
  66. public $document;
  67. /**
  68. * @var string
  69. */
  70. public $type;
  71. /**
  72. * @param Result $data
  73. */
  74. public function __construct(Result $data)
  75. {
  76. $this->setRaw($data);
  77. $this->setValues($data);
  78. }
  79. /**
  80. * @param Result $data
  81. *
  82. * @return $this
  83. */
  84. public function setValues(Result $data)
  85. {
  86. $properties = get_object_vars($data);
  87. foreach ($properties as $key => $value) {
  88. $this->setValue($key, $value);
  89. }
  90. return $this;
  91. }
  92. /**
  93. * @param string $key
  94. * @param mixed $value
  95. *
  96. * @return $this
  97. */
  98. public function setValue($key, $value)
  99. {
  100. $method = 'set' . $key;
  101. if (method_exists($this, $method)) {
  102. $this->$method($value);
  103. }
  104. return $this;
  105. }
  106. /**
  107. * @param string $displayLink
  108. *
  109. * @return $this
  110. */
  111. public function setDisplayLink($displayLink)
  112. {
  113. $this->displayLink = $displayLink;
  114. return $this;
  115. }
  116. /**
  117. * @return string
  118. */
  119. public function getDisplayLink()
  120. {
  121. return $this->displayLink;
  122. }
  123. /**
  124. * @param Model\Document $document
  125. *
  126. * @return $this
  127. */
  128. public function setDocument($document)
  129. {
  130. $this->document = $document;
  131. return $this;
  132. }
  133. /**
  134. * @return Model\Document|null
  135. */
  136. public function getDocument()
  137. {
  138. return $this->document;
  139. }
  140. /**
  141. * @param string $formattedUrl
  142. *
  143. * @return $this
  144. */
  145. public function setFormattedUrl($formattedUrl)
  146. {
  147. $this->formattedUrl = $formattedUrl;
  148. return $this;
  149. }
  150. /**
  151. * @return string
  152. */
  153. public function getFormattedUrl()
  154. {
  155. return $this->formattedUrl;
  156. }
  157. /**
  158. * @param string $htmlFormattedUrl
  159. *
  160. * @return $this
  161. */
  162. public function setHtmlFormattedUrl($htmlFormattedUrl)
  163. {
  164. $this->htmlFormattedUrl = $htmlFormattedUrl;
  165. return $this;
  166. }
  167. /**
  168. * @return string
  169. */
  170. public function getHtmlFormattedUrl()
  171. {
  172. return $this->htmlFormattedUrl;
  173. }
  174. /**
  175. * @param string $htmlSnippet
  176. *
  177. * @return $this
  178. */
  179. public function setHtmlSnippet($htmlSnippet)
  180. {
  181. $this->htmlSnippet = $htmlSnippet;
  182. return $this;
  183. }
  184. /**
  185. * @return string
  186. */
  187. public function getHtmlSnippet()
  188. {
  189. return $this->htmlSnippet;
  190. }
  191. /**
  192. * @param string $htmlTitle
  193. *
  194. * @return $this
  195. */
  196. public function setHtmlTitle($htmlTitle)
  197. {
  198. $this->htmlTitle = $htmlTitle;
  199. return $this;
  200. }
  201. /**
  202. * @return string
  203. */
  204. public function getHtmlTitle()
  205. {
  206. return $this->htmlTitle;
  207. }
  208. /**
  209. * @param Model\Asset\Image|string $image
  210. *
  211. * @return $this
  212. */
  213. public function setImage($image)
  214. {
  215. $this->image = $image;
  216. return $this;
  217. }
  218. /**
  219. * @return Model\Asset\Image|string|null
  220. */
  221. public function getImage()
  222. {
  223. return $this->image;
  224. }
  225. /**
  226. * @param string $link
  227. *
  228. * @return $this
  229. */
  230. public function setLink($link)
  231. {
  232. $this->link = $link;
  233. return $this;
  234. }
  235. /**
  236. * @return string
  237. */
  238. public function getLink()
  239. {
  240. return $this->link;
  241. }
  242. /**+
  243. * @param Result $raw
  244. * @return $this
  245. */
  246. public function setRaw(Result $raw)
  247. {
  248. $this->raw = $raw;
  249. return $this;
  250. }
  251. /**
  252. * @return Result
  253. */
  254. public function getRaw()
  255. {
  256. return $this->raw;
  257. }
  258. /**
  259. * @param string $snippet
  260. *
  261. * @return $this
  262. */
  263. public function setSnippet($snippet)
  264. {
  265. $this->snippet = $snippet;
  266. return $this;
  267. }
  268. /**
  269. * @return string
  270. */
  271. public function getSnippet()
  272. {
  273. return $this->snippet;
  274. }
  275. /**
  276. * @param string $title
  277. *
  278. * @return $this
  279. */
  280. public function setTitle($title)
  281. {
  282. $this->title = $title;
  283. return $this;
  284. }
  285. /**
  286. * @return string
  287. */
  288. public function getTitle()
  289. {
  290. return $this->title;
  291. }
  292. /**
  293. * @param string $type
  294. *
  295. * @return $this
  296. */
  297. public function setType($type)
  298. {
  299. $this->type = $type;
  300. return $this;
  301. }
  302. /**
  303. * @return string
  304. */
  305. public function getType()
  306. {
  307. return $this->type;
  308. }
  309. }