File tree Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ class Ban
99 /**
1010 * Time and Date when the ban expires.
1111 *
12- * @var Carbon
12+ * @var Carbon|null
1313 */
1414 public $ expires ;
1515
@@ -55,9 +55,23 @@ class Ban
5555 */
5656 public function __construct ($ ban )
5757 {
58- $ this ->expires = new Carbon ($ ban ['expiration ' ], 'UTC ' );
58+ // Expiration
59+ if ($ ban ['expiration ' ] === null ) {
60+ $ this ->expires = null ;
61+ } else {
62+ $ this ->expires = new Carbon ($ ban ['expiration ' ], 'UTC ' );
63+ }
64+
65+ // Time Added
5966 $ this ->created = new Carbon ($ ban ['timeAdded ' ], 'UTC ' );
60- $ this ->active = $ ban ['active ' ];
67+
68+ // Active
69+ $ this ->active = $ ban ['active ' ];
70+ if (!is_null ($ this ->expires ) && $ this ->active ) {
71+ if (!$ this ->expires ->greaterThan (Carbon::now ('UTC ' ))) {
72+ $ this ->active = false ;
73+ }
74+ }
6175
6276 $ this ->reason = $ ban ['reason ' ];
6377 $ this ->adminName = $ ban ['adminName ' ];
You can’t perform that action at this time.
0 commit comments