Skip to content

Commit

Permalink
respects drupal/coder coding standard
Browse files Browse the repository at this point in the history
  • Loading branch information
William Blanc Dit Jolicoeur committed Jan 20, 2017
1 parent f077797 commit e186a81
Showing 1 changed file with 26 additions and 26 deletions.
52 changes: 26 additions & 26 deletions src/Drupal/Driver/Fields/Drupal8/FileHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,32 @@
*/
class FileHandler extends AbstractHandler {

/**
* {@inheritdoc}
*/
public function expand($values) {
$data = file_get_contents($values[0]);
if (FALSE === $data) {
throw new \Exception("Error reading file");
}

/* @var \Drupal\file\FileInterface $file */
$file = file_save_data(
$data,
'public://' . uniqid());

if (FALSE === $file) {
throw new \Exception("Error saving file");
}

$file->save();

$return = array(
'target_id' => $file->id(),
'display' => '1',
'description' => 'Behat test file',
);
return $return;
/**
* {@inheritdoc}
*/
public function expand($values) {
$data = file_get_contents($values[0]);
if (FALSE === $data) {
throw new \Exception("Error reading file");
}

/* @var \Drupal\file\FileInterface $file */
$file = file_save_data(
$data,
'public://' . uniqid());

if (FALSE === $file) {
throw new \Exception("Error saving file");
}

$file->save();

$return = array(
'target_id' => $file->id(),
'display' => '1',
'description' => 'Behat test file',
);
return $return;
}

}

0 comments on commit e186a81

Please sign in to comment.