-
Notifications
You must be signed in to change notification settings - Fork 0
/
Subreddit.php
2161 lines (1968 loc) · 62.8 KB
/
Subreddit.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
declare(strict_types=1);
namespace snuze\Reddit\Thing;
/**
* The Subreddit class represents the significant properties of a subreddit. An
* attempt has been made to map all fields supplied by the API, regardless of
* their utility (or lack thereof).
*
* Implementation warning: Array properties are currently populated as-is,
* without any further processing. Calling their getters will return an array.
* In the case of image dimensions ($bannerSize, $emojisCustomSize, etc.) the
* array will contain integer width and height values. In other cases, it may
* hold key/value pairs defining the property. This is subject to change in a
* future major version, such that some other value(s) may be returned instead.
*
* *****************************************************************************
* This file is part of Snuze, a PHP client for the Reddit API.
* Copyright 2019 Shaun Cummiskey <shaun@shaunc.com> <https://shaunc.com/>
* Repository: <https://github.com/snuze/snuze/>
* Documentation: <https://snuze.shaunc.com/>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
class Subreddit extends Thing
{
/**
* A regular expression used to test whether or not a subreddit name is
* valid. Subreddit names must be between 3 and 21 characters long, contain
* only alphanumerics and underscores, and can't start with an underscore.
* There are several grandfathered exceptions, which are considered here.
*/
const REGEX_VALID_NAME = '/^((?:[a-z0-9](?:[a-z0-9_]){2,20})|reddit\.com|ca|de|es|eu|fr|it|ja|nl|pl|ru)$/i';
/*
* These properties are documented alongside their accessors, below.
*/
protected $accountsActive = 0;
protected $accountsActiveIsFuzzed = false;
protected $activeUserCount = 0;
protected $advertiserCategory = '';
protected $allOriginalContent = false;
protected $allowDiscovery = true;
protected $allowImages = true;
protected $allowVideogifs = true;
protected $allowVideos = true;
protected $bannerBackgroundColor = '';
protected $bannerBackgroundImage = '';
protected $bannerImg = '';
protected $bannerSize = null;
protected $canAssignLinkFlair = false;
protected $canAssignUserFlair = false;
protected $coins = 0;
protected $collapseDeletedComments = false;
protected $collectionsEnabled = false;
protected $commentScoreHideMins = 0;
protected $communityIcon = '';
protected $contentCategory = '';
protected $description = '';
protected $descriptionHtml = null;
protected $disableContributorRequests = false;
protected $displayName = null;
protected $displayNamePrefixed = '';
protected $emojisCustomSize = null;
protected $emojisEnabled = false;
protected $eventPostsEnabled = false;
protected $freeFormReports = true;
protected $hasMenuWidget = false;
protected $headerImg = null;
protected $headerSize = null;
protected $headerTitle = null;
protected $hideAds = false;
protected $iconImg = '';
protected $iconSize = null;
protected $isCrosspostableSubreddit = null;
protected $isEnrolledInNewModmail = null;
protected $keyColor = '';
protected $lang = '';
protected $linkFlairEnabled = false;
protected $linkFlairPosition = '';
protected $mobileBannerImage = '';
protected $name = '';
protected $notificationLevel = null;
protected $originalContentTagEnabled = false;
protected $over18 = false;
protected $primaryColor = '';
protected $publicDescription = '';
protected $publicDescriptionHtml = '';
protected $publicTraffic = false;
protected $quarantine = false;
protected $restrictCommenting = false;
protected $restrictPosting = true;
protected $showMedia = false;
protected $showMediaPreview = true;
protected $spoilersEnabled = true;
protected $submissionType = '';
protected $submitLinkLabel = null;
protected $submitText = '';
protected $submitTextHtml = null;
protected $submitTextLabel = null;
protected $subredditType = '';
protected $subscribers = 0;
protected $suggestedCommentSort = null;
protected $title = null;
protected $url = '';
protected $userCanFlairInSr = null;
protected $userFlairBackgroundColor = null;
protected $userFlairCssClass = null;
protected $userFlairEnabledInSr = true;
protected $userFlairPosition = '';
protected $userFlairRichtext = [];
protected $userFlairTemplateId = null;
protected $userFlairText = null;
protected $userFlairTextColor = null;
protected $userFlairType = '';
protected $userHasFavorited = false;
protected $userIsBanned = false;
protected $userIsContributor = false;
protected $userIsModerator = false;
protected $userIsMuted = false;
protected $userIsSubscriber = false;
protected $userSrFlairEnabled = null;
protected $userSrThemeEnabled = false;
protected $videostreamLinksCount = null;
protected $whitelistStatus = null;
protected $wikiEnabled = null;
protected $wls = null;
/**
* Constructor.
*/
public function __construct() {
/* All Thing children must call parent ctor and set property names */
parent::__construct(Thing::KIND_SUBREDDIT);
$this->_propertyNames = array_keys(get_object_vars($this));
$this->debug('ctor args: ' . var_export(func_get_args(), true));
/*
* Override parent to work around an inconsistency in Reddit's field
* naming scheme. Accounts have a field called over_18, but Subreddits
* call it over18 with no underscore. Since no other field names in a
* Subreddit contain numbers, digits can just be ignored here.
*/
$this->_propertyTranslationRegex = '|([a-z])([A-Z])|';
}
/**
* Get the (approximate) number of users interacting with this subreddit
* over the past 15 minutes. Duplicate of getActiveUserCount().
*
* For some unknown reason, Reddit occasionally returns this as an empty
* array instead of an integer. It's not reproducible; you can ask for the
* same subreddit 500 times, and get an integer 499 times, and an empty
* array once. In cases where this occurs, this method will return 0.
*
* @return int
*/
public function getAccountsActive(): int {
return $this->accountsActive;
}
/**
* Set the (approximate) number of users interacting with this subreddit
* over the past 15 minutes.
*
* For some unknown reason, Reddit occasionally returns this as an empty
* array instead of an integer. It's not reproducible; you can ask for the
* same subreddit 500 times, and get an integer 499 times, and an empty
* array once. As a kludge, we accept any type here and cast it to an int;
* the randomly-encountered empty array will translate to 0.
*
* @param mixed $accountsActive
* @return $this
*/
protected function setAccountsActive($accountsActive = null) {
$this->accountsActive = (int) $accountsActive;
return $this;
}
/**
* Get whether or not accountsActive and activeUserCount values are slightly
* adjusted to mitigate statistical inference attacks
*
* @return bool
*/
public function getAccountsActiveIsFuzzed(): bool {
return $this->accountsActiveIsFuzzed;
}
/**
* Set whether or not accountsActive and activeUserCount values are slightly
* adjusted to mitigate statistical inference attacks
*
* @param bool $accountsActiveIsFuzzed
* @return $this
*/
protected function setAccountsActiveIsFuzzed(bool $accountsActiveIsFuzzed) {
$this->accountsActiveIsFuzzed = $accountsActiveIsFuzzed;
return $this;
}
/**
* Get the (approximate) number of users interacting with this subreddit.
* Duplicate of getAccountsActive().
*
* For some unknown reason, Reddit occasionally returns this as an empty
* array instead of an integer. It's not reproducible; you can ask for the
* same subreddit 500 times, and get an integer 499 times, and an empty
* array once. In cases where this occurs, this method will return 0.
*
* @return int
*/
public function getActiveUserCount(): int {
return $this->activeUserCount;
}
/**
* Set the (approximate) number of users interacting with this subreddit.
*
* For some unknown reason, Reddit occasionally returns this as an empty
* array instead of an integer. It's not reproducible; you can ask for the
* same subreddit 500 times, and get an integer 499 times, and an empty
* array once. As a kludge, we accept any type here and cast it to an int;
* the randomly-encountered empty array will translate to 0.
*
* @param mixed $activeUserCount
* @return $this
*/
protected function setActiveUserCount($activeUserCount) {
$this->activeUserCount = (int) $activeUserCount;
return $this;
}
/**
* Get the advertiser category, if any, this subreddit belongs to.
*
* @return string
*/
public function getAdvertiserCategory(): string {
return $this->advertiserCategory;
}
/**
* Set the advertiser category, if any, this subreddit belongs to.
*
* @param string $advertiserCategory
* @return $this
*/
protected function setAdvertiserCategory(string $advertiserCategory) {
$this->advertiserCategory = $advertiserCategory;
return $this;
}
/**
* Get whether or not this subreddit has the "mark all posts in this
* subreddit as Original Content (OC) on the desktop redesign" option enabled
*
* @return bool
*/
public function getAllOriginalContent(): bool {
return $this->allOriginalContent;
}
/**
* Set whether or not this subreddit has the "mark all posts in this
* subreddit as Original Content (OC) on the desktop redesign" option enabled
*
* @param bool $allOriginalContent
* @return $this
*/
protected function setAllOriginalContent(bool $allOriginalContent) {
$this->allOriginalContent = $allOriginalContent;
return $this;
}
/**
* Get whether or not this subreddit has the "allow this subreddit to be
* exposed to users who have shown intent or interest through discovery and
* onboarding" option enabled
*
* @return bool
*/
public function getAllowDiscovery(): bool {
return $this->allowDiscovery;
}
/**
* Set whether or not this subreddit has the "allow this subreddit to be
* exposed to users who have shown intent or interest through discovery and
* onboarding" option enabled
*
* @param bool $allowDiscovery
* @return $this
*/
protected function setAllowDiscovery(bool $allowDiscovery) {
$this->allowDiscovery = $allowDiscovery;
return $this;
}
/**
* Get whether or not this subreddit has the "allow image uploads and links
* to image hosting sites" option enabled
*
* @return bool
*/
public function getAllowImages(): bool {
return $this->allowImages;
}
/**
* Set whether or not this subreddit has the "allow image uploads and links
* to image hosting sites" option enabled
*
* @param bool $allowImages
* @return $this
*/
protected function setAllowImages(bool $allowImages) {
$this->allowImages = $allowImages;
return $this;
}
/**
* Get whether or not videogifs are allowed in this subreddit, whatever
* videogifs are.
*
* @return bool
* @todo verify what exactly this corresponds to
*/
public function getAllowVideogifs(): bool {
return $this->allowVideogifs;
}
/**
* Set whether or not videogifs are allowed in this subreddit, whatever
* videogifs are.
*
* @param bool $allowVideogifs
* @return $this
* @todo verify what exactly this corresponds to
*/
protected function setAllowVideogifs(bool $allowVideogifs) {
$this->allowVideogifs = $allowVideogifs;
return $this;
}
/**
* Get whether or not this subreddit has the "allow video uploads" option
* enabled
*
* @return bool
*/
public function getAllowVideos(): bool {
return $this->allowVideos;
}
/**
* Set whether or not this subreddit has the "allow video uploads" option
* enabled
*
* @param bool $allowVideos
* @return $this
*/
protected function setAllowVideos(bool $allowVideos) {
$this->allowVideos = $allowVideos;
return $this;
}
/**
* Get the HTML hex color code for this subreddit's banner background, if any
*
* @return string
*/
public function getBannerBackgroundColor(): string {
return $this->bannerBackgroundColor;
}
/**
* Set the HTML hex color code for this subreddit's banner background, if any
*
* @param string $bannerBackgroundColor
* @return $this
*/
protected function setBannerBackgroundColor(string $bannerBackgroundColor) {
$this->bannerBackgroundColor = $bannerBackgroundColor;
return $this;
}
/**
* Get the URL to this subreddit's banner background image, if any. This is
* the image that displays on the desktop site.
*
* @return string
*/
public function getBannerBackgroundImage(): string {
return $this->bannerBackgroundImage;
}
/**
* Set the URL to this subreddit's banner background image, if any. This is
* the image that displays on the desktop site.
*
* @param string $bannerBackgroundImage
* @return $this
*/
protected function setBannerBackgroundImage(string $bannerBackgroundImage) {
$this->bannerBackgroundImage = $bannerBackgroundImage;
return $this;
}
/**
* Get the URL to this subreddit's banner image, if any.
*
* @return string
*/
public function getBannerImg(): string {
return $this->bannerImg;
}
/**
* Set the URL to this subreddit's banner image, if any
*
* @param string $bannerImg
* @return $this
*/
protected function setBannerImg(string $bannerImg) {
$this->bannerImg = $bannerImg;
return $this;
}
/**
* Get the banner image dimensions. If set, this will be an array containing
* two integer values.
*
* @return array|null
*/
public function getBannerSize(): ?array {
return $this->bannerSize;
}
/**
* Set the banner image dimensions. This should be an array containing
* two integer values.
*
* @param array $bannerSize
* @return $this
*/
protected function setBannerSize(array $bannerSize = null) {
$this->bannerSize = $bannerSize;
return $this;
}
/**
* Get whether or not users can assign flair to their own links in this
* subreddit
*
* @return bool
*/
public function getCanAssignLinkFlair(): bool {
return $this->canAssignLinkFlair;
}
/**
* Set whether or not users can assign flair to their own links in this
* subreddit
*
* @param bool $canAssignLinkFlair
* @return $this
*/
protected function setCanAssignLinkFlair(bool $canAssignLinkFlair) {
$this->canAssignLinkFlair = $canAssignLinkFlair;
return $this;
}
/**
* Get whether or not this subreddit allows users to assign flair to
* themselves
*
* @return bool
*/
public function getCanAssignUserFlair(): bool {
return $this->canAssignUserFlair;
}
/**
* Set whether or not this subreddit allows users to assign flair to
* themselves
*
* @param bool $canAssignUserFlair
* @return $this
*/
protected function setCanAssignUserFlair(bool $canAssignUserFlair) {
$this->canAssignUserFlair = $canAssignUserFlair;
return $this;
}
/**
* Get this subreddit's Community Awards coin balance. If the subreddit
* has no Community Awards coins, this will be 0.
*
* @return int
*/
public function getCoins(): int {
return $this->coins;
}
/**
* Set this subreddit's Community Awards coin balance.
*
* @param int $coins
* @return $this
*/
public function setCoins(int $coins) {
$this->coins = $coins;
return $this;
}
/**
* Get whether or not this subreddit has the "collapse deleted and removed
* comments" option enabled
*
* @return bool
*/
public function getCollapseDeletedComments(): bool {
return $this->collapseDeletedComments;
}
/**
* Get whether or not this subreddit supports links that are collections
* of other links
*
* @return bool|null
*/
public function getCollectionsEnabled(): bool {
return $this->collectionsEnabled;
}
/**
* Set whether or not this subreddit supports links that are collections
* of other links
*
* @param bool $collectionsEnabled
* @return $this
*/
public function setCollectionsEnabled(bool $collectionsEnabled) {
$this->collectionsEnabled = $collectionsEnabled;
return $this;
}
/**
* Set whether or not this subreddit has the "collapse deleted and removed
* comments" option enabled
*
* @param bool $collapseDeletedComments
* @return $this
*/
protected function setCollapseDeletedComments(bool $collapseDeletedComments) {
$this->collapseDeletedComments = $collapseDeletedComments;
return $this;
}
/**
* Get the "Minutes to hide comment scores" value for this subreddit
*
* @return int
*/
public function getCommentScoreHideMins(): int {
return $this->commentScoreHideMins;
}
/**
* Set the "Minutes to hide comment scores" value for this subreddit
*
* @param int $commentScoreHideMins
* @return $this
*/
protected function setCommentScoreHideMins(int $commentScoreHideMins = 0) {
$this->commentScoreHideMins = $commentScoreHideMins;
return $this;
}
/**
* Get the URL to this subreddit's community icon image, if any
*
* @return string
*/
public function getCommunityIcon(): string {
return $this->communityIcon;
}
/**
* Set the URL to this subreddit's community icon image, if any
*
* @param string $communityIcon
* @return $this
*/
protected function setCommunityIcon(string $communityIcon) {
$this->communityIcon = $communityIcon;
return $this;
}
/**
* Get this subreddit's assigned content category, if any
*
* @return string
*/
public function getContentCategory(): string {
return $this->contentCategory;
}
/**
* Set this subreddit's assigned content category, if any
*
* @param string $contentCategory
* @return $this
*/
protected function setContentCategory(string $contentCategory) {
$this->contentCategory = $contentCategory;
return $this;
}
/**
* Get this subreddit's description
*
* @return string
*/
public function getDescription(): string {
return $this->description;
}
/**
* Set this subreddit's description
*
* @param string $description
* @return $this
*/
protected function setDescription(string $description) {
$this->description = $description;
return $this;
}
/**
* Get this subreddit's description as HTML instead of text
*
* @return string|null
*/
public function getDescriptionHtml(): ?string {
return $this->descriptionHtml;
}
/**
* Set this subreddit's description as HTML instead of text
*
* @param string $descriptionHtml
* @return $this
*/
protected function setDescriptionHtml(string $descriptionHtml = null) {
$this->descriptionHtml = $descriptionHtml;
return $this;
}
/**
* Get whether or not this subreddit forbids public requests for status as
* an approved submitter. (This may be true even if the subreddit is
* currently public.)
*
* @return bool
*/
public function getDisableContributorRequests(): bool {
return $this->disableContributorRequests;
}
/**
* Set whether or not this subreddit forbids public requests for status as
* an approved submitter.
*
* @param bool $disableContributorRequests
* @return $this
*/
protected function setDisableContributorRequests(bool $disableContributorRequests) {
$this->disableContributorRequests = $disableContributorRequests;
return $this;
}
/**
* Get the undecorated display name of the subreddit e.g. "funny"
*
* @return string
*/
public function getDisplayName(): string {
return $this->displayName;
}
/**
* Set the display name of the subreddit e.g. "funny". The supplied name
* is checked against known subreddit name restrictions.
*
* @param string $displayName
* @throws \snuze\Exception\ArgumentException
*/
protected function setDisplayName(string $displayName) {
/* Check for a valid subreddit name */
if (!preg_match(self::REGEX_VALID_NAME, $displayName)) {
throw new \snuze\Exception\ArgumentException($this,
'Invalid subreddit name');
}
$this->displayName = $displayName;
}
/**
* Get the subreddit name with its relative path e.g. "r/funny", or
* "u/joe" for user profile subreddits
*
* @return string
*/
public function getDisplayNamePrefixed(): string {
return $this->displayNamePrefixed;
}
/**
* Set the subreddit name with its relative path e.g. "r/funny", or
* "u/joe" for user profile subreddits
*
* @param string $displayNamePrefixed
* @return $this
*/
protected function setDisplayNamePrefixed(string $displayNamePrefixed) {
$this->displayNamePrefixed = $displayNamePrefixed;
return $this;
}
/**
* Get the emoji image dimensions. If set, this will be an array containing
* two integer values.
*
* @return array|null
*/
public function getEmojisCustomSize(): ?array {
return $this->emojisCustomSize;
}
/**
* Set the emoji image dimensions. This should be an array containing
* two integer values.
*
* @param array $emojisCustomSize
* @return $this
*/
protected function setEmojisCustomSize(array $emojisCustomSize = null) {
$this->emojisCustomSize = $emojisCustomSize;
return $this;
}
/**
* Get whether or not custom emojis are enabled for this subreddit
*
* @return bool
*/
public function getEmojisEnabled(): bool {
return $this->emojisEnabled;
}
/**
* Set whether or not custom emojis are enabled for this subreddit
*
* @param bool $emojisEnabled
* @return $this
*/
protected function setEmojisEnabled(bool $emojisEnabled) {
$this->emojisEnabled = $emojisEnabled;
return $this;
}
/**
* Get whether or not this subreddit supports links that are event posts
*
* @return bool
*/
public function getEventPostsEnabled(): bool {
return $this->eventPostsEnabled;
}
/**
* Set whether or not this subreddit supports links that are event posts
*
* @param bool $eventPostsEnabled
* @return $this
*/
public function setEventPostsEnabled(bool $eventPostsEnabled) {
$this->eventPostsEnabled = $eventPostsEnabled;
return $this;
}
/**
* Get whether or not this subreddit has the "allow free-form reports by
* users" option enabled
*
* @return bool
*/
public function getFreeFormReports(): bool {
return $this->freeFormReports;
}
/**
* Set whether or not this subreddit has the "allow free-form reports by
* users" option enabled
*
* @param bool $freeFormReports
* @return $this
*/
protected function setFreeFormReports(bool $freeFormReports) {
$this->freeFormReports = $freeFormReports;
return $this;
}
/**
* Get whether or not this subreddit has custom menu tabs defined by a
* moderator.
*
* @return bool
*/
public function getHasMenuWidget(): bool {
return $this->hasMenuWidget;
}
/**
* Set whether or not this subreddit has custom menu tabs defined by a
* moderator.
*
* @param bool $hasMenuWidget
* @return $this
*/
protected function setHasMenuWidget(bool $hasMenuWidget) {
$this->hasMenuWidget = $hasMenuWidget;
return $this;
}
/**
* Get the URL to this subreddit's header image, if any. This is the
* image that appears in place of Snoo on the old style Reddit.
*
* @return string|null
*/
public function getHeaderImg(): ?string {
return $this->headerImg;
}
/**
* Set the URL to this subreddit's header image, if any. This is the
* image that appears in place of Snoo on the old style Reddit.
*
* @param string $headerImg
* @return $this
*/
protected function setHeaderImg(string $headerImg = null) {
$this->headerImg = $headerImg;
return $this;
}
/**
* Get the header image dimensions. If set, this will be an array containing
* two integer values.
*
* @return array|null
*/
public function getHeaderSize(): ?array {
return $this->headerSize;
}
/**
* Set the header image dimensions. This should be an array containing
* two integer values.
*
* @param array $headerSize
* @return $this
*/
protected function setHeaderSize(array $headerSize = null) {
$this->headerSize = $headerSize;
return $this;
}
/**
* Get the title/alt text of this subreddit's header image, if any
*
* @return string|null
*/
public function getHeaderTitle(): ?string {
return $this->headerTitle;
}
/**
* Set the title/alt text of this subreddit's header image, if any
*
* @param string $headerTitle
* @return $this
*/
protected function setHeaderTitle(string $headerTitle = null) {
$this->headerTitle = $headerTitle;
return $this;
}
/**
* Get whether or not ads have been administratively suppressed in this
* subreddit
*
* @return bool
*/
public function getHideAds(): bool {
return $this->hideAds;
}
/**
* Set whether or not ads have been administratively suppressed in this
* subreddit
*
* @param bool $hideAds
* @return $this
*/
protected function setHideAds(bool $hideAds) {
$this->hideAds = $hideAds;
return $this;
}
/**
* Get the URL to this subreddit's icon image, if any. This icon is
* displayed in the "Community Details" portion of the sidebar and in
* public "card" style listings, both on the redesign interface.
*
* @return string
*/
public function getIconImg(): string {
return $this->iconImg;
}
/**
* Set the URL to this subreddit's icon image, if any. This icon is
* displayed in the "Community Details" portion of the sidebar and in
* public "card" style listings, both on the redesign interface.
*
* @param string $iconImg
* @return $this
*/
protected function setIconImg(string $iconImg) {
$this->iconImg = $iconImg;
return $this;
}
/**
* Get the icon image dimensions. If set, this will be an array containing
* two integer values.
*
* @return array|null
*/
public function getIconSize(): ?array {
return $this->iconSize;
}
/**
* Set the icon image dimensions. This should be an array containing
* two integer values.
*
* @param array $iconSize
* @return $this
*/
protected function setIconSize(array $iconSize = null) {
$this->iconSize = $iconSize;
return $this;
}
/**
* Get whether or not this subreddit has the "Allow crossposting of posts"
* preference enabled. If crossposting is disabled, the Reddit API returns
* null instead of false; this method mirrors that behavior.
*
* @return bool|null
*/
public function getIsCrosspostableSubreddit(): ?bool {
return $this->isCrosspostableSubreddit;
}
/**
* Set whether or not this subreddit has the "Allow crossposting of posts"
* preference enabled.