private function getResponseForRequest(MWP_Worker_Request $request, $data) { if (strpos($request->getHeader('Accept'), 'application/json') === false) { return new MWP_Http_LegacyWorkerResponse($data); } return new MWP_Http_JsonResponse($data); }
/** * Check if request should be tracked by looking at the Do Not Track (DNT) header. * * @param MWP_Worker_Request $request * * @return bool */ protected function shouldTrack(MWP_Worker_Request $request) { return $request->getHeader('DNT') !== "1"; }