wp-user-avatar
/
third-party
/
vendor
/
nesbot
/
carbon
/
src
/
Carbon
/
Traits
/
MagicParameter.php
Boundaries.php
2 months ago
Cast.php
2 months ago
Comparison.php
2 months ago
Converter.php
2 months ago
Creator.php
2 months ago
Date.php
2 months ago
DeprecatedProperties.php
2 months ago
Difference.php
2 months ago
IntervalRounding.php
2 months ago
IntervalStep.php
2 months ago
Localization.php
2 months ago
Macro.php
2 months ago
MagicParameter.php
2 months ago
Mixin.php
2 months ago
Modifiers.php
2 months ago
Mutability.php
2 months ago
ObjectInitialisation.php
2 months ago
Options.php
2 months ago
Rounding.php
2 months ago
Serialization.php
2 months ago
Test.php
2 months ago
Timestamp.php
2 months ago
ToStringFormat.php
2 months ago
Units.php
2 months ago
Week.php
2 months ago
MagicParameter.php
31 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * This file is part of the Carbon package. |
| 5 | * |
| 6 | * (c) Brian Nesbitt <brian@nesbot.com> |
| 7 | * |
| 8 | * For the full copyright and license information, please view the LICENSE |
| 9 | * file that was distributed with this source code. |
| 10 | */ |
| 11 | namespace ProfilePressVendor\Carbon\Traits; |
| 12 | |
| 13 | /** |
| 14 | * Trait MagicParameter. |
| 15 | * |
| 16 | * Allows to retrieve parameter in magic calls by index or name. |
| 17 | */ |
| 18 | trait MagicParameter |
| 19 | { |
| 20 | private function getMagicParameter(array $parameters, int $index, string $key, $default) |
| 21 | { |
| 22 | if (\array_key_exists($index, $parameters)) { |
| 23 | return $parameters[$index]; |
| 24 | } |
| 25 | if (\array_key_exists($key, $parameters)) { |
| 26 | return $parameters[$key]; |
| 27 | } |
| 28 | return $default; |
| 29 | } |
| 30 | } |
| 31 |