Issues (5)

demo/string-options.php (1 issue)

Labels
Severity
1
<?php
2
/**
3
 * @copyright   Copyright 2017 Fwolf
4
 * @license     https://opensource.org/licenses/MIT MIT
5
 */
6
7
use Fwolf\Config\StringOptions;
8
9
require __DIR__ . '/../bootstrap.php';
10
11
12
$eol = ('cli' == PHP_SAPI) ? PHP_EOL : "<br />\n";
13
14
15
$config = new StringOptions();
16
17
echo "Assign single value" . $eol;
18
$config->setStringOptions('foo1 = 42');
19
20
// Result: 42
21
echo "Result: " . $config->get('foo1') . $eol;
0 ignored issues
show
Are you sure $config->get('foo1') of type mixed|false|array can be used in concatenation? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

21
echo "Result: " . /** @scrutinizer ignore-type */ $config->get('foo1') . $eol;
Loading history...
22
23
24
echo "Assign multiple value" . $eol;
25
$config->setStringOptions('foo2=hello, foo3');
26
27
// Result: "hello"
28
echo "Result: " . json_encode($config->get('foo2')) . $eol;
29
// Result: true
30
echo "Result: " . json_encode($config->get('foo3')) . $eol;
31
32
33
echo "Dump all configuration{$eol}";
34
// foo1=42, foo2=hello, foo3=true
35
echo $config->export() . $eol;
36