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.

SlideshowBlock::prepareRow()   A
last analyzed

Complexity

Conditions 4
Paths 4

Size

Total Lines 12
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 12
rs 10
c 0
b 0
f 0
cc 4
nc 4
nop 1
1
<?php
2
3
namespace Drupal\df_tools_slideshow\Plugin\migrate\source;
4
5
use Drupal\migrate\Row;
6
use Drupal\migrate_source_csv\Plugin\migrate\source\CSV;
7
8
/**
9
 * Source for Slideshow block CSV.
10
 *
11
 * @MigrateSource(
12
 *   id = "slideshow_block"
13
 * )
14
 */
15
class SlideshowBlock extends CSV {
16
17
  public function prepareRow(Row $row) {
18
    if ($slides = $row->getSourceProperty('Slides')) {
19
      $uuids = explode(',', $slides);
20
      $references = [];
21
      foreach ($uuids as $uuid) {
22
        if ($entity = \Drupal::entityManager()->loadEntityByUuid('block_content', $uuid)) {
0 ignored issues
show
Deprecated Code introduced by
The function Drupal::entityManager() has been deprecated: in Drupal 8.0.0 and will be removed before Drupal 9.0.0. Use \Drupal::entityTypeManager() instead in most cases. If the needed method is not on \Drupal\Core\Entity\EntityTypeManagerInterface, see the deprecated \Drupal\Core\Entity\EntityManager to find the correct interface or service. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

22
        if ($entity = /** @scrutinizer ignore-deprecated */ \Drupal::entityManager()->loadEntityByUuid('block_content', $uuid)) {

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
23
          $references[] = [
24
            'target_id' => $entity->id()
25
          ];
26
        }
27
      }
28
      $row->setSourceProperty('Slides', $references);
29
    }
30
  }
31
}
32