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.

UserPictureFile::prepareRow()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 14
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 14
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
1
<?php
2
3
namespace Drupal\df_tools_user\Plugin\migrate\source;
4
5
use Drupal\migrate\Row;
6
use Drupal\migrate_source_csv\Plugin\migrate\source\CSV;
7
8
/**
9
 * Source for Image csv.
10
 *
11
 * @MigrateSource(
12
 *   id = "user_picture_file"
13
 * )
14
 */
15
class UserPictureFile extends CSV {
16
17
  public function prepareRow(Row $row) {
18
    if ($image = $row->getSourceProperty('Picture')) {
19
      $base_path = dirname($this->configuration['path']) . '/images/';
20
21
      // Setup our source/destination paths.
22
      $path = $base_path . $image;
23
      $destination_path = 'public://' . $image;
24
25
      // Copy the file.
26
      file_unmanaged_copy($path, $destination_path, FILE_EXISTS_REPLACE);
0 ignored issues
show
introduced by
The constant FILE_EXISTS_REPLACE has been deprecated: in Drupal 8.7.0, will be removed before Drupal 9.0.0. Use \Drupal\Core\File\FileSystemInterface::EXISTS_REPLACE. ( Ignorable by Annotation )

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

26
      file_unmanaged_copy($path, $destination_path, /** @scrutinizer ignore-deprecated */ FILE_EXISTS_REPLACE);
Loading history...
Deprecated Code introduced by
The function file_unmanaged_copy() has been deprecated: in Drupal 8.7.0, will be removed before Drupal 9.0.0. Use \Drupal\Core\File\FileSystemInterface::copy(). ( Ignorable by Annotation )

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

26
      /** @scrutinizer ignore-deprecated */ file_unmanaged_copy($path, $destination_path, FILE_EXISTS_REPLACE);

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...
27
28
      $row->setSourceProperty('filepath', $path);
29
      $row->setDestinationProperty('uri', $destination_path);
30
      $row->setDestinationProperty('status', 1);
31
    }
32
  }
33
34
}
35