self::SWAGGER_VERSION, 'info' => [ 'version' => '', 'title' => '', ], ]; parent::__construct($data); } /** * Add a path * * @param string $path * @param string $httpOperation * @param string[] $pathInfo * @return $this */ public function addPath($path, $httpOperation, $pathInfo) { $this->_data['paths'][$path][$httpOperation] = $pathInfo; return $this; } /** * Add a tag * * @param string $tagInfo * @return $this */ public function addTag($tagInfo) { $this->_data['tags'][] = $tagInfo; return $this; } /** * Get JSON encoded REST schema * * @return string */ public function toSchema() { return json_encode($this->toArray(), JSON_UNESCAPED_SLASHES); } /** * Add Info section data * * @param array $info * @return $this */ public function setInfo($info) { if (! is_array($info)) { return $this; } if (isset($info['title'])) { $this->_data['info']['title'] = $info['title']; } if (isset($info['version'])) { $this->_data['info']['version'] = $info['version']; } return $this; } /** * Set base path * * @param string $basePath * @return $this */ public function setBasePath($basePath) { $this->_data['basePath'] = $basePath; return $this; } }