GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Test Setup Failed
Push — 8.x-4.x ( 49d9c3...9df1ed )
by Kevin
05:00
created

df_tools_media_acquiadam_modules_installed()   B

Complexity

Conditions 8
Paths 128

Size

Total Lines 62
Code Lines 40

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 8
eloc 40
c 1
b 0
f 0
nc 128
nop 1
dl 0
loc 62
rs 7.8488

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
/**
4
 * @file
5
 * Contains df_tools_media_acquiadam.module.
6
 */
7
8
/**
9
 * Implements hook_modules_installed().
10
 */
11
function df_tools_media_acquiadam_modules_installed($modules) {
12
  $config_factory = \Drupal::configFactory();
13
14
  // Adds Acquia DAM to article images.
15
  if (in_array('df_tools_articles', $modules)) {
16
    $config_factory
17
      ->getEditable('field.field.node.article.field_image')
18
      ->set('settings.handler_settings.target_bundles.acquia_dam_asset', 'acquia_dam_asset')
19
      ->save(TRUE);
20
  }
21
22
  // Adds Acquia DAM to hero images.
23
  if (in_array('df_tools_blocks', $modules)) {
24
    $config_factory
25
      ->getEditable('field.field.block_content.hero.field_hero_background')
26
      ->set('settings.handler_settings.target_bundles.acquia_dam_asset', 'acquia_dam_asset')
27
      ->save(TRUE);
28
  }
29
30
  // Adds Acquia DAM to event images.
31
  if (in_array('df_tools_events', $modules)) {
32
    $config_factory
33
      ->getEditable('field.field.node.event.field_image')
34
      ->set('settings.handler_settings.target_bundles.acquia_dam_asset', 'acquia_dam_asset')
35
      ->save(TRUE);
36
  }
37
38
  // Adds Acquia DAM to location images.
39
  if (in_array('df_tools_locations', $modules)) {
40
    $config_factory
41
      ->getEditable('field.field.node.location.field_image')
42
      ->set('settings.handler_settings.target_bundles.acquia_dam_asset', 'acquia_dam_asset')
43
      ->save(TRUE);
44
  }
45
46
  // Adds Acquia DAM to page images.
47
  if (in_array('df_tools_page', $modules)) {
48
    $config_factory
49
      ->getEditable('field.field.node.page.field_image')
50
      ->set('settings.handler_settings.target_bundles.acquia_dam_asset', 'acquia_dam_asset')
51
      ->save(TRUE);
52
  }
53
54
  // Adds Acquia DAM to person images.
55
  if (in_array('df_tools_person', $modules)) {
56
    $config_factory
57
      ->getEditable('field.field.node.person.field_image')
58
      ->set('settings.handler_settings.target_bundles.acquia_dam_asset', 'acquia_dam_asset')
59
      ->save(TRUE);
60
  }
61
62
  // Adds Acquia DAM to product images.
63
  if (in_array('acf_product', $modules)) {
64
    $config_factory
65
      ->getEditable('field.field.node.product.field_product_image')
66
      ->set('settings.handler_settings.target_bundles.acquia_dam_asset', 'acquia_dam_asset')
67
      ->save(TRUE);
68
69
    $config_factory
70
      ->getEditable('field.field.node.product.field_product_image_more')
71
      ->set('settings.handler_settings.target_bundles.acquia_dam_asset', 'acquia_dam_asset')
72
      ->save(TRUE);
73
  }
74
}
75