• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

orchestral / sidekick / 15233909080

25 May 2025 03:49AM UTC coverage: 58.046% (-5.9%) from 63.924%
15233909080

push

github

crynobone
Merge branch '1.1.x' into 1.2.x

0 of 16 new or added lines in 1 file covered. (0.0%)

101 of 174 relevant lines covered (58.05%)

2.23 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/Env.php
1
<?php
2

3
namespace Orchestra\Sidekick;
4

5
/**
6
 * @api
7
 */
8
class Env extends \Illuminate\Support\Env
9
{
10
    /**
11
     * Determine if environmemt variable is available.
12
     */
13
    public static function has(string $key): bool
14
    {
NEW
15
        return static::get($key, new UndefinedValue) instanceof UndefinedValue === false;
×
16
    }
17

18
    /**
19
     * Set an environment value.
20
     */
21
    public static function set(string $key, string $value): void
22
    {
NEW
23
        static::getRepository()->set($key, $value);
×
24
    }
25

26
    /**
27
     * Forget an environment variable.
28
     *
29
     *
30
     * @throws \InvalidArgumentException
31
     */
32
    public static function forget(string $key): bool
33
    {
NEW
34
        return static::getRepository()->clear($key);
×
35
    }
36

37
    /**
38
     * Forward environment value.
39
     *
40
     * @param  \Orchestra\Sidekick\UndefinedValue|mixed|null  $default
41
     * @return mixed
42
     */
43
    public static function forward(string $key, $default = null)
44
    {
NEW
45
        if (\func_num_args() === 1) {
×
NEW
46
            $default = new UndefinedValue;
×
47
        }
48

NEW
49
        $value = static::get($key, $default);
×
50

NEW
51
        if ($value instanceof UndefinedValue) {
×
NEW
52
            return false;
×
53
        }
54

NEW
55
        return static::encode($value);
×
56
    }
57

58
    /**
59
     * Encode environment variable value.
60
     *
61
     * @param  mixed  $value
62
     * @return mixed
63
     */
64
    public static function encode($value)
65
    {
NEW
66
        if (\is_null($value)) {
×
NEW
67
            return '(null)';
×
68
        }
69

NEW
70
        if (\is_bool($value)) {
×
NEW
71
            return $value === true ? '(true)' : '(false)';
×
72
        }
73

NEW
74
        if (empty($value)) {
×
NEW
75
            return '(empty)';
×
76
        }
77

NEW
78
        return $value;
×
79
    }
80
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc