\Drupal calls should be avoided in classes, use dependency injection instead

Created on 2 August 2023, over 1 year ago

Problem/Motivation

Module is using direct services
file src/CacheTagsInvalidator.php

if (empty($endpoint_url)) {
      \Drupal::logger('CacheTag Notify')->log('error', 'No endpoint set');
      return;
    }

file : src/Form/CachetagNotifySettingsForm.php

try {
        $response = \Drupal::httpClient()->post($endpoint, []);
        if ($response->getStatusCode() === 200) {
          return TRUE;
        }
        return FALSE;
      }

Steps to reproduce

need to check code

Proposed resolution

use dependency injection

Remaining tasks

๐Ÿ“Œ Task
Status

Fixed

Version

2.0

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia Shiv_Sharma

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024