mirror of
https://github.com/RaspbianFrance/raspisms.git
synced 2025-04-20 16:37:48 +02:00
fix codestyle
This commit is contained in:
parent
350dbb5b59
commit
adef27f862
37 changed files with 556 additions and 488 deletions
|
@ -87,33 +87,22 @@ class Webhook extends StandardController
|
|||
return $this->get_model()->gets_for_type_and_user($id_user, $type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the model for the Controller.
|
||||
*
|
||||
* @return \descartes\Model
|
||||
*/
|
||||
protected function get_model(): \descartes\Model
|
||||
{
|
||||
$this->model = $this->model ?? new \models\Webhook($this->bdd);
|
||||
|
||||
return $this->model;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Trigger a webhook and transmit the signal to webhook daemon if needed.
|
||||
* @param int $id_user : User to trigger the webhook for
|
||||
* @param string $type : Type of webhook to trigger
|
||||
* @param array $sms : The sms [
|
||||
* int 'id' => SMS id,
|
||||
* string 'at' => SMS date,
|
||||
* string 'text' => sms body,
|
||||
* string 'origin' => sms origin (number or phone id)
|
||||
* string 'destination' => sms destination (number or phone id)
|
||||
* ]
|
||||
*
|
||||
* @param int $id_user : User to trigger the webhook for
|
||||
* @param string $type : Type of webhook to trigger
|
||||
* @param array $sms : The sms [
|
||||
* int 'id' => SMS id,
|
||||
* string 'at' => SMS date,
|
||||
* string 'text' => sms body,
|
||||
* string 'origin' => sms origin (number or phone id)
|
||||
* string 'destination' => sms destination (number or phone id)
|
||||
* ]
|
||||
*
|
||||
* @return bool : False if no trigger, true else
|
||||
*/
|
||||
public function trigger (int $id_user, string $type, array $sms)
|
||||
public function trigger(int $id_user, string $type, array $sms)
|
||||
{
|
||||
$internal_setting = new Setting($this->bdd);
|
||||
$settings = $internal_setting->gets_for_user($id_user);
|
||||
|
@ -141,7 +130,20 @@ class Webhook extends StandardController
|
|||
$error_code = null;
|
||||
$queue = msg_get_queue(QUEUE_ID_WEBHOOK);
|
||||
$success = msg_send($queue, QUEUE_TYPE_WEBHOOK, $message, true, true, $error_code);
|
||||
|
||||
return (bool) $success;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the model for the Controller.
|
||||
*
|
||||
* @return \descartes\Model
|
||||
*/
|
||||
protected function get_model(): \descartes\Model
|
||||
{
|
||||
$this->model = $this->model ?? new \models\Webhook($this->bdd);
|
||||
|
||||
return $this->model;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue