FieldWidgetDisplayManager   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 21
loc 21
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 6 6 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace Drupal\entity_browser;
4
5
use Drupal\Core\Cache\CacheBackendInterface;
6
use Drupal\Core\Extension\ModuleHandlerInterface;
7
use Drupal\Core\Plugin\DefaultPluginManager;
8
9
/**
10
 * Manages entity browser field widget display plugins.
11
 */
12 View Code Duplication
class FieldWidgetDisplayManager extends DefaultPluginManager {
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
13
14
  /**
15
   * Constructs a new FieldWidgetDisplayManager.
16
   *
17
   * @param \Traversable $namespaces
18
   *   An object that implements \Traversable which contains the root paths
19
   *   keyed by the corresponding namespace to look for plugin implementations.
20
   * @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend
21
   *   Cache backend instance to use.
22
   * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
23
   *   The module handler.
24
   */
25
  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) {
26
    parent::__construct('Plugin/EntityBrowser/FieldWidgetDisplay', $namespaces, $module_handler, 'Drupal\entity_browser\FieldWidgetDisplayInterface', 'Drupal\entity_browser\Annotation\EntityBrowserFieldWidgetDisplay');
27
28
    $this->alterInfo('entity_browser_field_widget_display_info');
29
    $this->setCacheBackend($cache_backend, 'entity_browser_field_widget_display_plugins');
30
  }
31
32
}
33