From 2e92efd9fea6812913f20f7946135054fd07809e Mon Sep 17 00:00:00 2001
From: Kevin Kaland <kevin@wizonesolutions.com>
Date: Fri, 27 Nov 2015 06:08:42 +0100
Subject: [PATCH] Issue #2359213: Fix some coding standard errors.

---
 fillpdf.info                                  |   6 -
 fillpdf.install                               |   5 +
 fillpdf.module                                |  10 +-
 fillpdf.rules.inc                             | 222 ------------------
 fillpdf.rules_defaults.inc                    |  48 ----
 src/Component/Helper/FillPdfMappingHelper.php |  20 +-
 .../Helper/FillPdfMappingHelperInterface.php  |  11 +-
 src/Component/Utility/FillPdf.php             |   7 +
 src/Entity/FillPdfFileContext.php             |   2 -
 src/FillPdfAccessController.php               |   2 -
 src/FillPdfAccessHelper.php                   |   1 -
 src/FillPdfAdminFormHelperInterface.php       |  13 +-
 src/FillPdfBackendManager.php                 |   7 +-
 src/FillPdfBackendPluginInterface.php         |  10 +-
 src/FillPdfContextManagerInterface.php        |   8 +-
 src/FillPdfFileContextInterface.php           |   3 -
 src/FillPdfFormAccessControlHandler.php       |   5 -
 src/FillPdfFormFieldInterface.php             |  11 +-
 src/FillPdfFormFieldViewsData.php             |  11 +-
 src/FillPdfFormInterface.php                  |  13 +-
 src/FillPdfFormViewsData.php                  |  11 +-
 src/FillPdfLinkManipulatorInterface.php       |   7 +-
 src/Form/FillPdfAdminFormBase.php             |   7 +-
 src/Form/FillPdfFormExportForm.php            |   1 -
 src/Form/FillPdfFormFieldForm.php             |   7 +-
 src/Form/FillPdfFormForm.php                  |   1 +
 src/Form/FillPdfFormUploadTrait.php           |   6 +-
 src/Form/FillPdfOverviewForm.php              |   1 +
 src/Form/FillpdfSettingsForm.php              |  41 ++--
 .../FillPdfDownloadAction.php                 |   7 +-
 .../FillPdfRedirectAction.php                 |   3 -
 .../FillPdfBackend/LocalFillPdfBackend.php    |   1 -
 .../FillPdfBackend/PdftkFillPdfBackend.php    |   1 -
 src/Service/FillPdfContextManager.php         |   6 +-
 src/TokenResolverInterface.php                |   2 -
 xfdf.inc                                      |   4 +-
 36 files changed, 137 insertions(+), 384 deletions(-)
 delete mode 100644 fillpdf.info
 delete mode 100644 fillpdf.rules.inc
 delete mode 100644 fillpdf.rules_defaults.inc

diff --git a/fillpdf.info b/fillpdf.info
deleted file mode 100644
index e7c132c..0000000
--- a/fillpdf.info
+++ /dev/null
@@ -1,6 +0,0 @@
-name = FillPDF
-description = Allows users to populate PDF forms from submitted node data.
-package = Other
-core = 7.x
-
-dependencies[] = token
diff --git a/fillpdf.install b/fillpdf.install
index ae8508c..ffbf84e 100644
--- a/fillpdf.install
+++ b/fillpdf.install
@@ -1,4 +1,9 @@
 <?php
+/**
+ * @file
+ * Install functions for FillPDF.
+ */
+
 use Drupal\Core\Entity\ContentEntityInterface;
 use Drupal\Core\Field\BaseFieldDefinition;
 use Drupal\fillpdf\Service\FillPdfAdminFormHelper;
