Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
64.71% covered (warning)
64.71%
22 / 34
66.67% covered (warning)
66.67%
8 / 12
CRAP
0.00% covered (danger)
0.00%
0 / 1
GraphDefaults
64.71% covered (warning)
64.71%
22 / 34
66.67% covered (warning)
66.67%
8 / 12
18.33
0.00% covered (danger)
0.00%
0 / 1
 defaultFormat
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getWorkstation
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
1 / 1
1
 getWorkstationWithProvider
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
1 / 1
1
 getAvailability
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
2
 getAvailabilityTimes
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
2
 getScope
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
1 / 1
1
 getDepartment
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
1 / 1
1
 getRequest
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
1 / 1
1
 getFreeProcessList
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
1 / 1
1
 getCalendar
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
2
 getProcess
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
1 / 1
1
 getFreeProcess
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3namespace BO\Zmsadmin\Helper;
4
5class GraphDefaults
6{
7    protected static function defaultFormat(string $string): string|null
8    {
9        return preg_replace('#\s+#m', ' ', trim($string));
10    }
11
12    /**
13     * workstation reduced response data
14     */
15    public static function getWorkstation()
16    {
17        $default = <<< EOS
18{ 
19    id,
20    name,
21    scope {
22        id, 
23        shortName
24        source,
25        cluster,
26        contact {
27            name
28        }
29        preferences {
30            appointment
31            client
32            workstation
33            ticketprinter
34            queue
35        }
36        status 
37    },
38    queue {
39        clusterEnabled
40        appointmentsOnly
41    }
42    useraccount {
43        permissions
44        id
45    }
46}
47EOS;
48        return static::defaultFormat($default);
49    }
50
51    public static function getWorkstationWithProvider()
52    {
53        $default = <<< EOS
54{ 
55    id,
56    name,
57    scope {
58        provider {
59            id
60            contact 
61            name 
62            data { 
63                payment 
64                slotTimeInMinutes
65            }
66        },  
67        id, 
68        shortName
69        source,
70        contact {
71            name
72        }
73        preferences {
74            appointment
75            client
76            workstation
77            ticketprinter
78        }
79        status 
80    },
81    queue {
82        clusterEnabled
83        appointmentsOnly
84    }
85    useraccount {
86        permissions
87    }
88}
89EOS;
90        return static::defaultFormat($default);
91    }
92
93    /**
94     * availability reduced response data
95     * @psalm-api
96     */
97    public static function getAvailability()
98    {
99        $default = <<< EOS
100{ 
101    id,
102    weekday,
103    repeat
104    startDate,
105    endDate,
106    startTime,
107    endTime,
108    type,
109    bookable,
110    workstationCount,
111    lastChange,
112    multipleSlotsAllowed,
113    slotTimeInMinutes,
114    description,
115    scope {
116        id, 
117        source,
118        dayoff {
119            date
120        },
121        preferences {
122            appointment
123        }
124    }
125}
126EOS;
127        return static::defaultFormat($default);
128    }
129
130    /**
131     * availability reduced response data
132     * @psalm-api
133     */
134    public static function getAvailabilityTimes()
135    {
136        $default = <<< EOS
137{ 
138    weekday,
139    repeat
140    startDate,
141    endDate,
142    startTime,
143    endTime,
144    type,
145    scope {
146        dayoff {
147            date
148        }
149    }
150}
151EOS;
152        return static::defaultFormat($default);
153    }
154
155    /**
156     * scope reduced response data
157     */
158    public static function getScope()
159    {
160        $default = <<< EOS
161{ 
162    id 
163    source
164    contact
165    shortName
166    hint
167    dayoff {
168        date
169    }
170    preferences
171    provider {
172        id
173        contact 
174        name 
175        data { 
176            payment 
177            slotTimeInMinutes
178        }
179    }
180    queue
181    status
182}
183EOS;
184        return static::defaultFormat($default);
185    }
186
187     /**
188     * scope reduced response data
189     */
190    public static function getDepartment()
191    {
192        $default = <<< EOS
193{ 
194    id 
195    name
196    preferences 
197}
198EOS;
199        return static::defaultFormat($default);
200    }
201
202
203    /**
204     * requests reduced response data
205     */
206    public static function getRequest()
207    {
208        $default = <<< EOS
209{ 
210    id 
211    name 
212    link 
213    timeSlotCount
214    data { 
215        locations { 
216            appointment 
217        } 
218    } 
219}
220
221
222EOS;
223        return static::defaultFormat($default);
224    }
225
226    /**
227     * free process list reduced response data
228     */
229    public static function getFreeProcessList()
230    {
231        $default = <<< EOS
232{ 
233    scope { 
234        id
235        source 
236        contact 
237        provider { 
238            contact 
239            name 
240            data { 
241                payment 
242            }
243        } 
244        preferences { 
245            appointment
246        }
247    } 
248    appointments {
249        date
250    }
251}
252EOS;
253        return static::defaultFormat($default);
254    }
255
256    /**
257     * calendar output for day select page
258     * @psalm-api
259     */
260    public static function getCalendar()
261    {
262        $default = <<< EOS
263{ 
264    firstDay 
265    lastDay 
266    days 
267    freeProcesses 
268    requests {
269        id 
270        name 
271        link
272    } 
273    scopes { 
274        id 
275        source 
276        provider {
277            contact 
278            name 
279            data { 
280                payment
281            }
282        } 
283        preferences { 
284            appointment
285        }
286    } 
287}
288EOS;
289        return static::defaultFormat($default);
290    }
291
292    /**
293     *  reduced process response data
294     */
295    public static function getProcess()
296    {
297        $default = <<< EOS
298{
299    amendment
300    customTextfield
301    customTextfield2
302    authKey
303    priority
304    id
305    displayNumber
306    status
307    createTimestamp
308    timeoutTime
309    reminderTimestamp
310    appointments{
311        date
312        slotCount
313        availability{
314            id
315            slotTimeInMinutes
316        }
317    }
318    clients{
319        familyName
320        email
321        surveyAccepted
322        telephone
323    }
324    queue{
325        arrivalTime,
326        withAppointment,
327        number,
328        status,
329        waitingTimeEstimate,
330        waitingTimeOptimistic,
331        waitingTime,
332        wayTime,
333        callCount
334    }
335    processingTime
336    waitingTime
337    wayTime
338    parkedBy
339    services
340    name
341    withAppointment
342    requests{
343        id
344        link
345        name
346        source
347    }
348    scope{
349        id
350        shortName
351        source
352        contact
353        provider{
354            id
355            contact 
356            name 
357            data { 
358                payment 
359                slotTimeInMinutes
360            }
361        }
362        preferences{
363            client
364            appointment
365            survey
366        }
367    }
368}
369EOS;
370        return static::defaultFormat($default);
371    }
372
373/**
374 *  reduced process response data
375     * @psalm-api
376 */
377    public static function getFreeProcess()
378    {
379        $default = <<< EOS
380{
381    appointments{
382        date
383        slotCount
384    }
385    scope{
386        id
387    }
388}
389EOS;
390        return static::defaultFormat($default);
391    }
392}