Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 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
 
12
namespace Carbon\Traits;
13
 
14
/**
15
 * Trait MagicParameter.
16
 *
17
 * Allows to retrieve parameter in magic calls by index or name.
18
 */
19
trait MagicParameter
20
{
21
    private function getMagicParameter(array $parameters, int $index, string $key, $default)
22
    {
23
        if (\array_key_exists($index, $parameters)) {
24
            return $parameters[$index];
25
        }
26
 
27
        if (\array_key_exists($key, $parameters)) {
28
            return $parameters[$key];
29
        }
30
 
31
        return $default;
32
    }
33
}