From 21585a02eba5a4974aa6ac69c282a01081f08114 Mon Sep 17 00:00:00 2001 From: Rosie Le Faive Date: Mon, 7 Nov 2022 12:14:30 -0400 Subject: [PATCH] Coding standards. --- modules/islandora_fits/islandora_fits.install | 9 +++---- modules/islandora_fits/islandora_fits.module | 2 -- modules/islandora_fits/migrations/.swp | Bin 0 -> 12288 bytes .../src/Services/XMLTransform.php | 23 ++++++++++++------ 4 files changed, 19 insertions(+), 15 deletions(-) create mode 100644 modules/islandora_fits/migrations/.swp diff --git a/modules/islandora_fits/islandora_fits.install b/modules/islandora_fits/islandora_fits.install index a9473ce7..dbd503a6 100644 --- a/modules/islandora_fits/islandora_fits.install +++ b/modules/islandora_fits/islandora_fits.install @@ -5,16 +5,15 @@ * Install/update hook implementations. */ - -use Drupal\field\Entity\FieldConfig; - /** * Implements hook_install(). */ function islandora_fits_install($is_syncing) { if (!_islandora_fits_term_exists()) { - $callable = $is_syncing ? [\Drupal::messenger(), 'addStatus'] : [\Drupal::messenger(), 'addWarning']; + $callable = $is_syncing + ? [\Drupal::messenger(), 'addStatus'] + : [\Drupal::messenger(), 'addWarning']; $callable(t('A term in the taxonomy @vid with the URI @uri does not appear to exist. The @migration_id migration can be executed to create it.', [ '@vid' => 'islandora_media_use', '@uri' => 'https://projects.iq.harvard.edu/fits', @@ -36,7 +35,7 @@ function islandora_fits_requirements($phase) : array { 'title' => t('FITS Term Exists'), 'value' => $term_exists ? t('Exists') : t('Does not exist'), 'description' => t('Whether or not a term with the URI targeted by default FITS derivative configuration exists. If derivative configurations were made to target another URI, this can probably be ignored.'), - 'severity' => $term_exists ? REQUIREMENT_OK : REQUIREMENT_WARNING + 'severity' => $term_exists ? REQUIREMENT_OK : REQUIREMENT_WARNING, ]; } diff --git a/modules/islandora_fits/islandora_fits.module b/modules/islandora_fits/islandora_fits.module index a7c9f724..f5fe0bed 100644 --- a/modules/islandora_fits/islandora_fits.module +++ b/modules/islandora_fits/islandora_fits.module @@ -6,8 +6,6 @@ */ use Drupal\Core\Routing\RouteMatchInterface; -use Drupal\media\MediaInterface; -use Drupal\file\Entity\File; use Drupal\media\Entity\Media; use Drupal\node\Entity\NodeType; diff --git a/modules/islandora_fits/migrations/.swp b/modules/islandora_fits/migrations/.swp new file mode 100644 index 0000000000000000000000000000000000000000..1e1a6f3ebda23f09609bd2d05257a88f1f688d5e GIT binary patch literal 12288 zcmeI%y$ZrG5Ww-PPELxxK-Im}I{63=j&)CMM8SSgLsuWp$I;o@R@+4=P6dnqKyu^= z&GiQvLIQWY-qN%VDT(2|*QcEsHIlZc+eif~cSWO8CAbh$S SE{TnfO&Ce2jLLO(*75`xwHnR< literal 0 HcmV?d00001 diff --git a/modules/islandora_fits/src/Services/XMLTransform.php b/modules/islandora_fits/src/Services/XMLTransform.php index 7accd281..5ba1cb86 100644 --- a/modules/islandora_fits/src/Services/XMLTransform.php +++ b/modules/islandora_fits/src/Services/XMLTransform.php @@ -4,17 +4,15 @@ namespace Drupal\islandora_fits\Services; use Drupal\Component\Utility\Xss; use Drupal\Core\DependencyInjection\ServiceProviderBase; -use Drupal\Core\Entity\EntityFieldManager; use Drupal\Core\Entity\EntityManagerInterface; use Drupal\Core\Messenger\MessengerInterface; use Drupal\Core\Render\RendererInterface; use Drupal\field\Entity\FieldStorageConfig; use Drupal\field\Entity\FieldConfig; use Drupal\media\MediaInterface; -use DrupalCodeGenerator\Command\Drupal_8\Form\Simple; /** - * Class XMLTransform. + * Transform FITS XML for display and storage. */ class XMLTransform extends ServiceProviderBase { /** @@ -52,7 +50,7 @@ class XMLTransform extends ServiceProviderBase { * @param \Drupal\Core\Messenger\MessengerInterface $messenger * The messenger. */ - public function __construct(RendererInterface $renderer, EntityFieldManager $entityManager, MessengerInterface $messenger) { + public function __construct(RendererInterface $renderer, EntityManagerInterface $entityManager, MessengerInterface $messenger) { $this->renderer = $renderer; $this->entityManager = $entityManager; $this->messenger = $messenger; @@ -109,15 +107,24 @@ class XMLTransform extends ServiceProviderBase { foreach ($vals_array as $field => $val_array) { if (!array_key_exists($field, $rows) && $field != 'Filepath') { $rows[$field] = [ - ['data' => Xss::filter($field), 'class' => 'islandora_fits_table_labels'], + [ + 'data' => Xss::filter($field), + 'class' => 'islandora_fits_table_labels', + ], ]; foreach ($val_array as $value) { if (!isset($rows[$field]['value'])) { - $rows[$field]['value'] = ['data' => Xss::filter($value), 'class' => 'islandora_fits_table_values']; + $rows[$field]['value'] = [ + 'data' => Xss::filter($value), + 'class' => 'islandora_fits_table_values', + ]; } else { $data = $rows[$field]['value']['data'] .= ' - ' . Xss::filter($value); - $rows[$field]['value'] = ['data' => $data, 'class' => 'islandora_fits_table_values']; + $rows[$field]['value'] = [ + 'data' => $data, + 'class' => 'islandora_fits_table_values', + ]; } } } @@ -163,7 +170,7 @@ class XMLTransform extends ServiceProviderBase { * * Once it has these it passes them off recursively. * - * @param \SimpleXMLElement + * @param \SimpleXMLElement $xml * The SimpleXMLElement to parse. * * @return array