PluginProbe ʕ •ᴥ•ʔ
Independent Analytics – WordPress Analytics Plugin / 2.15.2
Independent Analytics – WordPress Analytics Plugin v2.15.2
2.15.4 2.15.3 2.15.2 2.15.1 2.15.0 2.14.10 trunk 1.1 1.10 1.10.1 1.11 1.12 1.13 1.14 1.15 1.16 1.17 1.17.1 1.17.2 1.17.3 1.17.4 1.18 1.18.1 1.19.0 1.19.1 1.2 1.20.0 1.21.0 1.22.0 1.22.1 1.23.0 1.23.1 1.24.0 1.24.1 1.25.0 1.25.1 1.26.0 1.27.0 1.28.0 1.28.1 1.28.2 1.28.3 1.29.0 1.3 1.30.0 1.30.1 1.4 1.5 1.6 1.7 1.8 1.9 2.0.0 2.0.1 2.1.4 2.1.5 2.1.6 2.10.0 2.10.1 2.10.2 2.10.3 2.10.4 2.11.0 2.11.1 2.11.10 2.11.2 2.11.3 2.11.4 2.11.5 2.11.6 2.11.7 2.11.8 2.11.9 2.12.0 2.12.1 2.12.2 2.13.1 2.13.2 2.13.5 2.13.6 2.14.0 2.14.1 2.14.2 2.14.4 2.14.6 2.14.7 2.14.8 2.14.9 2.2.0 2.2.1 2.3.1 2.3.2 2.4.2 2.4.3 2.5.0 2.5.1 2.6.0 2.6.1 2.6.2 2.6.3 2.6.4 2.7.0 2.7.1 2.7.2 2.7.3 2.8.2 2.8.3 2.8.4 2.8.5 2.8.6 2.8.7 2.8.8 2.8.9 2.9.2 2.9.3 2.9.4 2.9.5 2.9.6 2.9.7
independent-analytics / vendor / illuminate / support / DateFactory.php
independent-analytics / vendor / illuminate / support Last commit date
Exceptions 2 weeks ago Facades 2 weeks ago Testing 2 weeks ago Traits 2 weeks ago AggregateServiceProvider.php 2 years ago Benchmark.php 2 weeks ago Carbon.php 2 weeks ago Composer.php 2 weeks ago ConfigurationUrlParser.php 2 weeks ago DateFactory.php 2 weeks ago Env.php 2 weeks ago Fluent.php 2 weeks ago HigherOrderTapProxy.php 2 years ago HtmlString.php 2 years ago InteractsWithTime.php 2 years ago Js.php 2 weeks ago Lottery.php 2 weeks ago Manager.php 2 years ago MessageBag.php 2 weeks ago MultipleInstanceManager.php 2 weeks ago NamespacedItemResolver.php 2 weeks ago Optional.php 2 weeks ago Pluralizer.php 2 weeks ago ProcessUtils.php 2 weeks ago Reflector.php 2 weeks ago ServiceProvider.php 2 years ago Str.php 2 weeks ago Stringable.php 2 weeks ago Timebox.php 2 weeks ago ValidatedInput.php 2 weeks ago ViewErrorBag.php 2 weeks ago helpers.php 2 weeks ago
DateFactory.php
211 lines
1 <?php
2
3 namespace IAWPSCOPED\Illuminate\Support;
4
5 use IAWPSCOPED\Carbon\Factory;
6 use InvalidArgumentException;
7 /**
8 * @see https://carbon.nesbot.com/docs/
9 * @see https://github.com/briannesbitt/Carbon/blob/master/src/Carbon/Factory.php
10 *
11 * @method \Illuminate\Support\Carbon create($year = 0, $month = 1, $day = 1, $hour = 0, $minute = 0, $second = 0, $tz = null)
12 * @method \Illuminate\Support\Carbon createFromDate($year = null, $month = null, $day = null, $tz = null)
13 * @method \Illuminate\Support\Carbon|false createFromFormat($format, $time, $tz = null)
14 * @method \Illuminate\Support\Carbon createFromTime($hour = 0, $minute = 0, $second = 0, $tz = null)
15 * @method \Illuminate\Support\Carbon createFromTimeString($time, $tz = null)
16 * @method \Illuminate\Support\Carbon createFromTimestamp($timestamp, $tz = null)
17 * @method \Illuminate\Support\Carbon createFromTimestampMs($timestamp, $tz = null)
18 * @method \Illuminate\Support\Carbon createFromTimestampUTC($timestamp)
19 * @method \Illuminate\Support\Carbon createMidnightDate($year = null, $month = null, $day = null, $tz = null)
20 * @method \Illuminate\Support\Carbon|false createSafe($year = null, $month = null, $day = null, $hour = null, $minute = null, $second = null, $tz = null)
21 * @method void disableHumanDiffOption($humanDiffOption)
22 * @method void enableHumanDiffOption($humanDiffOption)
23 * @method mixed executeWithLocale($locale, $func)
24 * @method \Illuminate\Support\Carbon fromSerialized($value)
25 * @method array getAvailableLocales()
26 * @method array getDays()
27 * @method int getHumanDiffOptions()
28 * @method array getIsoUnits()
29 * @method array getLastErrors()
30 * @method string getLocale()
31 * @method int getMidDayAt()
32 * @method \Illuminate\Support\Carbon|null getTestNow()
33 * @method \Symfony\Component\Translation\TranslatorInterface getTranslator()
34 * @method int getWeekEndsAt()
35 * @method int getWeekStartsAt()
36 * @method array getWeekendDays()
37 * @method bool hasFormat($date, $format)
38 * @method bool hasMacro($name)
39 * @method bool hasRelativeKeywords($time)
40 * @method bool hasTestNow()
41 * @method \Illuminate\Support\Carbon instance($date)
42 * @method bool isImmutable()
43 * @method bool isModifiableUnit($unit)
44 * @method bool isMutable()
45 * @method bool isStrictModeEnabled()
46 * @method bool localeHasDiffOneDayWords($locale)
47 * @method bool localeHasDiffSyntax($locale)
48 * @method bool localeHasDiffTwoDayWords($locale)
49 * @method bool localeHasPeriodSyntax($locale)
50 * @method bool localeHasShortUnits($locale)
51 * @method void macro($name, $macro)
52 * @method \Illuminate\Support\Carbon|null make($var)
53 * @method \Illuminate\Support\Carbon maxValue()
54 * @method \Illuminate\Support\Carbon minValue()
55 * @method void mixin($mixin)
56 * @method \Illuminate\Support\Carbon now($tz = null)
57 * @method \Illuminate\Support\Carbon parse($time = null, $tz = null)
58 * @method string pluralUnit(string $unit)
59 * @method void resetMonthsOverflow()
60 * @method void resetToStringFormat()
61 * @method void resetYearsOverflow()
62 * @method void serializeUsing($callback)
63 * @method void setHumanDiffOptions($humanDiffOptions)
64 * @method bool setLocale($locale)
65 * @method void setMidDayAt($hour)
66 * @method void setTestNow($testNow = null)
67 * @method void setToStringFormat($format)
68 * @method void setTranslator(\Symfony\Component\Translation\TranslatorInterface $translator)
69 * @method void setUtf8($utf8)
70 * @method void setWeekEndsAt($day)
71 * @method void setWeekStartsAt($day)
72 * @method void setWeekendDays($days)
73 * @method bool shouldOverflowMonths()
74 * @method bool shouldOverflowYears()
75 * @method string singularUnit(string $unit)
76 * @method \Illuminate\Support\Carbon today($tz = null)
77 * @method \Illuminate\Support\Carbon tomorrow($tz = null)
78 * @method void useMonthsOverflow($monthsOverflow = true)
79 * @method void useStrictMode($strictModeEnabled = true)
80 * @method void useYearsOverflow($yearsOverflow = true)
81 * @method \Illuminate\Support\Carbon yesterday($tz = null)
82 * @internal
83 */
84 class DateFactory
85 {
86 /**
87 * The default class that will be used for all created dates.
88 *
89 * @var string
90 */
91 const DEFAULT_CLASS_NAME = Carbon::class;
92 /**
93 * The type (class) of dates that should be created.
94 *
95 * @var string
96 */
97 protected static $dateClass;
98 /**
99 * This callable may be used to intercept date creation.
100 *
101 * @var callable
102 */
103 protected static $callable;
104 /**
105 * The Carbon factory that should be used when creating dates.
106 *
107 * @var object
108 */
109 protected static $factory;
110 /**
111 * Use the given handler when generating dates (class name, callable, or factory).
112 *
113 * @param mixed $handler
114 * @return mixed
115 *
116 * @throws \InvalidArgumentException
117 */
118 public static function use($handler)
119 {
120 if (\is_callable($handler) && \is_object($handler)) {
121 return static::useCallable($handler);
122 } elseif (\is_string($handler)) {
123 return static::useClass($handler);
124 } elseif ($handler instanceof Factory) {
125 return static::useFactory($handler);
126 }
127 throw new InvalidArgumentException('Invalid date creation handler. Please provide a class name, callable, or Carbon factory.');
128 }
129 /**
130 * Use the default date class when generating dates.
131 *
132 * @return void
133 */
134 public static function useDefault()
135 {
136 static::$dateClass = null;
137 static::$callable = null;
138 static::$factory = null;
139 }
140 /**
141 * Execute the given callable on each date creation.
142 *
143 * @param callable $callable
144 * @return void
145 */
146 public static function useCallable(callable $callable)
147 {
148 static::$callable = $callable;
149 static::$dateClass = null;
150 static::$factory = null;
151 }
152 /**
153 * Use the given date type (class) when generating dates.
154 *
155 * @param string $dateClass
156 * @return void
157 */
158 public static function useClass($dateClass)
159 {
160 static::$dateClass = $dateClass;
161 static::$factory = null;
162 static::$callable = null;
163 }
164 /**
165 * Use the given Carbon factory when generating dates.
166 *
167 * @param object $factory
168 * @return void
169 */
170 public static function useFactory($factory)
171 {
172 static::$factory = $factory;
173 static::$dateClass = null;
174 static::$callable = null;
175 }
176 /**
177 * Handle dynamic calls to generate dates.
178 *
179 * @param string $method
180 * @param array $parameters
181 * @return mixed
182 *
183 * @throws \RuntimeException
184 */
185 public function __call($method, $parameters)
186 {
187 $defaultClassName = static::DEFAULT_CLASS_NAME;
188 // Using callable to generate dates...
189 if (static::$callable) {
190 return \call_user_func(static::$callable, $defaultClassName::$method(...$parameters));
191 }
192 // Using Carbon factory to generate dates...
193 if (static::$factory) {
194 return static::$factory->{$method}(...$parameters);
195 }
196 $dateClass = static::$dateClass ?: $defaultClassName;
197 // Check if the date can be created using the public class method...
198 if (\method_exists($dateClass, $method) || \method_exists($dateClass, 'hasMacro') && $dateClass::hasMacro($method)) {
199 return $dateClass::$method(...$parameters);
200 }
201 // If that fails, create the date with the default class...
202 $date = $defaultClassName::$method(...$parameters);
203 // If the configured class has an "instance" method, we'll try to pass our date into there...
204 if (\method_exists($dateClass, 'instance')) {
205 return $dateClass::instance($date);
206 }
207 // Otherwise, assume the configured class has a DateTime compatible constructor...
208 return new $dateClass($date->format('Y-m-d H:i:s.u'), $date->getTimezone());
209 }
210 }
211