@@ -11,18 +11,18 @@ class Visit extends Entity
1111 public function setIpAddress ($ ipAddress )
1212 {
1313 if ($ long = ip2long ($ ipAddress ))
14- $ this ->ip_address = $ long ;
14+ $ this ->attributes [ ' ip_address ' ] = $ long ;
1515 else
16- $ this ->ip_address = $ ipAddress ;
16+ $ this ->attributes [ ' ip_address ' ] = $ ipAddress ;
1717 return $ this ;
1818 }
1919
2020 public function getIpAddress (string $ format = 'long ' )
2121 {
2222 if ($ format =="string " )
23- return long2ip ($ this ->ip_address );
23+ return long2ip ($ this ->attributes [ ' ip_address ' ] );
2424 else
25- return $ this ->ip_address ;
25+ return $ this ->attributes [ ' ip_address ' ] ;
2626 }
2727
2828 // magic timezone helpers
@@ -36,13 +36,13 @@ public function setCreatedAt(string $dateString)
3636 public function getCreatedAt (string $ format = 'Y-m-d H:i:s ' )
3737 {
3838 // Convert to CodeIgniter\I18n\Time object
39- $ this ->created_at = $ this ->mutateDate ($ this ->created_at );
39+ $ this ->attributes [ ' created_at ' ] = $ this ->mutateDate ($ this ->created_at );
4040
4141 $ timezone = $ this ->timezone ?? app_timezone ();
4242
43- $ this ->created_at ->setTimezone ($ timezone );
43+ $ this ->attributes [ ' created_at ' ] ->setTimezone ($ timezone );
4444
45- return $ this ->created_at ->format ($ format );
45+ return $ this ->attributes [ ' created_at ' ] ->format ($ format );
4646 }
4747
4848 // search for a visit with similar characteristics to the current one
@@ -60,11 +60,11 @@ public function getSimilar($trackingMethod, $resetMinutes = 60)
6060 // check for matching components within the last resetMinutes
6161 $ since = date ("Y-m-d H:i:s " , strtotime ("- " . $ resetMinutes . " minutes " ));
6262 $ similar = $ visits ->where ('host ' , $ this ->host )
63- ->where ('path ' , $ this ->path )
64- ->where ('query ' , (string )$ this ->query )
65- ->where ($ trackingMethod , $ this ->{$ trackingMethod })
66- ->where ("created_at >= " , $ since )
67- ->first ();
63+ ->where ('path ' , $ this ->path )
64+ ->where ('query ' , (string )$ this ->query )
65+ ->where ($ trackingMethod , $ this ->{$ trackingMethod })
66+ ->where ("created_at >= " , $ since )
67+ ->first ();
6868
6969 return $ similar ;
7070 }
0 commit comments