SearchResults.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <?php
  2. /**
  3. * @category Magento
  4. * @package Magento_Code
  5. * Copyright © Magento, Inc. All rights reserved.
  6. * See COPYING.txt for license details.
  7. */
  8. namespace Magento\Framework\Api\Code\Generator;
  9. use Magento\Framework\Code\Generator\EntityAbstract;
  10. /**
  11. * Class Builder
  12. */
  13. class SearchResults extends EntityAbstract
  14. {
  15. /**
  16. * Entity type
  17. */
  18. const ENTITY_TYPE = 'searchResults';
  19. /**
  20. * Search result default class
  21. * @deprecated
  22. */
  23. const SEARCH_RESULT = '\\' . \Magento\Framework\Api\SearchResults::class;
  24. /**
  25. * Retrieve class properties
  26. *
  27. * @return array
  28. */
  29. protected function _getClassProperties()
  30. {
  31. return [];
  32. }
  33. /**
  34. * Returns list of methods for class generator
  35. *
  36. * @return array
  37. */
  38. protected function _getClassMethods()
  39. {
  40. $getItems = [
  41. 'name' => 'getItems',
  42. 'parameters' => [],
  43. 'body' => "return parent::getItems();",
  44. 'docblock' => [
  45. 'shortDescription' => 'Returns array of items',
  46. 'tags' => [
  47. [
  48. 'name' => 'return',
  49. 'description' => $this->getSourceClassName() . '[]',
  50. ],
  51. ],
  52. ],
  53. ];
  54. return [$getItems];
  55. }
  56. /**
  57. * Returns default constructor definition
  58. *
  59. * @return array
  60. */
  61. protected function _getDefaultConstructorDefinition()
  62. {
  63. return [];
  64. }
  65. /**
  66. * Generate code
  67. *
  68. * @return string
  69. */
  70. protected function _generateCode()
  71. {
  72. $this->_classGenerator->setName($this->_getResultClassName())
  73. ->setExtendedClass('\\' . \Magento\Framework\Api\SearchResults::class)
  74. ->addMethods($this->_getClassMethods());
  75. return $this->_getGeneratedCode();
  76. }
  77. }