2020
2121namespace SwaggerModule \Controller ;
2222
23+ use Swagger \Annotations \Swagger ;
2324use Zend \Mvc \Controller \AbstractActionController ;
2425use Zend \View \Model \JsonModel ;
2526
2829 */
2930class DocumentationController extends AbstractActionController
3031{
32+ protected $ swagger ;
33+
34+ public function setSwagger (Swagger $ swagger ) {
35+ $ this ->swagger = $ swagger ;
36+ }
37+
3138 /**
3239 * Display the documentation
3340 *
3441 * @return JsonModel
3542 */
3643 public function displayAction ()
3744 {
38- /** @var $swagger \Swagger\Annotations\Swagger */
39- $ swagger = $ this ->serviceLocator ->get ('Swagger\Annotations\Swagger ' );
40- $ jsonModel = new JsonModel ((array )$ swagger ->jsonSerialize ());
45+ $ jsonModel = new JsonModel ((array )$ this ->swagger ->jsonSerialize ());
4146 return $ jsonModel ;
4247 }
4348
@@ -48,13 +53,10 @@ public function displayAction()
4853 */
4954 public function detailsAction ()
5055 {
51- /** @var $swagger \Swagger\Swagger */
52- $ swagger = $ this ->serviceLocator ->get ('Swagger\Annotations\Swagger ' );
53-
5456 /** @var $options \SwaggerModule\Options\ModuleOptions */
5557 $ options = $ this ->serviceLocator ->get ('SwaggerModule\Options\ModuleOptions ' );
5658 $ resourceOptions = $ options ->getResourceOptions () ? : array ();
57- $ resource = $ swagger ->getResource ('/ ' . $ this ->params ('resource ' , null ), $ resourceOptions );
59+ $ resource = $ this -> swagger ->getResource ('/ ' . $ this ->params ('resource ' , null ), $ resourceOptions );
5860
5961 if ($ resource === false ) {
6062 return new JsonModel ();
0 commit comments