Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
WPCrmAnswer
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 1
 setQuestionAnswers
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3/**
4 * LDCCRM For Wordpress usage
5 *
6 * @category API
7 * @package  None
8 * @author   Jérémy Munsch <jeremy.munsch@ldc.fr>
9 * @license  MIT https://opensource.org/licenses/MIT
10 * @link     /
11 */
12
13namespace LDC\LDCCRM\WordPress;
14
15use LDC\LDCCRM\Models\Answer;
16
17/**
18 * Class de gestion de la segmentation question avec Wordpress
19 *
20 * @category API
21 * @package LDCCrmClient
22 * @subpackage Wordpress
23 * @author   Jérémy Munsch <jeremy.munsch@ldc.fr>
24 * @license  MIT https://opensource.org/licenses/MIT
25 * @link     /
26 */
27abstract class WPCrmAnswer
28{
29    /**
30     * Set answers to a question for a specific user
31     *
32     * @param \LDC\LDCCRM\WordPress\WPCrmUser $user
33     * @param integer                         $questionId The question id .
34     * @param array                           $answersId  An array with answers id .
35     * @return boolean true if succeeded
36     *
37     * @throws \LDC\LDCCRM\Exceptions\CrmException If an error occurs on server side or on getting response.
38     * @throws \LDC\LDCCRM\Exceptions\ValidationException If $user hashcode is not a valid UUID.
39     * @throws \LDC\LDCCRM\Exceptions\ValidationException If any of the provided ids are invalid.
40     * @throws \LDC\LDCCRM\Exceptions\ApiErrorException If any error \LDC\LDCCRM\Enums\ApiError occurs.
41     * Possibles are : - validationFailed, If given ids are wrong(CRM side).
42     * @phpcs:ignore Squiz.Commenting.FunctionCommentThrowTag.WrongNumber
43     */
44    public function setQuestionAnswers(WPCrmUser $user, int $questionId, array $answersId): bool
45    {
46        return Answer::setQuestionAnswers($user->hashcode, $questionId, $answersId);
47    }
48}