diff --git a/fillpdf.module b/fillpdf.module
index 56c9b21..8a17362 100644
--- a/fillpdf.module
+++ b/fillpdf.module
@@ -2,7 +2,7 @@
 
 /**
  * @file
- * Allows mappings of PDFs to site content
+ * Allows mappings of PDFs to site content.
  */
 
 /**
@@ -11,17 +11,15 @@
 function fillpdf_help($path, $arg) {
   switch ($path) {
     case 'admin/help#fillpdf':
-      $content = t('See the <a href="!documentation">documentation on drupal.org</a> for a full description of and guide to this module.', array('!documentation' => \Drupal\Core\Url::fromUri('http://drupal.org/documentation/modules/fillpdf')));
+      $content = t('See the <a href="!documentation">documentation on drupal.org</a> for a full description of and guide to this module.', ['!documentation' => \Drupal\Core\Url::fromUri('http://drupal.org/documentation/modules/fillpdf')]);
       return $content;
-      break;
     case 'admin/structure/fillpdf':
       if (\Drupal::moduleHandler()->moduleExists('help')) {
         return t('See the !link for an explanation on dowloading these forms to PDF',
-          array('!link' => \Drupal::l(t('documentation'), \Drupal\Core\Url::fromUri('http://drupal.org/documentation/modules/fillpdf'))));
+          ['!link' => \Drupal::l(t('documentation'), \Drupal\Core\Url::fromUri('http://drupal.org/documentation/modules/fillpdf'))]);
       }
       else {
-        return t('Activate the help module if you need an ' .
-          'explanation on downloading these forms to PDF.');
+        return t('Activate the help module if you need an explanation on downloading these forms to PDF.');
       }
       break;
   }
diff --git a/fillpdf.rules.inc b/fillpdf.rules.inc
deleted file mode 100644
index 60291e1..0000000
--- a/fillpdf.rules.inc
+++ /dev/null
@@ -1,222 +0,0 @@
-<?php
-/**
- * @file fillpdf.rules.inc
- *
- * Come on, you know what this is for! It's in the name!
- * (But if you don't - it's for Rules integration.)
- */
-
-/**
- * *************
- * *Rules hooks*
- * *************
- */
-
-
-/**
- * Implements hook_rules_data_info().
- * @todo: Define the fillpdf data structure.
- *   See http://drupal.org/node/905632
- */
-function fillpdf_rules_data_info() {
-  return array(
-    'fillpdf' => array(
-      'label' => t('FillPDF metadata'),
-      'group' => t('FillPDF'),
-      'property info' => _fillpdf_rules_metadata_info(),
-    ),
-  );
-}
-
-/**
- * Implements hook_rules_event_info().
- * @todo: Define the "FillPDF has filled the PDF" event
- * @todo: Define the following events:
- *   - FillPDF is about to prepare PDF-filling data (fillpdf_merge_pre_merge)
- *   - FillPDF is ready to fill the PDF (fillpdf_merge_fields_alter)
- */
-function fillpdf_rules_event_info() {
-  $defaults = array(
-    'group' => t('FillPDF'),
-    'module' => 'fillpdf',
-  );
-  return array(
-    'fillpdf_merge_pre_handle' => $defaults + array(
-      'label' => t('Filled PDF is about to be handled'),
-      'variables' => array(
-        'fillpdf' => array('type' => 'fillpdf', 'label' => 'FillPDF metadata'),
-      ),
-    )
-  );;
-}
-
-/**
- * Implements hook_rules_action_info().
- * @todo: Define the following actions:
- *   - Fill a PDF with data from content
- *   - Fill a PDF with data from Webform submissions
- *   - Send PDF to user's browser
- *   - Generate a FillPDF link (saves new variable - could be useful for e-mail
- *   templates and such)
- */
-function fillpdf_rules_action_info() {
-  $defaults = array(
-    'group' => t('FillPDF'),
-  );
-  return array(
-    'fillpdf_load' => $defaults + array(
-      'label' => t('Load a FillPDF configuration'),
-      'base' => 'fillpdf_rules_action_load_fillpdf',
-      'provides' => array(
-        'fillpdf' => array(
-          'type' => 'fillpdf',
-          'label' => t('FillPDF metadata'),
-        ),
-      ),
-      'parameter' => array(
-        'fid' => array(
-          'type' => 'integer',
-          'label' => t('FillPDF Form ID'),
-        )
-      ),
-    ),
-    'fillpdf_merge_webform' => $defaults + array(
-      'label' => t('Fill a PDF with webform data'),
-      'base' => 'fillpdf_rules_action_merge_webform',
-      'description' => t('Populates the PDF with webform data and updates the
-        Rules variable with all information necessary to handle it.'),
-      'parameter' => array(
-        'fillpdf' => array(
-          'type' => 'fillpdf',
-          'label' => t('FillPDF metadata'),
-        ),
-        'webform_nid' => array(
-          'type' => 'integer',
-          'label' => t('Webform Node ID'),
-          'optional' => TRUE,
-          'description' => t('If you leave this blank, the <em>Default Node ID</em> from the FillPDF configuration will be used.'),
-        ),
-        'webform_sids' => array(
-          'type' => 'list<integer>',
-          'label' => t('Webform Submission ID(s)'),
-          'optional' => TRUE,
-          'description' => t('If you leave this blank, the most recent submission will be used. The last ID you specify will be checked first.'),
-        ),
-      ),
-    ),
-    'fillpdf_handle_default' => $defaults + array(
-      'label' => t('Perform the default action on the PDF'),
-      'description' => t('Handle the PDF according to its FillPDF configuration.'),
-      'base' => 'fillpdf_rules_action_handle_default',
-      'parameter' => array(
-        'fillpdf' => array(
-          'type' => 'fillpdf',
-          'label' => t('FillPDF metadata'),
-        )
-      ),
-    ),
-    'fillpdf_save_to_file' => $defaults + array(
-      'label' => t('Save PDF to a file'),
-      'base' => 'fillpdf_rules_action_save_to_file',
-      'provides' => array(
-        'fillpdf_saved_file_path' => array(
-          'type' => 'text',
-          'label' => t('Path to saved PDF'),
-        ),
-      ),
-      'parameter' => array(
-        'fillpdf' => array(
-          'type' => 'fillpdf',
-          'label' => t('FillPDF metadata'),
-        )
-      ),
-    ),
-    'fillpdf_delete_saved_file' => $defaults + array(
-      'label' => t('Delete saved PDF'),
-      'base' => 'fillpdf_rules_action_delete_file',
-      'parameter' => array(
-        'filename' => array(
-          'type' => 'text',
-          'label' => t('Filename of PDF to delete'),
-        ),
-      ),
-    )
-  );
-}
-
-/**
- * Implements hook_rules_condition_info().
- * @todo: Define the following conditions:
- *   - A node is being filled
- *   - A Webform is being filled
- */
-function fillpdf_rules_condition_info() {
-
-}
-
-/**
- * *****************
- * *Rules callbacks*
- * *****************
- */
-
-// Action callbacks //
-
-function fillpdf_rules_action_load_fillpdf($fid) {
-  $fillpdf = new stdClass;
-  $fillpdf->info = fillpdf_load($fid);
-  return array(
-    'fillpdf' => $fillpdf,
-  );
-}
-
-/**
- * Populates a loaded FillPDF configuration's PDF with data.
- */
-function fillpdf_rules_action_merge_webform($fillpdf, $webform_nid = '', $webform_sids = array()) {
-  $skip_access_check = FALSE;
-  $flatten = TRUE;
-  $webforms = array();
-  foreach ($webform_sids as $sid) {
-    $webforms[] = array('nid' => $webform_nid,
-      'sid' => $sid,
-    );
-  }
-
-  if (empty($webforms) && empty($webform_nid) !== TRUE) {
-    $webforms[0]['nid'] = $webform_nid;
-  }
-
-  // @todo: Parameterize $skip_access_check and $flatten in Rules.
-  $fillpdf = fillpdf_merge_pdf($fillpdf->info->fid, NULL, $webforms, NULL, FALSE, $skip_access_check, $flatten, FALSE);
-  return array('fillpdf' => $fillpdf);
-}
-
-/**
- * Save the PDF to a file and return the file path.
- */
-function fillpdf_rules_action_save_to_file($fillpdf) {
-  $saved_file_path = fillpdf_save_to_file($fillpdf->info, $fillpdf->data, $fillpdf->token_objects, _fillpdf_process_filename($fillpdf->info->title, $fillpdf->token_objects), FALSE);
-  return array(
-    'fillpdf_saved_file_path' => $saved_file_path,
-  );
-}
-
-/**
- * Perform the default action on the PDF. This always ends in a drupal_goto() or a drupal_exit().
- */
-function fillpdf_rules_action_handle_default($fillpdf) {
-  fillpdf_merge_handle_pdf($fillpdf->info, $fillpdf->data, $fillpdf->token_objects, 'default');
-}
-
-function fillpdf_rules_action_delete_file($filename) {
-  file_unmanaged_delete($filename);
-}
-
-// Condition callbacks //
-
-// Metadata callbacks //
-function _fillpdf_rules_metadata_info() {
-  return array();
-}
-
diff --git a/fillpdf.rules_defaults.inc b/fillpdf.rules_defaults.inc
deleted file mode 100644
index 260917b..0000000
--- a/fillpdf.rules_defaults.inc
+++ /dev/null
@@ -1,48 +0,0 @@
-<?php
-/**
- * Implements hook_default_rules_configuration().
- */
-function fillpdf_default_rules_configuration() {
-  $default_rules = array();
-  // Attach the filled PDF to an e-mail.
-  if (\Drupal::moduleHandler()->moduleExists('mimemail') && \Drupal::moduleHandler()->moduleExists('webform_rules') && \Drupal::moduleHandler()->moduleExists('webform')) {
-    $default_rules['rules_webform_fillpdf_attachment'] = rules_import('{ "rules_send_webform_submission_confirmation_with_filled_pdf_as_attachment" : {
-        "LABEL" : "Send Webform submission confirmation e-mail with filled PDF as attachment",
-        "PLUGIN" : "reaction rule",
-        "ACTIVE" : false,
-        "REQUIRES" : [ "rules", "fillpdf", "mimemail", "webform_rules" ],
-        "ON" : [ "webform_rules_submit" ],
-        "IF" : [ { "data_is" : { "data" : [ "node:nid" ], "value" : "2" } } ],
-        "DO" : [
-          { "fillpdf_load" : {
-              "USING" : { "fid" : "6" },
-              "PROVIDE" : { "fillpdf" : { "fillpdf" : "FillPDF metadata" } }
-            }
-          },
-          { "fillpdf_merge_webform" : {
-              "fillpdf" : [ "fillpdf" ],
-              "webform_nid" : "2",
-              "webform_sids" : { "value" : [] }
-            }
-          },
-          { "fillpdf_save_to_file" : {
-              "USING" : { "fillpdf" : [ "fillpdf" ] },
-              "PROVIDE" : { "fillpdf_saved_file_path" : { "fillpdf_saved_file_path" : "Path to saved PDF" } }
-            }
-          },
-          { "mimemail" : {
-              "to" : [ "site:mail" ],
-              "subject" : "Copy of completed PDF for your records",
-              "body" : "Thank you for filling out the form on our website. A copy of your completed PDF is attached.",
-              "plaintext" : " Thank you for filling out the form on our website. A copy of your completed PDF is attached.",
-              "attachments" : [ "fillpdf-saved-file-path" ]
-            }
-          },
-          { "fillpdf_delete_saved_file" : { "filename" : [ "fillpdf-saved-file-path" ] } }
-        ]
-      }
-    }');
-  }
-  return $default_rules;
-}
-
diff --git a/src/Component/Helper/FillPdfMappingHelper.php b/src/Component/Helper/FillPdfMappingHelper.php
index d8ce69b..c5f24e7 100644
--- a/src/Component/Helper/FillPdfMappingHelper.php
+++ b/src/Component/Helper/FillPdfMappingHelper.php
@@ -1,18 +1,26 @@
 <?php
 /**
-  * @file
-  * Contains \Drupal\fillpdf\Component\Helper\FillPdfMappingHelper.
-  */
+ * @file
+ * Contains \Drupal\fillpdf\Component\Helper\FillPdfMappingHelper.
+ */
 
 namespace Drupal\fillpdf\Component\Helper;
 
