| Conditions | 4 |
| Paths | 5 |
| Total Lines | 28 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 23 | protected function getPolicies(string $customPolicyClass = null): Collection |
||
| 24 | { |
||
| 25 | $policies = collect(); |
||
| 26 | |||
| 27 | if ($customPolicyClass) { |
||
|
|
|||
| 28 | $policies->push(PolicyFactory::create($customPolicyClass)); |
||
| 29 | |||
| 30 | return $policies; |
||
| 31 | } |
||
| 32 | |||
| 33 | $policyClass = config('csp.policy'); |
||
| 34 | |||
| 35 | if (! empty($policyClass)) { |
||
| 36 | $policies->push(PolicyFactory::create($policyClass)); |
||
| 37 | } |
||
| 38 | |||
| 39 | $reportOnlyPolicyClass = config('csp.report_only_policy'); |
||
| 40 | |||
| 41 | if (! empty($reportOnlyPolicyClass)) { |
||
| 42 | $policy = PolicyFactory::create($reportOnlyPolicyClass); |
||
| 43 | |||
| 44 | $policy->reportOnly(); |
||
| 45 | |||
| 46 | $policies->push($policy); |
||
| 47 | } |
||
| 48 | |||
| 49 | return $policies; |
||
| 50 | } |
||
| 51 | } |
||
| 52 |
In PHP, under loose comparison (like
==, or!=, orswitchconditions), values of different types might be equal.For
stringvalues, the empty string''is a special case, in particular the following results might be unexpected: