mirror of
https://github.com/RaspbianFrance/raspisms.git
synced 2025-04-20 16:37:48 +02:00
Fix php style
This commit is contained in:
parent
461bd9c98d
commit
b8bd067dc7
59 changed files with 2307 additions and 1868 deletions
|
@ -13,33 +13,25 @@ namespace controllers\internals;
|
|||
|
||||
class Phone extends StandardController
|
||||
{
|
||||
protected $model = null;
|
||||
protected $model;
|
||||
|
||||
/**
|
||||
* Get the model for the Controller
|
||||
* @return \descartes\Model
|
||||
*/
|
||||
protected function get_model () : \descartes\Model
|
||||
{
|
||||
$this->model = $this->model ?? new \models\Phone($this->bdd);
|
||||
return $this->model;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return all phones of a user.
|
||||
*
|
||||
* @param int $id_user : user id
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function gets_for_user (int $id_user)
|
||||
public function gets_for_user(int $id_user)
|
||||
{
|
||||
return $this->get_model()->gets_for_user($id_user);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Return a phone by his number
|
||||
* Return a phone by his number.
|
||||
*
|
||||
* @param string $number : Phone number
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function get_by_number(string $number)
|
||||
|
@ -47,11 +39,12 @@ namespace controllers\internals;
|
|||
return $this->get_model()->get_by_number($number);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return a phone for a user by a number
|
||||
* @param int $id_user : user id
|
||||
* @param string $number : Phone number
|
||||
* Return a phone for a user by a number.
|
||||
*
|
||||
* @param int $id_user : user id
|
||||
* @param string $number : Phone number
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function get_by_number_and_user(int $id_user, string $number)
|
||||
|
@ -59,18 +52,19 @@ namespace controllers\internals;
|
|||
return $this->get_model()->get_by_number_and_user($id_user, $number);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a phone
|
||||
* @param int $id_user : User to insert phone for
|
||||
* @param string $number : The number of the phone
|
||||
* @param string $adapter : The adapter to use the phone
|
||||
* Create a phone.
|
||||
*
|
||||
* @param int $id_user : User to insert phone for
|
||||
* @param string $number : The number of the phone
|
||||
* @param string $adapter : The adapter to use the phone
|
||||
* @param string json $adapter_datas : A JSON string representing adapter's datas (for example credentials for an api)
|
||||
*
|
||||
* @return bool : false on error, true on success
|
||||
*/
|
||||
public function create (int $id_user, string $number, string $adapter, string $adapter_datas) : bool
|
||||
public function create(int $id_user, string $number, string $adapter, string $adapter_datas): bool
|
||||
{
|
||||
$phone = [
|
||||
$phone = [
|
||||
'id_user' => $id_user,
|
||||
'number' => $number,
|
||||
'adapter' => $adapter,
|
||||
|
@ -80,17 +74,18 @@ namespace controllers\internals;
|
|||
return (bool) $this->get_model()->insert($phone);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update a phone
|
||||
* @param int $id_user : User to insert phone for
|
||||
* @param int $id : Phone id
|
||||
* @param string $number : The number of the phone
|
||||
* @param string $adapter : The adapter to use the phone
|
||||
* @param array $adapter_datas : An array of the datas of the adapter (for example credentials for an api)
|
||||
* Update a phone.
|
||||
*
|
||||
* @param int $id_user : User to insert phone for
|
||||
* @param int $id : Phone id
|
||||
* @param string $number : The number of the phone
|
||||
* @param string $adapter : The adapter to use the phone
|
||||
* @param array $adapter_datas : An array of the datas of the adapter (for example credentials for an api)
|
||||
*
|
||||
* @return bool : false on error, true on success
|
||||
*/
|
||||
public function update_for_user (int $id_user, int $id, string $number, string $adapter, array $adapter_datas) : bool
|
||||
public function update_for_user(int $id_user, int $id, string $number, string $adapter, array $adapter_datas): bool
|
||||
{
|
||||
$phone = [
|
||||
'id_user' => $id_user,
|
||||
|
@ -101,4 +96,16 @@ namespace controllers\internals;
|
|||
|
||||
return (bool) $this->get_model()->update_for_user($id_user, $id, $phone);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the model for the Controller.
|
||||
*
|
||||
* @return \descartes\Model
|
||||
*/
|
||||
protected function get_model(): \descartes\Model
|
||||
{
|
||||
$this->model = $this->model ?? new \models\Phone($this->bdd);
|
||||
|
||||
return $this->model;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue