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            slotTimeInMinutes
315        }
316    }
317    clients{
318        familyName
319        email
320        surveyAccepted
321        telephone
322    }
323    queue{
324        arrivalTime,
325        withAppointment,
326        number,
327        status,
328        waitingTimeEstimate,
329        waitingTimeOptimistic,
330        waitingTime,
331        wayTime,
332        callCount
333    }
334    processingTime
335    waitingTime
336    wayTime
337    parkedBy
338    services
339    name
340    withAppointment
341    requests{
342        id
343        link
344        name
345        source
346    }
347    scope{
348        id
349        shortName
350        source
351        contact
352        provider{
353            contact 
354            name 
355            data { 
356                payment 
357                slotTimeInMinutes
358            }
359        }
360        preferences{
361            client
362            appointment
363            survey
364        }
365    }
366}
367EOS;
368        return static::defaultFormat($default);
369    }
370
371/**
372 *  reduced process response data
373     * @psalm-api
374 */
375    public static function getFreeProcess()
376    {
377        $default = <<< EOS
378{
379    appointments{
380        date
381        slotCount
382    }
383    scope{
384        id
385    }
386}
387EOS;
388        return static::defaultFormat($default);
389    }
390}