src/SecureHeaders.php
/**
     * Add a CSP array $csp of friendly sources to corresponding
     * firendly directives in either enforcement or report only mode.
     *
     * @param array $csp
     * @param bool $reportOnly
     * @return void
     */
Add a CSP array $csp of friendly sources to corresponding
firendly directives in either enforcement or report only mode.

@param array $csp
@param bool $reportOnly
@return void
Add a CSP array $csp of friendly sources to corresponding firendly directives in either enforcement or report only mode . @param array $csp @param bool $reportOnly @return void
private function cspArray(array $csp, $reportOnly = false)
    {
        foreach ($csp as $friendlyDirective => $sources)
        {
            if (is_array($sources) and ! empty($sources))
            {
                foreach ($sources as $friendlySource)
                {
                    $this->cspAllow(
                        $friendlyDirective,
                        $friendlySource,
                        $reportOnly
                    );
                }
            }
            elseif (is_int($friendlyDirective) and is_string($sources))
            {
                $friendlyDirective = $sources;
                $this->cspAllow($friendlyDirective, null, $reportOnly);
            }
            elseif ( ! is_array($sources))
            {
                $this->cspAllow($friendlyDirective, $sources, $reportOnly);
            }
        }
    }
private function cspArray ( array $ csp , $ reportOnly = false ) { foreach ( $ csp as $ friendlyDirective => $ sources ) { if ( is_array ( $ sources ) and ! empty ( $ sources ) ) { foreach ( $ sources as $ friendlySource ) { $ this -> cspAllow ( $ friendlyDirective , $ friendlySource , $ reportOnly ) ; } } elseif ( is_int ( $ friendlyDirective ) and is_string ( $ sources ) ) { $ friendlyDirective = $ sources ; $ this -> cspAllow ( $ friendlyDirective , null , $ reportOnly ) ; } elseif ( ! is_array ( $ sources ) ) { $ this -> cspAllow ( $ friendlyDirective , $ sources , $ reportOnly ) ; } } }
Add a CSP array $csp of friendly sources to corresponding
 firendly directives in either enforcement or report only mode.
Add a CSP array $csp of friendly sources to corresponding firendly directives in either enforcement or report only mode .
# special case that $sources is actually a directive name, # with an int index # we'll treat this case as a CSP flag # special case that $sources isn't an array (possibly a string # source, or null