File tree Expand file tree Collapse file tree 3 files changed +10
-26
lines changed Expand file tree Collapse file tree 3 files changed +10
-26
lines changed Original file line number Diff line number Diff line change @@ -90,9 +90,9 @@ public function __construct($date = null, $timezone = null)
9090 }
9191
9292 // clone copy of self
93- if (!self ::isTimeInstance ()){
94- self ::$ staticData = clone $ this ;
95- }
93+ // if(!self::isTimeInstance()){
94+ // self::$staticData = $this->copy() ;
95+ // }
9696 }
9797
9898 /**
@@ -114,13 +114,6 @@ public function __call($name, $args)
114114 return self ::nonExistMethod ($ name , $ args , $ this );
115115 }
116116
117- /**
118- * Handle the calls to non-existent static methods.
119- * @param string $name
120- * @param mixed $args
121- *
122- * @return mixed
123- */
124117 /**
125118 * Magic: static dynamic calls map to supported methods using stored static instance.
126119 *
@@ -130,7 +123,11 @@ public function __call($name, $args)
130123 */
131124 public static function __callStatic ($ name , $ args )
132125 {
133- return self ::nonExistMethod ($ name , $ args , self ::$ staticData );
126+ $ instance = (self ::$ staticData instanceof self)
127+ ? self ::$ staticData ->copy ()
128+ : new self ();
129+
130+ return self ::nonExistMethod ($ name , $ args , $ instance );
134131 }
135132
136133 /**
Original file line number Diff line number Diff line change 44
55namespace Tamedevelopers \Support \Traits ;
66
7- use Closure ;
87use DateTime ;
98use Tamedevelopers \Support \Str ;
10- use Tamedevelopers \Support \Time ;
119use Tamedevelopers \Support \Country ;
1210use Tamedevelopers \Support \Capsule \TimeHelper ;
1311use Tamedevelopers \Support \Capsule \CustomException ;
1816 *
1917 * Internal helpers used by the Time class for cloning, timezone handling,
2018 * and common operations. Public API is provided by Time and dynamic dispatch.
21- * @property mixed $staticData
2219*/
2320trait TimeTrait{
24-
25- /**
26- * Determine whether the static context already holds a Time instance.
27- *
28- * @return bool
29- */
30- static protected function isTimeInstance ()
31- {
32- return self ::$ staticData instanceof Time;
33- }
3421
3522 /**
3623 * Clone a new instance of the owning class.
Original file line number Diff line number Diff line change 2121
2222$ time2 = (new Time )->setTimezone ('America/St_Barthelemy ' );
2323$ time3 = (new Time )->setTimezone ('Indian/Antananarivo ' );
24- $ time4 = TameTime ('first day of December 2008 ' , 'Pacific/Pago_Pago ' );
24+ // $time4 = TameTime('first day of December 2008', 'Pacific/Pago_Pago');
2525
2626// [
2727// $time->toJsTimer('24 Jan 2025 14:00:00'),
3737
3838dd (
3939 $ time2 ,
40- $ time3 ,
40+ $ time3:: greetings ( ' 24 Jan 2025 14:00:00 ' ) ,
4141);
4242
4343dd (
You can’t perform that action at this time.
0 commit comments