From 1c547e959880c2ca1b2273cbc6663ea7e61c3f58 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Fri, 27 Mar 2015 22:40:59 +0800 Subject: [PATCH] update php documentation --- .../src/main/resources/php/api.mustache | 7 +- samples/client/petstore/php/PetApi.php | 66 ++++++++----------- samples/client/petstore/php/StoreApi.php | 26 ++++---- samples/client/petstore/php/UserApi.php | 58 +++++++--------- 4 files changed, 68 insertions(+), 89 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/php/api.mustache b/modules/swagger-codegen/src/main/resources/php/api.mustache index bdf66defcaf..375ff8a4f48 100644 --- a/modules/swagger-codegen/src/main/resources/php/api.mustache +++ b/modules/swagger-codegen/src/main/resources/php/api.mustache @@ -31,11 +31,10 @@ class {{classname}} { * {{{nickname}}} * * {{{summary}}} - {{#allParams}}* {{paramName}}, {{dataType}}: {{description}} {{^optional}}(required){{/optional}}{{#optional}}(optional){{/optional}} - * {{/allParams}} - * @return {{{returnType}}} + * +{{#allParams}} * @param {{dataType}} ${{paramName}} {{description}} {{^optional}}(required){{/optional}}{{#optional}}(optional){{/optional}} +{{/allParams}} * @return {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}} */ - public function {{nickname}}({{#allParams}}${{paramName}}{{#optional}}=null{{/optional}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) { // parse inputs diff --git a/samples/client/petstore/php/PetApi.php b/samples/client/petstore/php/PetApi.php index 49f623b4da4..25c3ea24bd7 100644 --- a/samples/client/petstore/php/PetApi.php +++ b/samples/client/petstore/php/PetApi.php @@ -30,11 +30,10 @@ class PetApi { * updatePet * * Update an existing pet - * body, Pet: Pet object that needs to be added to the store (required) - * - * @return + * + * @param Pet $body Pet object that needs to be added to the store (required) + * @return void */ - public function updatePet($body) { // parse inputs @@ -76,11 +75,10 @@ class PetApi { * addPet * * Add a new pet to the store - * body, Pet: Pet object that needs to be added to the store (required) - * - * @return + * + * @param Pet $body Pet object that needs to be added to the store (required) + * @return void */ - public function addPet($body) { // parse inputs @@ -122,11 +120,10 @@ class PetApi { * findPetsByStatus * * Finds Pets by status - * status, array[string]: Status values that need to be considered for filter (required) - * - * @return array[Pet] + * + * @param array[string] $status Status values that need to be considered for filter (required) + * @return array[Pet] */ - public function findPetsByStatus($status) { // parse inputs @@ -173,11 +170,10 @@ class PetApi { * findPetsByTags * * Finds Pets by tags - * tags, array[string]: Tags to filter by (required) - * - * @return array[Pet] + * + * @param array[string] $tags Tags to filter by (required) + * @return array[Pet] */ - public function findPetsByTags($tags) { // parse inputs @@ -224,11 +220,10 @@ class PetApi { * getPetById * * Find pet by ID - * pet_id, int: ID of pet that needs to be fetched (required) - * - * @return Pet + * + * @param int $pet_id ID of pet that needs to be fetched (required) + * @return Pet */ - public function getPetById($pet_id) { // parse inputs @@ -276,13 +271,12 @@ class PetApi { * updatePetWithForm * * Updates a pet in the store with form data - * pet_id, string: ID of pet that needs to be updated (required) - * * name, string: Updated name of the pet (required) - * * status, string: Updated status of the pet (required) - * - * @return + * + * @param string $pet_id ID of pet that needs to be updated (required) + * @param string $name Updated name of the pet (required) + * @param string $status Updated status of the pet (required) + * @return void */ - public function updatePetWithForm($pet_id, $name, $status) { // parse inputs @@ -330,12 +324,11 @@ class PetApi { * deletePet * * Deletes a pet - * api_key, string: (required) - * * pet_id, int: Pet id to delete (required) - * - * @return + * + * @param string $api_key (required) + * @param int $pet_id Pet id to delete (required) + * @return void */ - public function deletePet($api_key, $pet_id) { // parse inputs @@ -380,13 +373,12 @@ class PetApi { * uploadFile * * uploads an image - * pet_id, int: ID of pet to update (required) - * * additional_metadata, string: Additional data to pass to server (required) - * * file, file: file to upload (required) - * - * @return + * + * @param int $pet_id ID of pet to update (required) + * @param string $additional_metadata Additional data to pass to server (required) + * @param file $file file to upload (required) + * @return void */ - public function uploadFile($pet_id, $additional_metadata, $file) { // parse inputs diff --git a/samples/client/petstore/php/StoreApi.php b/samples/client/petstore/php/StoreApi.php index 12b46286502..fbd2fc0afe5 100644 --- a/samples/client/petstore/php/StoreApi.php +++ b/samples/client/petstore/php/StoreApi.php @@ -30,10 +30,9 @@ class StoreApi { * getInventory * * Returns pet inventories by status - - * @return map[string,int] + * + * @return map[string,int] */ - public function getInventory() { // parse inputs @@ -77,11 +76,10 @@ class StoreApi { * placeOrder * * Place an order for a pet - * body, Order: order placed for purchasing the pet (required) - * - * @return Order + * + * @param Order $body order placed for purchasing the pet (required) + * @return Order */ - public function placeOrder($body) { // parse inputs @@ -129,11 +127,10 @@ class StoreApi { * getOrderById * * Find purchase order by ID - * order_id, string: ID of pet that needs to be fetched (required) - * - * @return Order + * + * @param string $order_id ID of pet that needs to be fetched (required) + * @return Order */ - public function getOrderById($order_id) { // parse inputs @@ -181,11 +178,10 @@ class StoreApi { * deleteOrder * * Delete purchase order by ID - * order_id, string: ID of the order that needs to be deleted (required) - * - * @return + * + * @param string $order_id ID of the order that needs to be deleted (required) + * @return void */ - public function deleteOrder($order_id) { // parse inputs diff --git a/samples/client/petstore/php/UserApi.php b/samples/client/petstore/php/UserApi.php index cd5d197394b..9e0b5280e46 100644 --- a/samples/client/petstore/php/UserApi.php +++ b/samples/client/petstore/php/UserApi.php @@ -30,11 +30,10 @@ class UserApi { * createUser * * Create user - * body, User: Created user object (required) - * - * @return + * + * @param User $body Created user object (required) + * @return void */ - public function createUser($body) { // parse inputs @@ -76,11 +75,10 @@ class UserApi { * createUsersWithArrayInput * * Creates list of users with given input array - * body, array[User]: List of user object (required) - * - * @return + * + * @param array[User] $body List of user object (required) + * @return void */ - public function createUsersWithArrayInput($body) { // parse inputs @@ -122,11 +120,10 @@ class UserApi { * createUsersWithListInput * * Creates list of users with given input array - * body, array[User]: List of user object (required) - * - * @return + * + * @param array[User] $body List of user object (required) + * @return void */ - public function createUsersWithListInput($body) { // parse inputs @@ -168,12 +165,11 @@ class UserApi { * loginUser * * Logs user into the system - * username, string: The user name for login (required) - * * password, string: The password for login in clear text (required) - * - * @return string + * + * @param string $username The user name for login (required) + * @param string $password The password for login in clear text (required) + * @return string */ - public function loginUser($username, $password) { // parse inputs @@ -223,10 +219,9 @@ class UserApi { * logoutUser * * Logs out current logged in user session - - * @return + * + * @return void */ - public function logoutUser() { // parse inputs @@ -264,11 +259,10 @@ class UserApi { * getUserByName * * Get user by user name - * username, string: The name that needs to be fetched. Use user1 for testing. (required) - * - * @return User + * + * @param string $username The name that needs to be fetched. Use user1 for testing. (required) + * @return User */ - public function getUserByName($username) { // parse inputs @@ -316,12 +310,11 @@ class UserApi { * updateUser * * Updated user - * username, string: name that need to be deleted (required) - * * body, User: Updated user object (required) - * - * @return + * + * @param string $username name that need to be deleted (required) + * @param User $body Updated user object (required) + * @return void */ - public function updateUser($username, $body) { // parse inputs @@ -367,11 +360,10 @@ class UserApi { * deleteUser * * Delete user - * username, string: The name that needs to be deleted (required) - * - * @return + * + * @param string $username The name that needs to be deleted (required) + * @return void */ - public function deleteUser($username) { // parse inputs