Passed
Push — master ( 318ec7...a84ec0 )
by Shaharia
01:33
created

Account::setLanguagePreference()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace PreviewTechs\cPanelWHM\Entity;
4
5
class Account
6
{
7
    /**
8
     * The account's username. A cPanel account or reseller username on the server.
9
     *
10
     * @var string
11
     */
12
    public $user;
13
14
    /**
15
     * The account's main domain. A valid domainnameon the account.
16
     *
17
     * @var string
18
     */
19
    public $domain;
20
21
22
    /**
23
     * The percentage of failed or deferred email messages that the account can send per hour
24
     * before outgoing mail is rate-limited.
25
     *
26
     * unlimited / An integer that represents a percentage of messages.
27
     *
28
     * @var integer
29
     */
30
    public $maxDeferFailMailPercentage;
31
32
    /**
33
     * The account's shell. The absolute path to a shell location on the server.
34
     *
35
     * @var string
36
     */
37
    public $shell;
38
39
    /**
40
     * The type of mailbox the account uses. mdbox/maildir
41
     *
42
     * @var string
43
     */
44
    public $mailboxFormat;
45
46
    /**
47
     * The account's cPanel interface theme. paper_lantern or another valid theme on the server.
48
     *
49
     * @var string
50
     */
51
    public $theme;
52
53
    /**
54
     * The account's maximum number of mailing lists. unlimited or an integer that represents a number of mailing lists.
55
     *
56
     * @var integer
57
     */
58
    public $maxMailingList;
59
60
    /**
61
     * The account's maximum number of addon domains.
62
     *
63
     * Possible values -
64
     *  unlimited
65
     *  unknown* — The account cannot use addon domains
66
     *  an integer that represents a number of addon domains.
67
     *
68
     * @var integer
69
     */
70
    public $maxAddonDomains;
71
72
    /**
73
     * The account's maximum number of parked domains.
74
     *
75
     * Possible values -
76
     *  unlimited
77
     *  unknown* — The account cannot use parked domains
78
     *  an integer that represents a number of parked domains.
79
     *
80
     * @var integer
81
     */
82
    public $maxParkedDomains;
83
84
    /**
85
     *
86
     * @var string
87
     */
88
    public $ipv6;
89
90
    /**
91
     *
92
     * @var string
93
     */
94
    public $email;
95
96
    /**
97
     *
98
     * @var string
99
     */
100
    public $partition;
101
102
    /**
103
     *
104
     * @var integer
105
     */
106
    public $maxSQL;
107
108
    /**
109
     *
110
     * @var \DateTime
111
     */
112
    public $createdAt;
113
114
    /**
115
     *
116
     * @var bool
117
     */
118
    public $isBackupEnabled;
119
120
    /**
121
     *
122
     * @var bool
123
     */
124
    public $outgoingMailSuspended;
125
126
    /**
127
     *
128
     * @var string
129
     */
130
    public $owner;
131
132
    /**
133
     *
134
     * @var string
135
     */
136
    public $suspensionReason;
137
138
    /**
139
     *
140
     * @var bool
141
     */
142
    public $isLocked;
143
144
    /**
145
     *
146
     * @var bool
147
     */
148
    public $outgoingMailCanHold;
149
150
    /**
151
     *
152
     * @var \DateTime
153
     */
154
    public $suspendedAt;
155
156
    /**
157
     *
158
     * @var int
159
     */
160
    public $maxFTP;
161
162
    /**
163
     *
164
     * @var int
165
     */
166
    public $maxEmailPerHour;
167
168
    /**
169
     *
170
     * @var bool
171
     */
172
    public $temporary;
173
174
    /**
175
     *
176
     * @var string
177
     */
178
    public $ipAddress;
179
180
    /**
181
     *
182
     * @var int
183
     */
184
    public $uid;
185
186
    /**
187
     *
188
     * @var bool
189
     */
190
    public $suspended;
191
192
    /**
193
     *
194
     * @var bool
195
     */
196
    public $backup;
197
198
    /**
199
     *
200
     * @var int
201
     */
202
    public $maxPOP;
203
204
    /**
205
     *
206
     * @var int
207
     */
208
    public $maxSubDomain;
209
210
    /**
211
     *
212
     * @var int
213
     */
214
    public $maxEmailAccountQuota;
215
216
    /**
217
     *
218
     * @var int
219
     */
220
    public $diskUsed;
221
222
    /**
223
     *
224
     * @var int
225
     */
226
    public $inodeUsed;
227
228
    /**
229
     *
230
     * @var
231
     */
232
    public $minDeferFailToTriggerProtection;
233
234
    /**
235
     *
236
     * @var string
237
     */
238
    public $planName;
239
240
    /**
241
     *
242
     * @var int
243
     */
244
    public $inodesLimit;
245
246
    /**
247
     *
248
     * @var int
249
     */
250
    public $diskLimit;
251
252
    /**
253
     *
254
     * @var bool
255
     */
256
    public $legacyBackup;
257
258
    /**
259
     * @var string|null
260
     */
261
    public $password;
262
263
    /**
264
     * @var bool|null
265
     */
266
    public $cgiEnable;
267
268
    /**
269
     * @var bool
270
     */
271
    public $spamAssassinEnable;
272
273
    /**
274
     * @var bool
275
     */
276
    public $frontPageEnable;
277
278
    /**
279
     * @var int
280
     */
281
    public $bandwidthLimit;
282
283
    /**
284
     * @var string|null
285
     */
286
    public $languagePreference;
287
288
    /**
289
     *
290
     * @return string
291
     */
292
    public function getUser()
293
    {
294
        return $this->user;
295
    }
296
297
    /**
298
     *
299
     * @param string $user
300
     *
301
     * @return Account
302
     */
303
    public function setUser($user)
304
    {
305
        $this->user = $user;
306
307
        return $this;
308
    }
309
310
    /**
311
     *
312
     * @return string
313
     */
314
    public function getDomain()
315
    {
316
        return $this->domain;
317
    }
318
319
    /**
320
     *
321
     * @param string $domain
322
     *
323
     * @return Account
324
     */
325
    public function setDomain($domain)
326
    {
327
        $this->domain = $domain;
328
329
        return $this;
330
    }
331
332
    /**
333
     *
334
     * @return int
335
     */
336
    public function getMaxDeferFailMailPercentage()
337
    {
338
        return $this->maxDeferFailMailPercentage;
339
    }
340
341
    /**
342
     *
343
     * @param int $maxDeferFailMailPercentage
344
     *
345
     * @return Account
346
     */
347
    public function setMaxDeferFailMailPercentage($maxDeferFailMailPercentage)
348
    {
349
        $this->maxDeferFailMailPercentage = $maxDeferFailMailPercentage;
350
351
        return $this;
352
    }
353
354
    /**
355
     *
356
     * @return string
357
     */
358
    public function getShell()
359
    {
360
        return $this->shell;
361
    }
362
363
    /**
364
     *
365
     * @param string $shell
366
     *
367
     * @return Account
368
     */
369
    public function setShell($shell)
370
    {
371
        $this->shell = $shell;
372
373
        return $this;
374
    }
375
376
    /**
377
     *
378
     * @return string
379
     */
380
    public function getMailboxFormat()
381
    {
382
        return $this->mailboxFormat;
383
    }
384
385
    /**
386
     *
387
     * @param string $mailboxFormat
388
     *
389
     * @return Account
390
     */
391
    public function setMailboxFormat($mailboxFormat)
392
    {
393
        $this->mailboxFormat = $mailboxFormat;
394
395
        return $this;
396
    }
397
398
    /**
399
     *
400
     * @return string
401
     */
402
    public function getTheme()
403
    {
404
        return $this->theme;
405
    }
406
407
    /**
408
     *
409
     * @param string $theme
410
     *
411
     * @return Account
412
     */
413
    public function setTheme($theme)
414
    {
415
        $this->theme = $theme;
416
417
        return $this;
418
    }
419
420
    /**
421
     *
422
     * @return int
423
     */
424
    public function getMaxMailingList()
425
    {
426
        return $this->maxMailingList;
427
    }
428
429
    /**
430
     *
431
     * @param int $maxMailingList
432
     *
433
     * @return Account
434
     */
435
    public function setMaxMailingList($maxMailingList)
436
    {
437
        $this->maxMailingList = $maxMailingList;
438
439
        return $this;
440
    }
441
442
    /**
443
     *
444
     * @return int
445
     */
446
    public function getMaxAddonDomains()
447
    {
448
        return $this->maxAddonDomains;
449
    }
450
451
    /**
452
     *
453
     * @param int $maxAddonDomains
454
     *
455
     * @return Account
456
     */
457
    public function setMaxAddonDomains($maxAddonDomains)
458
    {
459
        $this->maxAddonDomains = $maxAddonDomains;
460
461
        return $this;
462
    }
463
464
    /**
465
     *
466
     * @return int
467
     */
468
    public function getMaxParkedDomains()
469
    {
470
        return $this->maxParkedDomains;
471
    }
472
473
    /**
474
     *
475
     * @param int $maxParkedDomains
476
     *
477
     * @return Account
478
     */
479
    public function setMaxParkedDomains($maxParkedDomains)
480
    {
481
        $this->maxParkedDomains = $maxParkedDomains;
482
483
        return $this;
484
    }
485
486
    /**
487
     *
488
     * @return string
489
     */
490
    public function getIpv6()
491
    {
492
        return $this->ipv6;
493
    }
494
495
    /**
496
     *
497
     * @param string $ipv6
498
     *
499
     * @return Account
500
     */
501
    public function setIpv6($ipv6)
502
    {
503
        $this->ipv6 = $ipv6;
504
505
        return $this;
506
    }
507
508
    /**
509
     *
510
     * @return string
511
     */
512
    public function getEmail()
513
    {
514
        return $this->email;
515
    }
516
517
    /**
518
     *
519
     * @param string $email
520
     *
521
     * @return Account
522
     */
523
    public function setEmail($email)
524
    {
525
        $this->email = $email;
526
527
        return $this;
528
    }
529
530
    /**
531
     *
532
     * @return string
533
     */
534
    public function getPartition()
535
    {
536
        return $this->partition;
537
    }
538
539
    /**
540
     *
541
     * @param string $partition
542
     *
543
     * @return Account
544
     */
545
    public function setPartition($partition)
546
    {
547
        $this->partition = $partition;
548
549
        return $this;
550
    }
551
552
    /**
553
     *
554
     * @return int
555
     */
556
    public function getMaxSQL()
557
    {
558
        return $this->maxSQL;
559
    }
560
561
    /**
562
     *
563
     * @param int $maxSQL
564
     *
565
     * @return Account
566
     */
567
    public function setMaxSQL($maxSQL)
568
    {
569
        $this->maxSQL = $maxSQL;
570
571
        return $this;
572
    }
573
574
    /**
575
     *
576
     * @return \DateTime
577
     */
578
    public function getCreatedAt()
579
    {
580
        return $this->createdAt;
581
    }
582
583
    /**
584
     *
585
     * @param \DateTime $createdAt
586
     *
587
     * @return Account
588
     */
589
    public function setCreatedAt($createdAt)
590
    {
591
        $this->createdAt = $createdAt;
592
593
        return $this;
594
    }
595
596
    /**
597
     *
598
     * @return bool
599
     */
600
    public function isBackupEnabled()
601
    {
602
        return $this->isBackupEnabled;
603
    }
604
605
    /**
606
     *
607
     * @param bool $isBackupEnabled
608
     *
609
     * @return Account
610
     */
611
    public function setIsBackupEnabled($isBackupEnabled)
612
    {
613
        $this->isBackupEnabled = $isBackupEnabled;
614
615
        return $this;
616
    }
617
618
    /**
619
     *
620
     * @return bool
621
     */
622
    public function isOutgoingMailSuspended()
623
    {
624
        return $this->outgoingMailSuspended;
625
    }
626
627
    /**
628
     *
629
     * @param bool $outgoingMailSuspended
630
     *
631
     * @return Account
632
     */
633
    public function setOutgoingMailSuspended($outgoingMailSuspended)
634
    {
635
        $this->outgoingMailSuspended = $outgoingMailSuspended;
636
637
        return $this;
638
    }
639
640
    /**
641
     *
642
     * @return string
643
     */
644
    public function getOwner()
645
    {
646
        return $this->owner;
647
    }
648
649
    /**
650
     *
651
     * @param string $owner
652
     *
653
     * @return Account
654
     */
655
    public function setOwner($owner)
656
    {
657
        $this->owner = $owner;
658
659
        return $this;
660
    }
661
662
    /**
663
     *
664
     * @return string
665
     */
666
    public function getSuspensionReason()
667
    {
668
        return $this->suspensionReason;
669
    }
670
671
    /**
672
     *
673
     * @param string $suspensionReason
674
     *
675
     * @return Account
676
     */
677
    public function setSuspensionReason($suspensionReason)
678
    {
679
        $this->suspensionReason = $suspensionReason;
680
681
        return $this;
682
    }
683
684
    /**
685
     *
686
     * @return bool
687
     */
688
    public function isLocked()
689
    {
690
        return $this->isLocked;
691
    }
692
693
    /**
694
     *
695
     * @param bool $isLocked
696
     *
697
     * @return Account
698
     */
699
    public function setIsLocked($isLocked)
700
    {
701
        $this->isLocked = $isLocked;
702
703
        return $this;
704
    }
705
706
    /**
707
     *
708
     * @return bool
709
     */
710
    public function isOutgoingMailCanHold()
711
    {
712
        return $this->outgoingMailCanHold;
713
    }
714
715
    /**
716
     *
717
     * @param bool $outgoingMailCanHold
718
     *
719
     * @return Account
720
     */
721
    public function setOutgoingMailCanHold($outgoingMailCanHold)
722
    {
723
        $this->outgoingMailCanHold = $outgoingMailCanHold;
724
725
        return $this;
726
    }
727
728
    /**
729
     *
730
     * @return \DateTime
731
     */
732
    public function getSuspendedAt()
733
    {
734
        return $this->suspendedAt;
735
    }
736
737
    /**
738
     *
739
     * @param \DateTime $suspendedAt
740
     *
741
     * @return Account
742
     */
743
    public function setSuspendedAt($suspendedAt)
744
    {
745
        $this->suspendedAt = $suspendedAt;
746
747
        return $this;
748
    }
749
750
    /**
751
     *
752
     * @return int
753
     */
754
    public function getMaxFTP()
755
    {
756
        return $this->maxFTP;
757
    }
758
759
    /**
760
     *
761
     * @param int $maxFTP
762
     *
763
     * @return Account
764
     */
765
    public function setMaxFTP($maxFTP)
766
    {
767
        $this->maxFTP = $maxFTP;
768
769
        return $this;
770
    }
771
772
    /**
773
     *
774
     * @return int
775
     */
776
    public function getMaxEmailPerHour()
777
    {
778
        return $this->maxEmailPerHour;
779
    }
780
781
    /**
782
     *
783
     * @param int $maxEmailPerHour
784
     *
785
     * @return Account
786
     */
787
    public function setMaxEmailPerHour($maxEmailPerHour)
788
    {
789
        $this->maxEmailPerHour = $maxEmailPerHour;
790
791
        return $this;
792
    }
793
794
    /**
795
     *
796
     * @return bool
797
     */
798
    public function isTemporary()
799
    {
800
        return $this->temporary;
801
    }
802
803
    /**
804
     *
805
     * @param bool $temporary
806
     *
807
     * @return Account
808
     */
809
    public function setTemporary($temporary)
810
    {
811
        $this->temporary = $temporary;
812
813
        return $this;
814
    }
815
816
    /**
817
     *
818
     * @return string
819
     */
820
    public function getIpAddress()
821
    {
822
        return $this->ipAddress;
823
    }
824
825
    /**
826
     *
827
     * @param string $ipAddress
828
     *
829
     * @return Account
830
     */
831
    public function setIpAddress($ipAddress)
832
    {
833
        $this->ipAddress = $ipAddress;
834
835
        return $this;
836
    }
837
838
    /**
839
     *
840
     * @return int
841
     */
842
    public function getUid()
843
    {
844
        return $this->uid;
845
    }
846
847
    /**
848
     *
849
     * @param int $uid
850
     *
851
     * @return Account
852
     */
853
    public function setUid($uid)
854
    {
855
        $this->uid = $uid;
856
857
        return $this;
858
    }
859
860
    /**
861
     *
862
     * @return bool
863
     */
864
    public function isSuspended()
865
    {
866
        return $this->suspended;
867
    }
868
869
    /**
870
     *
871
     * @param bool $suspended
872
     *
873
     * @return Account
874
     */
875
    public function setSuspended($suspended)
876
    {
877
        $this->suspended = $suspended;
878
879
        return $this;
880
    }
881
882
    /**
883
     *
884
     * @return bool
885
     */
886
    public function isBackup()
887
    {
888
        return $this->backup;
889
    }
890
891
    /**
892
     *
893
     * @param bool $backup
894
     *
895
     * @return Account
896
     */
897
    public function setBackup($backup)
898
    {
899
        $this->backup = $backup;
900
901
        return $this;
902
    }
903
904
    /**
905
     *
906
     * @return int
907
     */
908
    public function getMaxPOP()
909
    {
910
        return $this->maxPOP;
911
    }
912
913
    /**
914
     *
915
     * @param int $maxPOP
916
     *
917
     * @return Account
918
     */
919
    public function setMaxPOP($maxPOP)
920
    {
921
        $this->maxPOP = $maxPOP;
922
923
        return $this;
924
    }
925
926
    /**
927
     *
928
     * @return int
929
     */
930
    public function getMaxSubDomain()
931
    {
932
        return $this->maxSubDomain;
933
    }
934
935
    /**
936
     *
937
     * @param int $maxSubDomain
938
     *
939
     * @return Account
940
     */
941
    public function setMaxSubDomain($maxSubDomain)
942
    {
943
        $this->maxSubDomain = $maxSubDomain;
944
945
        return $this;
946
    }
947
948
    /**
949
     *
950
     * @return int
951
     */
952
    public function getMaxEmailAccountQuota()
953
    {
954
        return $this->maxEmailAccountQuota;
955
    }
956
957
    /**
958
     *
959
     * @param int $maxEmailAccountQuota
960
     *
961
     * @return Account
962
     */
963
    public function setMaxEmailAccountQuota($maxEmailAccountQuota)
964
    {
965
        $this->maxEmailAccountQuota = $maxEmailAccountQuota;
966
967
        return $this;
968
    }
969
970
    /**
971
     *
972
     * @return int
973
     */
974
    public function getDiskUsed()
975
    {
976
        return $this->diskUsed;
977
    }
978
979
    /**
980
     *
981
     * @param int $diskUsed
982
     *
983
     * @return Account
984
     */
985
    public function setDiskUsed($diskUsed)
986
    {
987
        $this->diskUsed = $diskUsed;
988
989
        return $this;
990
    }
991
992
    /**
993
     *
994
     * @return int
995
     */
996
    public function getInodeUsed()
997
    {
998
        return $this->inodeUsed;
999
    }
1000
1001
    /**
1002
     *
1003
     * @param int $inodeUsed
1004
     *
1005
     * @return Account
1006
     */
1007
    public function setInodeUsed($inodeUsed)
1008
    {
1009
        $this->inodeUsed = $inodeUsed;
1010
1011
        return $this;
1012
    }
1013
1014
    /**
1015
     *
1016
     * @return mixed
1017
     */
1018
    public function getMinDeferFailToTriggerProtection()
1019
    {
1020
        return $this->minDeferFailToTriggerProtection;
1021
    }
1022
1023
    /**
1024
     *
1025
     * @param mixed $minDeferFailToTriggerProtection
1026
     *
1027
     * @return Account
1028
     */
1029
    public function setMinDeferFailToTriggerProtection($minDeferFailToTriggerProtection)
1030
    {
1031
        $this->minDeferFailToTriggerProtection = $minDeferFailToTriggerProtection;
1032
1033
        return $this;
1034
    }
1035
1036
    /**
1037
     *
1038
     * @return string
1039
     */
1040
    public function getPlanName()
1041
    {
1042
        return $this->planName;
1043
    }
1044
1045
    /**
1046
     *
1047
     * @param string $planName
1048
     *
1049
     * @return Account
1050
     */
1051
    public function setPlanName($planName)
1052
    {
1053
        $this->planName = $planName;
1054
1055
        return $this;
1056
    }
1057
1058
    /**
1059
     *
1060
     * @return int
1061
     */
1062
    public function getInodesLimit()
1063
    {
1064
        return $this->inodesLimit;
1065
    }
1066
1067
    /**
1068
     *
1069
     * @param int $inodesLimit
1070
     *
1071
     * @return Account
1072
     */
1073
    public function setInodesLimit($inodesLimit)
1074
    {
1075
        $this->inodesLimit = $inodesLimit;
1076
1077
        return $this;
1078
    }
1079
1080
    /**
1081
     *
1082
     * @return int
1083
     */
1084
    public function getDiskLimit()
1085
    {
1086
        return $this->diskLimit;
1087
    }
1088
1089
    /**
1090
     *
1091
     * @param int $diskLimit
1092
     *
1093
     * @return Account
1094
     */
1095
    public function setDiskLimit($diskLimit)
1096
    {
1097
        $this->diskLimit = $diskLimit;
1098
1099
        return $this;
1100
    }
1101
1102
    /**
1103
     *
1104
     * @return bool
1105
     */
1106
    public function isLegacyBackup()
1107
    {
1108
        return $this->legacyBackup;
1109
    }
1110
1111
    /**
1112
     *
1113
     * @param bool $legacyBackup
1114
     *
1115
     * @return Account
1116
     */
1117
    public function setLegacyBackup($legacyBackup)
1118
    {
1119
        $this->legacyBackup = $legacyBackup;
1120
1121
        return $this;
1122
    }
1123
1124
    /**
1125
     * @return null|string
1126
     */
1127
    public function getPassword()
1128
    {
1129
        return $this->password;
1130
    }
1131
1132
    /**
1133
     * @param null|string $password
1134
     * @return Account
1135
     */
1136
    public function setPassword($password)
1137
    {
1138
        $this->password = $password;
1139
        return $this;
1140
    }
1141
1142
    /**
1143
     * @return bool|null
1144
     */
1145
    public function isCgiEnable()
1146
    {
1147
        return $this->cgiEnable;
1148
    }
1149
1150
    /**
1151
     * @param bool|null $cgiEnable
1152
     * @return Account
1153
     */
1154
    public function setCgiEnable($cgiEnable)
1155
    {
1156
        $this->cgiEnable = $cgiEnable;
1157
        return $this;
1158
    }
1159
1160
    /**
1161
     * @return bool
1162
     */
1163
    public function isSpamAssassinEnable()
1164
    {
1165
        return $this->spamAssassinEnable;
1166
    }
1167
1168
    /**
1169
     * @param bool $spamAssassinEnable
1170
     * @return Account
1171
     */
1172
    public function setSpamAssassinEnable($spamAssassinEnable)
1173
    {
1174
        $this->spamAssassinEnable = $spamAssassinEnable;
1175
        return $this;
1176
    }
1177
1178
    /**
1179
     * @return bool
1180
     */
1181
    public function isFrontPageEnable()
1182
    {
1183
        return $this->frontPageEnable;
1184
    }
1185
1186
    /**
1187
     * @param bool $frontPageEnable
1188
     * @return Account
1189
     */
1190
    public function setFrontPageEnable($frontPageEnable)
1191
    {
1192
        $this->frontPageEnable = $frontPageEnable;
1193
        return $this;
1194
    }
1195
1196
    /**
1197
     * @return int
1198
     */
1199
    public function getBandwidthLimit()
1200
    {
1201
        return $this->bandwidthLimit;
1202
    }
1203
1204
    /**
1205
     * @param int $bandwidthLimit
1206
     * @return Account
1207
     */
1208
    public function setBandwidthLimit($bandwidthLimit)
1209
    {
1210
        $this->bandwidthLimit = $bandwidthLimit;
1211
        return $this;
1212
    }
1213
1214
    /**
1215
     * @return null|string
1216
     */
1217
    public function getLanguagePreference()
1218
    {
1219
        return $this->languagePreference;
1220
    }
1221
1222
    /**
1223
     * @param null|string $languagePreference
1224
     * @return Account
1225
     */
1226
    public function setLanguagePreference($languagePreference)
1227
    {
1228
        $this->languagePreference = $languagePreference;
1229
        return $this;
1230
    }
1231
1232
    /**
1233
     *
1234
     * @param array $account
1235
     *
1236
     * @return Account
1237
     */
1238
    public static function buildFromArray(array $account)
1239
    {
1240
        $ac = new static();
1241
1242
        if ($account['maxsub'] === "unlimited") {
1243
            $ac->setMaxSubDomain(-1);
1244
        } elseif ($account['maxsub'] === "unknown") {
1245
            $ac->setMaxSubDomain(0);
1246
        } else {
1247
            $ac->setMaxSubDomain(intval($account['maxsub']));
1248
        }
1249
1250
        $ac->setPartition($account['partition']);
1251
1252
        if ($account['disklimit'] === "unlimited") {
1253
            $ac->setDiskLimit(-1);
1254
        } else {
1255
            $ac->setDiskLimit(intval(str_replace("M", "", $account['disklimit'])));
1256
        }
1257
1258
        $ac->setInodeUsed(intval($account['inodesused']));
1259
1260
        if (! empty($account['has_backup'])) {
1261
            $ac->setBackup((bool)$account['has_backup']);
1262
        }
1263
1264
        if ($account['max_emailacct_quota'] === "unlimited") {
1265
            $ac->setMaxEmailAccountQuota(-1);
1266
        } else {
1267
            $ac->setMaxEmailAccountQuota(intval(str_replace("M", "", $account['max_emailacct_quota'])));
1268
        }
1269
1270
        $ac->setEmail($account['email']);
1271
        $ac->setSuspensionReason($account['suspendreason']);
1272
        $ac->setLegacyBackup((bool)$account['legacy_backup']);
1273
        $ac->setMaxEmailPerHour(
1274
            $account['max_email_per_hour'] === "unlimited" ? -1 : intval($account['max_email_per_hour'])
1275
        );
1276
        $ac->setIsBackupEnabled((bool)$account['backup']);
1277
        $ac->setMaxPOP($account['maxpop'] === "unlimited" ? -1 : intval($account['maxpop']));
1278
        $ac->setUid(intval($account['uid']));
1279
        $ac->setUser($account['user']);
1280
        $ac->setPlanName($account['plan']);
1281
        $ac->setOutgoingMailSuspended((bool)$account['outgoing_mail_suspended']);
1282
        $ac->setMaxFTP($account['maxftp'] === "unlimited" ? -1 : intval($account['maxftp']));
1283
        $ac->setTemporary((bool)$account['temporary']);
1284
        $ac->setDomain($account['domain']);
1285
        $ac->setShell($account['shell']);
1286
        $ac->setMailboxFormat($account['mailbox_format']);
1287
        $ac->setIpAddress($account['ip']);
1288
1289
        if ($account['diskused'] === "unlimited") {
1290
            $ac->setDiskUsed(-1);
1291
        } else {
1292
            $ac->setDiskUsed(intval(str_replace("M", "", $account['diskused'])));
1293
        }
1294
1295
        $ac->setMaxSQL($account['maxsql'] === "unlimited" ? -1 : intval($account['maxsql']));
1296
1297
        if ($account['maxaddons'] === "*unknown*") {
1298
            $ac->setMaxAddonDomains(0);
1299
        } elseif ($account['maxaddons'] === "unlimited") {
1300
            $ac->setMaxAddonDomains(-1);
1301
        } else {
1302
            $ac->setMaxAddonDomains(intval($account['maxaddons']));
1303
        }
1304
1305
        if ($account['maxparked'] === "*unknown*") {
1306
            $ac->setMaxParkedDomains(0);
1307
        } elseif ($account['maxparked'] === "unlimited") {
1308
            $ac->setMaxParkedDomains(-1);
1309
        } else {
1310
            $ac->setMaxParkedDomains(intval($account['maxparked']));
1311
        }
1312
1313
        $ac->setIsLocked((bool)$account['is_locked']);
1314
        $ac->setOwner($account['owner']);
1315
        $ac->setInodesLimit($account['inodeslimit'] === "unlimited" ? -1 : intval($account['inodeslimit']));
1316
1317
        return $ac;
1318
    }
1319
1320
    /**
1321
     *
1322
     * @return array
1323
     */
1324
    public function toArray()
1325
    {
1326
        return [
1327
            'legacy_backup'                        => $this->isLegacyBackup(),
1328
            'inodesused'                           => $this->getInodeUsed(),
1329
            'min_defer_fail_to_trigger_protection' => $this->getMinDeferFailToTriggerProtection(),
1330
            'maxlst'                               => $this->getMaxMailingList(),
1331
            'max_email_per_hour'                   => $this->getMaxEmailPerHour(),
1332
            'suspendreason'                        => $this->getSuspensionReason(),
1333
            'backup'                               => $this->isBackupEnabled(),
1334
            'suspendtime'                          => $this->getSuspendedAt()->format(DATE_ATOM),
1335
            'maxpop'                               => $this->getMaxPOP(),
1336
            'suspended'                            => $this->isSuspended(),
1337
            'uid'                                  => $this->getUid(),
1338
            'user'                                 => $this->getUser(),
1339
            'plan'                                 => $this->getPlanName(),
1340
            'has_backup'                           => $this->isBackup(),
1341
            'outgoing_mail_suspended'              => $this->isOutgoingMailSuspended(),
1342
            'startdate'                            => $this->getCreatedAt()->format(DATE_ATOM),
1343
            'maxftp'                               => $this->getMaxFTP(),
1344
            'temporary'                            => $this->isTemporary(),
1345
            'domain'                               => $this->getDomain(),
1346
            'disklimit'                            => $this->getDiskLimit(),
1347
            'max_emailacct_quota'                  => $this->getMaxEmailAccountQuota(),
1348
            'shell'                                => $this->getShell(),
1349
            'partition'                            => $this->getPartition(),
1350
            'mailbox_format'                       => $this->getMailboxFormat(),
1351
            'ip'                                   => $this->getIpAddress(),
1352
            'maxsub'                               => $this->getMaxSubDomain(),
1353
            'max_defer_fail_percentage'            => $this->getMaxDeferFailMailPercentage(),
1354
            'diskused'                             => $this->getDiskUsed(),
1355
            'maxsql'                               => $this->getMaxSQL(),
1356
            'maxaddons'                            => $this->getMaxAddonDomains(),
1357
            'theme'                                => $this->getTheme(),
1358
            'maxparked'                            => $this->getMaxParkedDomains(),
1359
            'is_locked'                            => $this->isLocked(),
1360
            'ipv6'                                 => $this->getIpv6(),
1361
            'email'                                => $this->getEmail(),
1362
            'outgoing_mail_hold'                   => $this->isOutgoingMailCanHold(),
1363
            'inodeslimit'                          => $this->getInodesLimit()
1364
        ];
1365
    }
1366
}
1367