+ private function getReportTo() {
+ $config = $this->getConfig();
+
+ $expiry = $config->get( 'ReportToExpiry' );
+
+ if ( !$expiry ) {
+ return false;
+ }
+
+ $endpoints = $config->get( 'ReportToEndpoints' );
+
+ if ( !$endpoints ) {
+ return false;
+ }
+
+ $output = [ 'max_age' => $expiry, 'endpoints' => [] ];
+
+ foreach ( $endpoints as $endpoint ) {
+ $output['endpoints'][] = [ 'url' => $endpoint ];
+ }
+
+ return json_encode( $output, JSON_UNESCAPED_SLASHES );
+ }
+
+ private function getFeaturePolicyReportOnly() {
+ $config = $this->getConfig();
+
+ $features = $config->get( 'FeaturePolicyReportOnly' );
+ return implode( ';', $features );
+ }
+