Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Swagger.php
Go to the documentation of this file.
1 <?php
7 
9 
20 {
24  const SWAGGER_VERSION = '2.0';
25 
29  public function __construct()
30  {
31  $data = [
32  'swagger' => self::SWAGGER_VERSION,
33  'info' => [
34  'version' => '',
35  'title' => '',
36  ],
37  ];
38  parent::__construct($data);
39  }
40 
49  public function addPath($path, $httpOperation, $pathInfo)
50  {
51  $this->_data['paths'][$path][$httpOperation] = $pathInfo;
52  return $this;
53  }
54 
61  public function addTag($tagInfo)
62  {
63  $this->_data['tags'][] = $tagInfo;
64  return $this;
65  }
66 
72  public function toSchema()
73  {
74  return json_encode($this->toArray(), JSON_UNESCAPED_SLASHES);
75  }
76 
83  public function setInfo($info)
84  {
85  if (! is_array($info)) {
86  return $this;
87  }
88  if (isset($info['title'])) {
89  $this->_data['info']['title'] = $info['title'];
90  }
91  if (isset($info['version'])) {
92  $this->_data['info']['version'] = $info['version'];
93  }
94  return $this;
95  }
96 
103  public function setBasePath($basePath)
104  {
105  $this->_data['basePath'] = $basePath;
106  return $this;
107  }
108 }
addPath($path, $httpOperation, $pathInfo)
Definition: Swagger.php:49
foreach( $_productCollection as $_product)() ?>" class $info
Definition: listing.phtml:52