public static function mergeCSPList(array $cspList)
    {
        $finalCSP = [];

        foreach ($cspList as $csp)
        {
            foreach ($csp as $directive => $sources)
            {
                if ( ! isset($finalCSP[$directive]))
                {
                    $finalCSP[$directive] = $sources;

                    continue;
                }
                elseif ($finalCSP[$directive] === true)
                {
                    continue;
                }
                else
                {
                    $finalCSP[$directive] = array_merge(
                        $finalCSP[$directive],
                        $sources
                    );

                    continue;
                }
            }
        }

        return $finalCSP;
    }
public static function mergeCSPList(array $cspList)
    {
        $finalCSP = [];

        foreach ($cspList as $csp)
        {
            foreach ($csp as $directive => $sources)
            {
                if ( ! isset($finalCSP[$directive]))
                {
                    $finalCSP[$directive] = $sources;

                    continue;
                }
                elseif ($finalCSP[$directive] === true)
                {
                    continue;
                }
                else
                {
                    $finalCSP[$directive] = array_merge(
                        $finalCSP[$directive],
                        $sources
                    );

                    continue;
                }
            }
        }

        return $finalCSP;
    }
public static function mergeCSPList ( array $ cspList ) { $ finalCSP = [ ] ; foreach ( $ cspList as $ csp ) { foreach ( $ csp as $ directive => $ sources ) { if ( ! isset ( $ finalCSP [ $ directive ] ) ) { $ finalCSP [ $ directive ] = $ sources ; continue ; } elseif ( $ finalCSP [ $ directive ] === true ) { continue ; } else { $ finalCSP [ $ directive ] = array_merge ( $ finalCSP [ $ directive ] , $ sources ) ; continue ; } } } return $ finalCSP ; }
Merge a multiple CSP configs together into a single CSP

@param array $cspList
@return array
Merge a multiple CSP configs together into a single CSP