+/**
+ * Class FillPdfMappingHelper.
+ *
+ * @package Drupal\fillpdf\Component\Helper
+ */
 class FillPdfMappingHelper {
 
   public static function parseReplacements($replacements_string) {
     if (empty($replacements_string) !== TRUE) {
-      $standardized_replacements = str_replace(array("\r\n", "\r"), "\n", $replacements_string);
+      $standardized_replacements = str_replace([
+        "\r\n",
+        "\r",
+      ], "\n", $replacements_string);
       $lines = explode("\n", $standardized_replacements);
-      $return = array();
+      $return = [];
       foreach ($lines as $replacement) {
         if (!empty($replacement)) {
           $split = explode('|', $replacement);
@@ -25,7 +33,7 @@ class FillPdfMappingHelper {
       return $return;
     }
     else {
-      return array();
+      return [];
     }
   }
 
diff --git a/src/Component/Helper/FillPdfMappingHelperInterface.php b/src/Component/Helper/FillPdfMappingHelperInterface.php
index be420b1..e31fe0f 100644
--- a/src/Component/Helper/FillPdfMappingHelperInterface.php
+++ b/src/Component/Helper/FillPdfMappingHelperInterface.php
@@ -1,11 +1,16 @@
 <?php
 /**
-  * @file
-  * Contains \Drupal\fillpdf\Component\Helper\FillPdfMappingHelperInterface.
-  */
+ * @file
+ * Contains \Drupal\fillpdf\Component\Helper\FillPdfMappingHelperInterface.
+ */
 
 namespace Drupal\fillpdf\Component\Helper;
 
+/**
+ * Interface FillPdfMappingHelperInterface.
+ *
+ * @package Drupal\fillpdf\Component\Helper
+ */
 interface FillPdfMappingHelperInterface {
 
 }
diff --git a/src/Component/Utility/FillPdf.php b/src/Component/Utility/FillPdf.php
index 30b26b0..17cda6b 100644
--- a/src/Component/Utility/FillPdf.php
+++ b/src/Component/Utility/FillPdf.php
@@ -3,10 +3,17 @@
  * @file
  * Contains \Drupal\fillpdf\Component\Utility\FillPdf.
  */
+
 namespace Drupal\fillpdf\Component\Utility;
+
 use Drupal\views\Views;
 use \Symfony\Component\Process\Process;
 
+/**
+ * Class FillPdf.
+ *
+ * @package Drupal\fillpdf\Component\Utility
+ */
 class FillPdf {
 
   public static function checkPdftkPath($pdftk_path = '') {
diff --git a/src/Entity/FillPdfFileContext.php b/src/Entity/FillPdfFileContext.php
index 31427e2..4e5b0db 100644
--- a/src/Entity/FillPdfFileContext.php
+++ b/src/Entity/FillPdfFileContext.php
@@ -12,10 +12,8 @@ use Drupal\Core\Entity\Annotation\ContentEntityType;
 use Drupal\Core\Entity\EntityStorageInterface;
 use Drupal\Core\Field\BaseFieldDefinition;
 use Drupal\Core\Entity\ContentEntityBase;
-use Drupal\Core\Entity\EntityChangedTrait;
 use Drupal\Core\Entity\EntityTypeInterface;
 use Drupal\fillpdf\FillPdfFileContextInterface;
-use Drupal\user\UserInterface;
 
 /**
  * Defines the FillPDF file context entity.
diff --git a/src/FillPdfAccessController.php b/src/FillPdfAccessController.php
index 8bbe903..5f2b493 100644
--- a/src/FillPdfAccessController.php
+++ b/src/FillPdfAccessController.php
@@ -6,9 +6,7 @@
 
 namespace Drupal\fillpdf;
 
-use Drupal\Core\Access\AccessResult;
 use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
-use Drupal\Core\Entity\EntityInterface;
 use Symfony\Component\DependencyInjection\ContainerInterface;
 use Symfony\Component\HttpFoundation\RequestStack;
 use Drupal\Core\Session\AccountInterface;
diff --git a/src/FillPdfAccessHelper.php b/src/FillPdfAccessHelper.php
index d9d22a5..679032d 100644
--- a/src/FillPdfAccessHelper.php
+++ b/src/FillPdfAccessHelper.php
@@ -8,7 +8,6 @@
 namespace Drupal\fillpdf;
 
 use Drupal\Core\Access\AccessResult;
-use Drupal\Core\Access\AccessResultInterface;
 use Drupal\Core\Entity\EntityInterface;
 use Drupal\Core\Session\AccountInterface;
 use Drupal\Core\Url;
diff --git a/src/FillPdfAdminFormHelperInterface.php b/src/FillPdfAdminFormHelperInterface.php
index 41d241e..64718a1 100644
--- a/src/FillPdfAdminFormHelperInterface.php
+++ b/src/FillPdfAdminFormHelperInterface.php
@@ -1,15 +1,20 @@
 <?php
 /**
-  * @file
-  * Contains \Drupal\fillpdf\FillPdfAdminFormHelperInterface.
-  */
+ * @file
+ * Contains \Drupal\fillpdf\FillPdfAdminFormHelperInterface.
+ */
 
 namespace Drupal\fillpdf;
 
+/**
+ * Interface FillPdfAdminFormHelperInterface
+ * @package Drupal\fillpdf
+ */
 interface FillPdfAdminFormHelperInterface {
 
   /**
-   * Returns the render array to show a token form with types supported by FillPDF.
+   * Returns the render array to show a token form with types supported by
+   * FillPDF.
    *
    * @return array
    */
diff --git a/src/FillPdfBackendManager.php b/src/FillPdfBackendManager.php
index 8636c7f..9b46299 100644
--- a/src/FillPdfBackendManager.php
+++ b/src/FillPdfBackendManager.php
@@ -1,9 +1,8 @@
 <?php
 /**
-  * @file
-  * Contains \Drupal\fillpdf\FillPdfBackendManager.
-  */
-
+ * @file
+ * Contains \Drupal\fillpdf\FillPdfBackendManager.
+ */
 
 namespace Drupal\fillpdf;
 
diff --git a/src/FillPdfBackendPluginInterface.php b/src/FillPdfBackendPluginInterface.php
index 4329b39..2539bc8 100644
--- a/src/FillPdfBackendPluginInterface.php
+++ b/src/FillPdfBackendPluginInterface.php
@@ -1,8 +1,8 @@
 <?php
 /**
-  * @file
-  * Contains \Drupal\fillpdf\FillPdfBackendPluginInterface.
-  */
+ * @file
+ * Contains \Drupal\fillpdf\FillPdfBackendPluginInterface.
+ */
 
 namespace Drupal\fillpdf;
 
@@ -35,7 +35,7 @@ interface FillPdfBackendPluginInterface {
    * @param array $field_mapping An array of fields mapping PDF field keys to the
    *   values with which they should be replaced. Example array:
    *
-   *   @code
+   * @code
    *   array(
    *     'values' => array(
    *       'Field 1' => 'value',
@@ -48,7 +48,7 @@ interface FillPdfBackendPluginInterface {
    *       ),
    *     ),
    *   )
-   *   @endcode
+   * @endcode
    * @param array $context @todo: Define
    * @return string The raw file contents of the new PDF; the caller has to
    *   handle saving or serving the file accordingly.
diff --git a/src/FillPdfContextManagerInterface.php b/src/FillPdfContextManagerInterface.php
index 578c380..e2c432f 100644
--- a/src/FillPdfContextManagerInterface.php
+++ b/src/FillPdfContextManagerInterface.php
@@ -1,12 +1,14 @@
 <?php
 /**
-  * @file
-  * Contains \Drupal\fillpdf\FillPdfContextManagerInterface\FillPdfContextManagerInterface.
-  */
+ * @file
+ * Contains \Drupal\fillpdf\FillPdfContextManagerInterface\FillPdfContextManagerInterface.
+ */
 
 namespace Drupal\fillpdf;
 
 /**
+ * Load entities from a FillPDF $context.
+ *
  * Provides a common interface for loading and serialization of the $context
  * array returned by FillPdfLinkManipulator::parseRequest().
  *
diff --git a/src/FillPdfFileContextInterface.php b/src/FillPdfFileContextInterface.php
index 3de5d34..847c1de 100644
--- a/src/FillPdfFileContextInterface.php
+++ b/src/FillPdfFileContextInterface.php
@@ -8,9 +8,6 @@
 namespace Drupal\fillpdf;
 
 use Drupal\Core\Entity\ContentEntityInterface;
-use Drupal\Core\Entity\EntityChangedInterface;
-use Drupal\Core\Entity\EntityTypeInterface;
-use Drupal\user\EntityOwnerInterface;
 
 /**
  * Provides an interface for defining FillPDF file context entities.
diff --git a/src/FillPdfFormAccessControlHandler.php b/src/FillPdfFormAccessControlHandler.php
index d9c6710..3bc0c31 100644
--- a/src/FillPdfFormAccessControlHandler.php
+++ b/src/FillPdfFormAccessControlHandler.php
@@ -8,12 +8,9 @@
 namespace Drupal\fillpdf;
 
 use Drupal\Core\Entity\EntityAccessControlHandler;
-use Drupal\Core\Entity\EntityHandlerInterface;
 use Drupal\Core\Entity\EntityInterface;
-use Drupal\Core\Entity\EntityTypeInterface;
 use Drupal\Core\Session\AccountInterface;
 use Drupal\Core\Access\AccessResult;
-use Symfony\Component\DependencyInjection\ContainerInterface;
 
 /**
  * Access controller for the FillPDF form entity.
@@ -31,10 +28,8 @@ class FillPdfFormAccessControlHandler extends EntityAccessControlHandler {
       case 'update':
       case 'delete':
         return AccessResult::allowedIfHasPermission($account, 'administer pdfs');
-        break;
       default:
         return AccessResult::neutral();
-        break;
     }
   }
 
diff --git a/src/FillPdfFormFieldInterface.php b/src/FillPdfFormFieldInterface.php
index d766fe0..483c339 100644
--- a/src/FillPdfFormFieldInterface.php
+++ b/src/FillPdfFormFieldInterface.php
@@ -1,13 +1,18 @@
 <?php
 /**
-  * @file
-  * Contains \Drupal\fillpdf\FillPdfFormFieldInterface.
-  */
+ * @file
+ * Contains \Drupal\fillpdf\FillPdfFormFieldInterface.
+ */
 
 namespace Drupal\fillpdf;
 
 use Drupal\Core\Entity\ContentEntityInterface;
 
+/**
+ * Interface FillPdfFormFieldInterface.
+ *
+ * @package Drupal\fillpdf
+ */
 interface FillPdfFormFieldInterface extends ContentEntityInterface {
 
 }
diff --git a/src/FillPdfFormFieldViewsData.php b/src/FillPdfFormFieldViewsData.php
index 352b0e8..8634e44 100644
--- a/src/FillPdfFormFieldViewsData.php
+++ b/src/FillPdfFormFieldViewsData.php
@@ -1,13 +1,18 @@
 <?php
 /**
-  * @file
-  * Contains \Drupal\fillpdf\FillPdfFormFieldViewsData.
-  */
+ * @file
+ * Contains \Drupal\fillpdf\FillPdfFormFieldViewsData.
+ */
 
 namespace Drupal\fillpdf;
 
 use Drupal\views\EntityViewsData;
 
+/**
+ * Class FillPdfFormFieldViewsData.
+ *
+ * @package Drupal\fillpdf
+ */
 class FillPdfFormFieldViewsData extends EntityViewsData {
 
   /**
diff --git a/src/FillPdfFormInterface.php b/src/FillPdfFormInterface.php
index 6945112..f33f629 100644
--- a/src/FillPdfFormInterface.php
+++ b/src/FillPdfFormInterface.php
@@ -1,16 +1,17 @@
 <?php
 /**
-  * @file
-  * Contains Drupal\fillpdf\FillPdfFormInterface.
-  */
+ * @file
+ * Contains Drupal\fillpdf\FillPdfFormInterface.
+ */
 
 namespace Drupal\fillpdf;
 
 use Drupal\Core\Entity\ContentEntityInterface;
-use Drupal\user\EntityOwnerInterface;
 
+/**
+ * Interface FillPdfFormInterface.
+ * @package Drupal\fillpdf
+ */
 interface FillPdfFormInterface extends ContentEntityInterface {
 
-  // @todo: Add functions that must be implemented to interface once I know what they are.
-
 }
\ No newline at end of file
diff --git a/src/FillPdfFormViewsData.php b/src/FillPdfFormViewsData.php
index f1af79c..e9b4941 100644
--- a/src/FillPdfFormViewsData.php
+++ b/src/FillPdfFormViewsData.php
@@ -1,13 +1,18 @@
 <?php
 /**
-  * @file
-  * Contains \Drupal\fillpdf\FillPdfFormViewsData.
-  */
+ * @file
+ * Contains \Drupal\fillpdf\FillPdfFormViewsData.
+ */
 
 namespace Drupal\fillpdf;
 
 use Drupal\views\EntityViewsData;
 
+/**
+ * Class FillPdfFormViewsData.
+ *
+ * @package Drupal\fillpdf
+ */
 class FillPdfFormViewsData extends EntityViewsData {
 
   /**
diff --git a/src/FillPdfLinkManipulatorInterface.php b/src/FillPdfLinkManipulatorInterface.php
index eff975e..9dbd0e3 100644
--- a/src/FillPdfLinkManipulatorInterface.php
+++ b/src/FillPdfLinkManipulatorInterface.php
@@ -1,10 +1,11 @@
 <?php
 /**
-  * @file
-  * Contains \Drupal\fillpdf\FillPdfLinkManipulatorInterface.
-  */
+ * @file
+ * Contains \Drupal\fillpdf\FillPdfLinkManipulatorInterface.
+ */
 
 namespace Drupal\fillpdf;
+
 use Drupal\Core\Url;
 use Symfony\Component\HttpFoundation\Request;
 
diff --git a/src/Form/FillPdfAdminFormBase.php b/src/Form/FillPdfAdminFormBase.php
index 0e04bc5..9fd843b 100644
--- a/src/Form/FillPdfAdminFormBase.php
+++ b/src/Form/FillPdfAdminFormBase.php
@@ -6,9 +6,12 @@
 
 namespace Drupal\fillpdf\Form;
 use Drupal\Core\Form\FormBase;
-use Drupal\Core\Form\FormStateInterface;
-use Symfony\Component\HttpFoundation\File\UploadedFile;
 
+/**
+ * Class FillPdfAdminFormBase.
+ *
+ * @package Drupal\fillpdf\Form
+ */
 abstract class FillPdfAdminFormBase extends FormBase {
   public $REPLACEMENTS_DESCRIPTION;
 
diff --git a/src/Form/FillPdfFormExportForm.php b/src/Form/FillPdfFormExportForm.php
index 13221d6..3508154 100644
--- a/src/Form/FillPdfFormExportForm.php
+++ b/src/Form/FillPdfFormExportForm.php
@@ -12,7 +12,6 @@ use Drupal\fillpdf\EntityHelper;
 use Drupal\fillpdf\FillPdfFormInterface;
 use Drupal\fillpdf\SerializerInterface;
 use Symfony\Component\DependencyInjection\ContainerInterface;
-use Symfony\Component\Serializer\Serializer;
 
 class FillPdfFormExportForm extends EntityForm {
 
diff --git a/src/Form/FillPdfFormFieldForm.php b/src/Form/FillPdfFormFieldForm.php
index 4717fe4..434170b 100644
--- a/src/Form/FillPdfFormFieldForm.php
+++ b/src/Form/FillPdfFormFieldForm.php
@@ -1,8 +1,8 @@
 <?php
 /**
-  * @file
-  * Contains \Drupal\fillpdf\Form\FillPdfFormFieldForm.
-  */
+ * @file
+ * Contains \Drupal\fillpdf\Form\FillPdfFormFieldForm.
+ */
 
 namespace Drupal\fillpdf\Form;
 
@@ -17,6 +17,7 @@ class FillPdfFormFieldForm extends ContentEntityForm {
   protected $adminFormHelper;
 
   public function __construct(FillPdfAdminFormHelperInterface $admin_form_helper) {
+    parent::__construct($this->entityManager);
     $this->adminFormHelper = $admin_form_helper;
   }
 
diff --git a/src/Form/FillPdfFormForm.php b/src/Form/FillPdfFormForm.php
index caa7692..c518347 100644
--- a/src/Form/FillPdfFormForm.php
+++ b/src/Form/FillPdfFormForm.php
@@ -3,6 +3,7 @@
  * @file
  * Contains \Drupal\fillpdf\Form\FillPdfFormForm.
  */
+
 namespace Drupal\fillpdf\Form;
 
 use Drupal\Core\Entity\ContentEntityForm;
diff --git a/src/Form/FillPdfFormUploadTrait.php b/src/Form/FillPdfFormUploadTrait.php
index 48d459c..70d7e0e 100644
--- a/src/Form/FillPdfFormUploadTrait.php
+++ b/src/Form/FillPdfFormUploadTrait.php
@@ -1,8 +1,8 @@
 <?php
 /**
-  * @file
-  * Contains \Drupal\fillpdf\Form\FillPdfFormUploadTrait.
-  */
+ * @file
+ * Contains \Drupal\fillpdf\Form\FillPdfFormUploadTrait.
+ */
 
 namespace Drupal\fillpdf\Form;
 
diff --git a/src/Form/FillPdfOverviewForm.php b/src/Form/FillPdfOverviewForm.php
index 70e2df6..3f6ed1b 100644
--- a/src/Form/FillPdfOverviewForm.php
+++ b/src/Form/FillPdfOverviewForm.php
@@ -3,6 +3,7 @@
  * @file
  * Contains \Drupal\fillpdf\Form\FillPdfOverviewForm.
  */
+
 namespace Drupal\fillpdf\Form;
 
 use Drupal\Core\Entity\Query\QueryFactory;
diff --git a/src/Form/FillpdfSettingsForm.php b/src/Form/FillpdfSettingsForm.php
index e4dd3b0..b355920 100644
--- a/src/Form/FillpdfSettingsForm.php
+++ b/src/Form/FillpdfSettingsForm.php
@@ -4,6 +4,7 @@
  * @file
  * Contains \Drupal\fillpdf\Form\FillPdfSettingsForm.
  */
+
 namespace Drupal\fillpdf\Form;
 
 use Drupal\Core\Config\ConfigFactoryInterface;
@@ -40,22 +41,22 @@ class FillPdfSettingsForm extends ConfigFormBase {
 
     $scheme_options = FillPdfAdminFormHelper::schemeOptions();
 
-    $form['scheme'] = array(
+    $form['scheme'] = [
       '#type' => 'radios',
       '#title' => $this->t('Template download method'),
       '#default_value' => $config->get('scheme'),
       '#options' => $scheme_options,
       '#description' => $this->t('This setting is used as the download method for uploaded templates. The use of public files is more efficient, but does not provide any access control. Changing this setting will require you to migrate associated files and data yourself and is not recommended after you have uploaded a template.'),
-    );
+    ];
 
     $fillpdf_service = $config->get('backend');
 
     // Assemble service options. Warning messages will be added next as needed.
-    $options = array(
-      'pdftk' => $this->t('Use locally-installed pdftk: You will need a VPS or a dedicated server so you can install pdftk: (!see_documentation).', array('!see_documentation' => $this->l($this->t('see documentation'), Url::fromUri('http://drupal.org/documentation/modules/fillpdf')))),
-      'local' => $this->t('Use locally-installed PHP/JavaBridge: You will need a VPS or dedicated server so you can deploy PHP/JavaBridge on Apache Tomcat: (!see_documentation).', array('!see_documentation' => $this->l($this->t('see documentation'), Url::fromUri('http://drupal.org/documentation/modules/fillpdf')))),
+    $options = [
+      'pdftk' => $this->t('Use locally-installed pdftk: You will need a VPS or a dedicated server so you can install pdftk: (!see_documentation).', ['!see_documentation' => $this->l($this->t('see documentation'), Url::fromUri('http://drupal.org/documentation/modules/fillpdf'))]),
+      'local' => $this->t('Use locally-installed PHP/JavaBridge: You will need a VPS or dedicated server so you can deploy PHP/JavaBridge on Apache Tomcat: (!see_documentation).', ['!see_documentation' => $this->l($this->t('see documentation'), Url::fromUri('http://drupal.org/documentation/modules/fillpdf'))]),
       'fillpdf_service' => $this->t('Use FillPDF Service: Sign up for <a href="https://fillpdf-service.com">FillPDF Service</a>.'),
-    );
+    ];
 
     // Check for JavaBridge.
     if (!(file_exists(drupal_get_path('module', 'fillpdf') . '/lib/JavaBridge/java/Java.inc'))) {
@@ -68,44 +69,44 @@ class FillPdfSettingsForm extends ConfigFormBase {
       $options['pdftk'] .= '<div class="messages warning">' . $this->t('pdftk is not properly installed.') . '</div>';
     }
 
-    $form['backend'] = array(
+    $form['backend'] = [
       '#type' => 'radios',
       '#title' => $this->t('PDF-filling service'),
       '#description' => $this->t('This module requires the use of one of several external PDF manipulation tools. Choose the service you would like to use.'),
       '#default_value' => !empty($fillpdf_service) ? $fillpdf_service : 'fillpdf_service',
       '#options' => $options,
-    );
-    $form['fillpdf_service'] = array(
+    ];
+    $form['fillpdf_service'] = [
       '#type' => 'fieldset',
       '#title' => $this->t('Configure FillPDF Service'),
       '#collapsible' => TRUE,
       '#collapsed' => $fillpdf_service !== 'fillpdf_service',
-    );
-    $form['fillpdf_service']['fillpdf_service_api_key'] = array(
+    ];
+    $form['fillpdf_service']['fillpdf_service_api_key'] = [
       '#type' => 'textfield',
       '#title' => $this->t('API Key'),
-      '#default_value' => $config->get('fillpdf_service_api_key', ''),
+      '#default_value' => $config->get('fillpdf_service_api_key'),
       '#description' => $this->t('You need to sign up for an API key at <a href="https://fillpdf-service.com">FillPDF Service</a>'),
-    );
-    $form['fillpdf_service']['remote_protocol'] = array(
+    ];
+    $form['fillpdf_service']['remote_protocol'] = [
       '#type' => 'radios',
       '#title' => $this->t('Use HTTPS?'),
       '#description' => $this->t('It is recommended to select <em>Use HTTPS</em> for this option. Doing so will help prevent
       sensitive information in your PDFs from being intercepted in transit between your server and the remote service.'),
       '#default_value' => $config->get('remote_protocol'),
-      '#options' => array(
+      '#options' => [
         'https' => $this->t('Use HTTPS'),
         'http' => $this->t('Do not use HTTPS'),
-      ),
-    );
-    $form['pdftk_path'] = array(
+      ],
+    ];
+    $form['pdftk_path'] = [
       '#type' => 'textfield',
       '#title' => $this->t('Configure path to pdftk'),
       '#description' => $this->t("If FillPDF is not detecting your pdftk installation, you can specify the full path to the program here. Include the program name as well. For example, <em>/usr/bin/pdftk</em> is a valid value. You can almost always leave this field blank. If you should set it, you'll probably know."),
       '#default_value' => $config->get('pdftk_path'),
-    );
+    ];
 
-    $form['#attached'] = array('library' => array('fillpdf/fillpdf.admin.settings'));
+    $form['#attached'] = ['library' => ['fillpdf/fillpdf.admin.settings']];
 
     return parent::buildForm($form, $form_state);
   }
diff --git a/src/Plugin/FillPdfActionPlugin/FillPdfDownloadAction.php b/src/Plugin/FillPdfActionPlugin/FillPdfDownloadAction.php
index 9a01828..8adb6ed 100644
--- a/src/Plugin/FillPdfActionPlugin/FillPdfDownloadAction.php
+++ b/src/Plugin/FillPdfActionPlugin/FillPdfDownloadAction.php
@@ -1,15 +1,14 @@
 <?php
 /**
-  * @file
-  * Contains \Drupal\fillpdf\Plugin\FillPdfActionPlugin\FillPdfDownloadAction.
-  */
+ * @file
+ * Contains \Drupal\fillpdf\Plugin\FillPdfActionPlugin\FillPdfDownloadAction.
+ */
 
 namespace Drupal\fillpdf\Plugin\FillPdfActionPlugin;
 
 use Drupal\Core\Annotation\Translation;
 use Drupal\fillpdf\Annotation\FillPdfActionPlugin;
 use Drupal\fillpdf\Plugin\FillPdfActionPluginBase;
-use Symfony\Component\DependencyInjection\ContainerInterface;
 use Symfony\Component\HttpFoundation\Response;
 use Symfony\Component\HttpFoundation\ResponseHeaderBag;
 
diff --git a/src/Plugin/FillPdfActionPlugin/FillPdfRedirectAction.php b/src/Plugin/FillPdfActionPlugin/FillPdfRedirectAction.php
index 8db2937..0ef12bb 100644
--- a/src/Plugin/FillPdfActionPlugin/FillPdfRedirectAction.php
+++ b/src/Plugin/FillPdfActionPlugin/FillPdfRedirectAction.php
@@ -8,9 +8,6 @@ namespace Drupal\fillpdf\Plugin\FillPdfActionPlugin;
 
 use Drupal\Core\Annotation\Translation;
 use Drupal\fillpdf\Annotation\FillPdfActionPlugin;
-use Drupal\fillpdf\OutputHandler;
-use Drupal\fillpdf\Plugin\FillPdfActionPluginBase;
-use Symfony\Component\DependencyInjection\ContainerInterface;
 use Symfony\Component\HttpFoundation\RedirectResponse;
 
 /**
diff --git a/src/Plugin/FillPdfBackend/LocalFillPdfBackend.php b/src/Plugin/FillPdfBackend/LocalFillPdfBackend.php
index ae59ef0..a8c77b7 100644
--- a/src/Plugin/FillPdfBackend/LocalFillPdfBackend.php
+++ b/src/Plugin/FillPdfBackend/LocalFillPdfBackend.php
@@ -7,7 +7,6 @@
 namespace Drupal\fillpdf\Plugin\FillPdfBackend;
 
 use Drupal\Component\Annotation\Plugin;
-use Drupal\Component\Render\FormattableMarkup;
 use Drupal\Core\Annotation\Translation;
 use Drupal\Core\File\FileSystem;
 use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
diff --git a/src/Plugin/FillPdfBackend/PdftkFillPdfBackend.php b/src/Plugin/FillPdfBackend/PdftkFillPdfBackend.php
index 7f6629d..9a3f33a 100644
--- a/src/Plugin/FillPdfBackend/PdftkFillPdfBackend.php
+++ b/src/Plugin/FillPdfBackend/PdftkFillPdfBackend.php
@@ -8,7 +8,6 @@ namespace Drupal\fillpdf\Plugin\FillPdfBackend;
 
 use Drupal\Component\Annotation\Plugin;
 use Drupal\Core\Annotation\Translation;
-use Drupal\Core\Config\ConfigFactoryInterface;
 use Drupal\Core\File\FileSystem;
 use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
 use Drupal\Core\StringTranslation\StringTranslationTrait;
diff --git a/src/Service/FillPdfContextManager.php b/src/Service/FillPdfContextManager.php
index ebce955..3fa7223 100644
--- a/src/Service/FillPdfContextManager.php
+++ b/src/Service/FillPdfContextManager.php
@@ -1,8 +1,8 @@
 <?php
 /**
-  * @file
-  * Contains \Drupal\fillpdf\Service\FillPdfContextManager\FillPdfContextManager.
-  */
+ * @file
+ * Contains \Drupal\fillpdf\Service\FillPdfContextManager\FillPdfContextManager.
+ */
 
 namespace Drupal\fillpdf\Service;
 
diff --git a/src/TokenResolverInterface.php b/src/TokenResolverInterface.php
index 54f7255..fe7d8a2 100644
--- a/src/TokenResolverInterface.php
+++ b/src/TokenResolverInterface.php
@@ -5,8 +5,6 @@
  * Contains \Drupal\fillpdf\TokenResolverInterface.
  */
 
-
-
 namespace Drupal\fillpdf;
 
 /**
diff --git a/xfdf.inc b/xfdf.inc
index f253167..781f4c1 100644
--- a/xfdf.inc
+++ b/xfdf.inc
@@ -6,10 +6,8 @@
  */
 
 /**
- * create_xfdf
- *
  * Takes values passed via associative array and generates XFDF file format
- * with that data for the pdf address sullpiled.
+ * with that data for the PDF address supplied.
  *
  * @param string $file The pdf file - url or file path accepted
  * @param array $info data to use in key/value pairs no more than 2 dimensions
-- 
GitLab