Fix php style

This commit is contained in:
osaajani 2020-01-17 18:19:25 +01:00
parent 461bd9c98d
commit b8bd067dc7
59 changed files with 2307 additions and 1868 deletions

View file

@ -12,34 +12,37 @@
namespace models;
/**
* Class for user table administration. Not a standard model because has absolutly no user based restrictions
* Class for user table administration. Not a standard model because has absolutly no user based restrictions.
*/
class User extends \descartes\Model
{
/**
* Find a user by his id
* Find a user by his id.
*
* @param string $id : User id
*
* @return mixed array
*/
public function get ($id)
public function get($id)
{
return $this->_select_one('user', ['id' => $id]);
}
/**
* Find a user using his email
* Find a user using his email.
*
* @param string $email : User email
*
* @return mixed array
*/
public function get_by_email($email)
{
return $this->_select_one('user', ['email' => $email]);
}
/**
* Get a user by his api_key address
* Get a user by his api_key address.
*
* @param string $api_key : User api key
*
* @return mixed boolean | array : false if cannot find user for this api key, the user else
@ -49,7 +52,6 @@ namespace models;
return $this->_select_one('user', ['api_key' => $api_key]);
}
/**
* Return list of user.
*
@ -61,7 +63,6 @@ namespace models;
return $this->_select('user', [], null, false, $limit, $offset);
}
/**
* Retourne une liste de useres sous forme d'un tableau.
*
@ -75,23 +76,26 @@ namespace models;
return $this->_delete('user', ['id' => $id]);
}
/**
* Insert a new user
* Insert a new user.
*
* @param array $user : User to insert
*
* @return mixed bool|int : false if fail, new user id else
*/
public function insert($user)
{
$success = $this->_insert('user', $user);
return ($success ? $this->_last_id() : false);
return $success ? $this->_last_id() : false;
}
/**
* Update a user using his is
* @param int $id : User id
* Update a user using his is.
*
* @param int $id : User id
* @param array $datas : Datas to update
*
* @return int : number of modified rows
*/
public function update($id, $datas)
@ -99,11 +103,12 @@ namespace models;
return $this->_update('user', $datas, ['id' => $id]);
}
/**
* Update a user password by his id.
*
* @param int $id : User id
* @param array $password : The new password of the user
*
* @return int : Number of modified lines
*/
public function update_password($id, $password)
@ -111,11 +116,12 @@ namespace models;
return $this->_update('user', ['password' => $password], ['id' => $id]);
}
/**
* Update a user email by his id.
*
* @param int $id : User id
* @param array $email : The new email
*
* @return int : Number of modified lines
*/
public function update_email($id, $email)