The code below could be dehydrated and reduced to 

if (!$file || !$comment) {
        $response['message'] = (!$file) ? 'PAGE_NOT_FOUND' : 'COMMENT_EMPTY';
        echo json_encode($response);
        exit;
    }