Debian Codegraph @

lib/3rdParty/composer/nesbot/carbon/src/Carbon/Traits/MagicParameter.php

raw symbols SCIP
1 <?php
2
3 declare(strict_types=1);
4
5 /**
6 * This file is part of the Carbon package.
7 *
8 * (c) Brian Nesbitt <[email protected]>
9 *
10 * For the full copyright and license information, please view the LICENSE
11 * file that was distributed with this source code.
12 */
13
14 namespace Carbon\Traits;
15
16 /**
17 * Trait MagicParameter.
18 *
19 * Allows to retrieve parameter in magic calls by index or name.
20 */
21 trait MagicParameter
22 {
23 private function getMagicParameter(array $parameters, int $index, string $key, $default)
24 {
25 if (\array_key_exists($index, $parameters)) {
26 return $parameters[$index];
27 }
28
29 if (\array_key_exists($key, $parameters)) {
30 return $parameters[$key];
31 }
32
33 return $default;
34 }
35 }