diff --git a/js/plugins/imagepopup/plugin.js b/js/plugins/imagepopup/plugin.js
index 5083801..0d0cf93 100644
--- a/js/plugins/imagepopup/plugin.js
+++ b/js/plugins/imagepopup/plugin.js
@@ -16,7 +16,7 @@
 
   var insertContent;
 
-  var imagePopupSaveCallback = function(data) {
+  var imagePopupSaveCallback = function (data) {
     var content = data.image_render;
     insertContent(content);
   };
@@ -26,7 +26,7 @@
       hidpi: true,
 
       beforeInit: function (editor) {
-        editor.addCommand( 'editimagepopup', {
+        editor.addCommand('editimagepopup', {
           canUndo: true,
           exec: function (editor, data) {
             var existingValues = {
@@ -55,7 +55,7 @@
           command: 'editimagepopup'
         });
 
-        insertContent = function(html) {
+        insertContent = function (html) {
           editor.insertHtml(html);
         }
       }
diff --git a/src/Controller/ImagePopup.php b/src/Controller/ImagePopup.php
index a606a9c..b5a22da 100644
--- a/src/Controller/ImagePopup.php
+++ b/src/Controller/ImagePopup.php
@@ -5,6 +5,8 @@ namespace Drupal\image_popup\Controller;
 use Drupal\Core\Controller\ControllerBase;
 use Drupal\image\Entity\ImageStyle;
 use Drupal\Core\Url;
+use Symfony\Component\DependencyInjection\ContainerInterface;
+use Drupal\Core\Entity\EntityStorageInterface;
 
 /**
  * Class ImagePopup.
@@ -12,6 +14,33 @@ use Drupal\Core\Url;
  * @package Drupal\image_popup\Controller
  */
 class ImagePopup extends ControllerBase {
+
+  /**
+   * The file storage service.
+   *
+   * @var \Drupal\Core\Entity\EntityStorageInterface
+   */
+  protected $fileStorage;
+
+  /**
+   * Constructor.
+   *
+   * @param \Drupal\Core\Entity\EntityStorageInterface $file_storage
+   *   The file storage service.
+   */
+  public function __construct(EntityStorageInterface $file_storage) {
+    $this->fileStorage = $file_storage;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public static function create(ContainerInterface $container) {
+    return new static(
+      $container->get('entity_type.manager')->getStorage('file')
+    );
+  }
+
   /**
    * Render.
    *
@@ -19,7 +48,7 @@ class ImagePopup extends ControllerBase {
    *   Return Hello string.
    */
   public function render($fid, $image_style = NULL) {
-    $file = \Drupal::entityTypeManager()->getStorage('file')->load($fid);
+    $file = $this->fileStorage->load($fid);
 
     if (!empty($image_style)) {
       $image_style = ImageStyle::load($image_style);
@@ -33,15 +62,15 @@ class ImagePopup extends ControllerBase {
       // Get absolute path for original image.
       $absolute_path = Url::fromUri(file_create_url($image_uri))->getUri();
     }
-    $img = "<img src='".$absolute_path."'></img>";
-    //return [
-    //    '#type' => 'markup',
-    //    '#markup' => $img,
-    //];
-    return array(
+    // $img = "<img src='" . $absolute_path . "'></img>";
+    // Return [
+    // '#type' => 'markup',
+    // '#markup' => $img,
+    // ];.
+    return [
       '#theme' => 'image_popup_details',
       '#url_popup' => $absolute_path,
-    );
+    ];
   }
 
 }
diff --git a/src/Form/EditorImagePopupDialog.php b/src/Form/EditorImagePopupDialog.php
index ccbf017..1dede89 100644
--- a/src/Form/EditorImagePopupDialog.php
+++ b/src/Form/EditorImagePopupDialog.php
@@ -55,6 +55,10 @@ class EditorImagePopupDialog extends FormBase {
   /**
    * {@inheritdoc}
    *
+   * @param array $form
+   *   Form.
+   * @param \Drupal\Core\Form\FormStateInterface $form_state
+   *   Form State.
    * @param \Drupal\filter\Entity\FilterFormat $filter_format
    *   The filter format for which this dialog corresponds.
    */
@@ -97,26 +101,26 @@ class EditorImagePopupDialog extends FormBase {
     $existing_file = isset($image_element['data-entity-uuid']) ? \Drupal::entityManager()->loadEntityByUuid('file', $image_element['data-entity-uuid']) : NULL;
     $fid = $existing_file ? $existing_file->id() : NULL;
 
-    $form['fid'] = array(
+    $form['fid'] = [
       '#title' => $this->t('Image'),
       '#type' => 'managed_file',
       '#upload_location' => $image_upload['scheme'] . '://' . $image_upload['directory'],
-      '#default_value' => $fid ? array($fid) : NULL,
-      '#upload_validators' => array(
-        'file_validate_extensions' => array('gif png jpg jpeg'),
-        'file_validate_size' => array($max_filesize),
-        'file_validate_image_resolution' => array($max_dimensions),
-      ),
+      '#default_value' => $fid ? [$fid] : NULL,
+      '#upload_validators' => [
+        'file_validate_extensions' => ['gif png jpg jpeg'],
+        'file_validate_size' => [$max_filesize],
+        'file_validate_image_resolution' => [$max_dimensions],
+      ],
       '#required' => TRUE,
-    );
+    ];
 
-    $form['attributes']['src'] = array(
+    $form['attributes']['src'] = [
       '#title' => $this->t('URL'),
       '#type' => 'textfield',
       '#default_value' => isset($image_element['src']) ? $image_element['src'] : '',
       '#maxlength' => 2048,
       '#required' => TRUE,
-    );
+    ];
 
     // If the editor has image uploads enabled, show a managed_file form item,
     // otherwise show a (file URL) text form item.
@@ -140,7 +144,7 @@ class EditorImagePopupDialog extends FormBase {
     if ($alt === '' && !empty($image_element['src'])) {
       $alt = '""';
     }
-    $form['attributes']['alt'] = array(
+    $form['attributes']['alt'] = [
       '#title' => $this->t('Alternative text'),
       '#placeholder' => $this->t('Short description for the visually impaired'),
       '#type' => 'textfield',
@@ -148,71 +152,71 @@ class EditorImagePopupDialog extends FormBase {
       '#required_error' => $this->t('Alternative text is required.<br />(Only in rare cases should this be left empty. To create empty alternative text, enter <code>""</code> — two double quotes without any content).'),
       '#default_value' => $alt,
       '#maxlength' => 2048,
-    );
+    ];
 
     // When Drupal core's filter_align is being used, the text editor may
     // offer the ability to change the alignment.
-    //if (isset($image_element['data-align'])) {
+    // if (isset($image_element['data-align'])) {
     //
-    //    '#default_value' => $image_element['data-align'] == '' ? 'none' : $image_element['data-align'],
-    //    '#wrapper_attributes' => array('class' => array('container-inline')),
-    //    '#attributes' => array('class' => array('container-inline')),
-    //    '#parents' => array('attributes', 'data-align'),
-    //  );
-    //}
-
-    $form['align'] = array(
+    // '#default_value' => $image_element['data-align']
+    // == '' ? 'none' : $image_element['data-align'],
+    // '#wrapper_attributes' => array('class' => array('container-inline')),
+    // '#attributes' => array('class' => array('container-inline')),
+    // '#parents' => array('attributes', 'data-align'),
+    // );
+    // }.
+    $form['align'] = [
       '#title' => $this->t('Align'),
       '#type' => 'radios',
-      '#options' => array(
+      '#options' => [
         'none' => $this->t('None'),
         'left' => $this->t('Left'),
         'center' => $this->t('Center'),
         'right' => $this->t('Right'),
-      ),
+      ],
       '#default_value' => $image_element['data-align'] === '' ? 'none' : $image_element['data-align'],
-      '#attributes' => array('class' => array('container-inline')),
-    );
+      '#attributes' => ['class' => ['container-inline']],
+    ];
 
     // When Drupal core's filter_caption is being used, the text editor may
     // offer the ability to in-place edit the image's caption: show a toggle.
     if (isset($image_element['hasCaption']) && $filter_format->filters('filter_caption')->status) {
-      $form['caption'] = array(
+      $form['caption'] = [
         '#title' => $this->t('Caption'),
         '#type' => 'checkbox',
         '#default_value' => $image_element['hasCaption'] === 'true',
-        '#parents' => array('attributes', 'hasCaption'),
-      );
+        '#parents' => ['attributes', 'hasCaption'],
+      ];
     }
 
-    $form['actions'] = array(
+    $form['actions'] = [
       '#type' => 'actions',
-    );
-    $form['image_style'] = array(
-      '#title' => t('Image style'),
+    ];
+    $form['image_style'] = [
+      '#title' => $this->t('Image style'),
       '#type' => 'select',
-      '#empty_option' => t('None (original image)'),
+      '#empty_option' => $this->t('None (original image)'),
       '#options' => $image_styles,
       '#default_value' => isset($image_element['image_style']) ? $image_element['image_style'] : '',
-    );
-    $form['image_style_popup'] = array(
-      '#title' => t('Popup Image style'),
+    ];
+    $form['image_style_popup'] = [
+      '#title' => $this->t('Popup Image style'),
       '#type' => 'select',
-      '#empty_option' => t('None (original image)'),
+      '#empty_option' => $this->t('None (original image)'),
       '#options' => $image_styles,
       '#default_value' => isset($image_element['image_style_popup']) ? $image_element['image_style_popup'] : '',
-    );
+    ];
 
-    $form['actions']['save_modal'] = array(
+    $form['actions']['save_modal'] = [
       '#type' => 'submit',
       '#value' => $this->t('Save'),
       // No regular submit-handler. This form only works via JavaScript.
-      '#submit' => array(),
-      '#ajax' => array(
+      '#submit' => [],
+      '#ajax' => [
         'callback' => '::submitForm',
         'event' => 'click',
-      ),
-    );
+      ],
+    ];
 
     return $form;
   }
@@ -225,51 +229,48 @@ class EditorImagePopupDialog extends FormBase {
 
     // Convert any uploaded files from the FID values to data-entity-uuid
     // attributes and set data-entity-type to 'file'.
-    $fid = $form_state->getValue(array('fid', 0));
+    $fid = $form_state->getValue(['fid', 0]);
     if (!empty($fid)) {
       $file = $this->fileStorage->load($fid);
       $file_url = file_create_url($file->getFileUri());
       // Transform absolute image URLs to relative image URLs: prevent problems
       // on multisite set-ups and prevent mixed content errors.
       $file_url = file_url_transform_relative($file_url);
-      $form_state->setValue(array('attributes', 'src'), $file_url);
-      $form_state->setValue(array('attributes', 'data-entity-uuid'), $file->uuid());
-      $form_state->setValue(array('attributes', 'data-entity-type'), 'file');
+      $form_state->setValue(['attributes', 'src'], $file_url);
+      $form_state->setValue(['attributes', 'data-entity-uuid'], $file->uuid());
+      $form_state->setValue(['attributes', 'data-entity-type'], 'file');
     }
 
     // When the alt attribute is set to two double quotes, transform it to the
     // empty string: two double quotes signify "empty alt attribute". See above.
-    if (trim($form_state->getValue(array('attributes', 'alt'))) === '""') {
-      $form_state->setValue(array('attributes', 'alt'), '');
+    if (trim($form_state->getValue(['attributes', 'alt'])) === '""') {
+      $form_state->setValue(['attributes', 'alt'], '');
     }
 
-
-
     $image_style = $form_state->getValue('image_style');
     $image_style_popup = $form_state->getValue('image_style_popup');
     $config_name = "image.style." . $image_style_popup;
     $image_style_popup_settings = \Drupal::config($config_name)->getRawData();
     $popup_width = 750;
-    foreach ($image_style_popup_settings['effects'] as $key => $effect) {
+    foreach ($image_style_popup_settings['effects'] as $effect) {
       if ($effect['id'] == 'image_scale') {
         $popup_width = $effect['data']['width'];
       }
     }
-    $display_image = ImagePopup::render($fid,$image_style);
+    $display_image = ImagePopup::render($fid, $image_style);
     $absolute_path = $display_image['#url_popup'];
     global $base_url;
     $align = $form_state->getValue('align');
-    $data_img_popup = $file->uuid() . ':' . $form_state->getValue(array('attributes', 'alt')) .':' . $image_style . ':' . $image_style_popup . ':' . $align;
+    $data_img_popup = $file->uuid() . ':' . $form_state->getValue(['attributes', 'alt']) . ':' . $image_style . ':' . $image_style_popup . ':' . $align;
     $img = "<img class='display_image' data-img-popup='" . $data_img_popup . "'  src='" . $absolute_path . "'><img>";
-    $img_link = "<a href='" . $base_url . "/image_popup/render/" . $fid. "/" .  $image_style_popup. "' class='use-ajax' data-dialog-type='modal' data-dialog-options='{\"width\":". $popup_width ."}'>" . $img . "</a>";
+    $img_link = "<a href='" . $base_url . "/image_popup/render/" . $fid . "/" . $image_style_popup . "' class='use-ajax' data-dialog-type='modal' data-dialog-options='{\"width\":" . $popup_width . "}'>" . $img . "</a>";
     $align_class = '';
     if (!empty($align) && $align != 'none') {
       $align_class = 'align-' . $align;
     }
     $image_render = '<span class="' . $align_class . '">' . $img_link . '</span>';
     $form_state->setValue('image_render', $image_render);
-    $test = $form_state->getValues();
-
+    // $test = $form_state->getValues();
     if ($form_state->getErrors()) {
       unset($form['#prefix'], $form['#suffix']);
       $form['status_messages'] = [
diff --git a/src/Plugin/CKEditorPlugin/ImagePopup.php b/src/Plugin/CKEditorPlugin/ImagePopup.php
index 5c0c478..43eca36 100644
--- a/src/Plugin/CKEditorPlugin/ImagePopup.php
+++ b/src/Plugin/CKEditorPlugin/ImagePopup.php
@@ -21,7 +21,7 @@ class ImagePopup extends CKEditorPluginBase implements CKEditorPluginConfigurabl
   /**
    * Implements \Drupal\ckeditor\Plugin\CKEditorPluginInterface::isInternal().
    */
-  public function isInternal( ) {
+  public function isInternal() {
     return FALSE;
   }
 
@@ -36,31 +36,31 @@ class ImagePopup extends CKEditorPluginBase implements CKEditorPluginConfigurabl
    * {@inheritdoc}
    */
   public function getLibraries(Editor $editor) {
-    return array(
+    return [
       'core/drupal.ajax',
-    );
+    ];
   }
 
   /**
    * {@inheritdoc}
    */
   public function getConfig(Editor $editor) {
-    return array(
-      'imagePopup_dialogTitleAdd' => t('Insert Image popup'),
-      'imagePopup_dialogTitleEdit' => t('Edit Image popup'),
-    );
+    return [
+      'imagePopup_dialogTitleAdd' => $this->t('Insert Image popup'),
+      'imagePopup_dialogTitleEdit' => $this->t('Edit Image popup'),
+    ];
   }
 
   /**
    * {@inheritdoc}
    */
   public function getButtons() {
-    return array(
-      'ImagePopup' => array(
-        'label' => t('Image Popup'),
+    return [
+      'ImagePopup' => [
+        'label' => $this->t('Image Popup'),
         'image' => drupal_get_path('module', 'image_popup') . '/js/plugins/imagepopup/icons/imagepopup.png',
-      ),
-    );
+      ],
+    ];
   }
 
   /**
@@ -73,23 +73,31 @@ class ImagePopup extends CKEditorPluginBase implements CKEditorPluginConfigurabl
     $form_state->loadInclude('editor', 'admin.inc');
     $form['image_upload'] = editor_image_upload_settings_form($editor);
     $form['image_upload']['#attached']['library'][] = 'image_popup/image_popup.imagepopup.admin';
-    $form['image_upload']['#element_validate'][] = array($this, 'validateImageUploadSettings');
+    $form['image_upload']['#element_validate'][] = [$this, 'validateImageUploadSettings'];
     return $form;
   }
 
   /**
-   * #element_validate handler for the "image_upload" element in settingsForm().
+   * The #element_validate handler in settingsForm().
    *
+   * The #element_validate handler for the "image_upload" element in
+   * settingsForm().
    * Moves the text editor's image upload settings from the ImagePopup plugin's
    * own settings into $editor->image_upload.
    *
    * @see \Drupal\editor\Form\EditorImageDialog
    * @see editor_image_upload_settings_form()
    */
-  function validateImageUploadSettings(array $element, FormStateInterface $form_state) {
-    $settings = &$form_state->getValue(array('editor', 'settings', 'plugins', 'imagepopup', 'image_upload'));
+  public function validateImageUploadSettings(array $element, FormStateInterface $form_state) {
+    $settings = &$form_state->getValue(
+      ['editor',
+        'settings',
+        'plugins',
+        'imagepopup',
+        'image_upload',
+      ]);
     $form_state->get('editor')->setImageUploadSettings($settings);
-    $form_state->unsetValue(array('editor', 'settings', 'plugins', 'imagepopup'));
+    $form_state->unsetValue(['editor', 'settings', 'plugins', 'imagepopup']);
   }
 
 }
diff --git a/src/Plugin/Field/FieldFormatter/ImagePopupFieldFormatter.php b/src/Plugin/Field/FieldFormatter/ImagePopupFieldFormatter.php
index 5513ef7..6cf5d52 100644
--- a/src/Plugin/Field/FieldFormatter/ImagePopupFieldFormatter.php
+++ b/src/Plugin/Field/FieldFormatter/ImagePopupFieldFormatter.php
@@ -2,10 +2,7 @@
 
 namespace Drupal\image_popup\Plugin\Field\FieldFormatter;
 
-use Drupal\Component\Utility\Html;
-use Drupal\Core\Field\FieldItemInterface;
 use Drupal\Core\Field\FieldItemListInterface;
-use Drupal\Core\Field\FormatterBase;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\image\Entity\ImageStyle;
 use Drupal\image\Plugin\Field\FieldFormatter\ImageFormatterBase;
@@ -96,7 +93,7 @@ class ImagePopupFieldFormatter extends ImageFormatterBase implements ContainerFa
       $container->get('current_user'),
       $container->get('link_generator'),
       $container->get('entity.manager')->getStorage('image_style')
-      //$container->get('entity.manager')->getStorage('image_style_popup')
+      // $container->get('entity.manager')->getStorage('image_style_popup')
     );
   }
 
@@ -104,11 +101,11 @@ class ImagePopupFieldFormatter extends ImageFormatterBase implements ContainerFa
    * {@inheritdoc}
    */
   public static function defaultSettings() {
-    return array(
+    return [
       'image_style' => '',
       'image_style_popup' => '',
       'image_link' => '',
-    ) + parent::defaultSettings();
+    ] + parent::defaultSettings();
   }
 
   /**
@@ -117,29 +114,29 @@ class ImagePopupFieldFormatter extends ImageFormatterBase implements ContainerFa
   public function settingsForm(array $form, FormStateInterface $form_state) {
     $image_styles = image_style_options(FALSE);
     $elements = parent::settingsForm($form, $form_state);
-    $elements['image_style'] = array(
-      '#title' => t('Image style'),
+    $elements['image_style'] = [
+      '#title' => $this->t('Image style'),
       '#type' => 'select',
       '#default_value' => $this->getSetting('image_style'),
-      '#empty_option' => t('None (original image)'),
+      '#empty_option' => $this->t('None (original image)'),
       '#options' => $image_styles,
-      '#description' => array(
+      '#description' => [
         '#markup' => $this->linkGenerator->generate($this->t('Configure Image Styles'), new Url('entity.image_style.collection')),
         '#access' => $this->currentUser->hasPermission('administer image styles'),
-      ),
-    );
+      ],
+    ];
 
-    $elements['image_style_popup'] = array(
-      '#title' => t('Popup Image style'),
+    $elements['image_style_popup'] = [
+      '#title' => $this->t('Popup Image style'),
       '#type' => 'select',
       '#default_value' => $this->getSetting('image_style_popup'),
-      '#empty_option' => t('None (original image)'),
+      '#empty_option' => $this->t('None (original image)'),
       '#options' => $image_styles,
-      '#description' => array(
+      '#description' => [
         '#markup' => $this->linkGenerator->generate($this->t('Configure Image Styles'), new Url('entity.image_style.collection')),
         '#access' => $this->currentUser->hasPermission('administer image styles'),
-      ),
-    );
+      ],
+    ];
 
     return $elements;
   }
@@ -148,7 +145,7 @@ class ImagePopupFieldFormatter extends ImageFormatterBase implements ContainerFa
    * {@inheritdoc}
    */
   public function settingsSummary() {
-    $summary = array();
+    $summary = [];
 
     $image_styles = image_style_options(FALSE);
     // Unset possible 'No defined styles' option.
@@ -157,10 +154,10 @@ class ImagePopupFieldFormatter extends ImageFormatterBase implements ContainerFa
     // their styles in code.
     $image_style_setting = $this->getSetting('image_style');
     if (isset($image_styles[$image_style_setting])) {
-      $summary[] = t('Image style: @style', array('@style' => $image_styles[$image_style_setting]));
+      $summary[] = $this->t('Image style: @style', ['@style' => $image_styles[$image_style_setting]]);
     }
     else {
-      $summary[] = t('Original image');
+      $summary[] = $this->t('Original image');
     }
     return $summary;
   }
@@ -169,20 +166,20 @@ class ImagePopupFieldFormatter extends ImageFormatterBase implements ContainerFa
    * {@inheritdoc}
    */
   public function viewElements(FieldItemListInterface $items, $langcode) {
-    $elements = array();
+    $elements = [];
     $files = $this->getEntitiesToView($items, $langcode);
 
     $image_style_popup = $this->getSetting('image_style_popup');
     $image_style_name = $this->getSetting('image_style');
     $image_fid = $files[0]->get('fid')->getValue()[0]['value'];
 
-
     $image_style = ImageStyle::load($image_style_name);
     $config_name = "image.style." . $image_style_popup;
     $image_style_popup_settings = \Drupal::config($config_name)->getRawData();
-    //$image_style_popup_settings = entity_load('image_style', $image_style_popup);
+    /* $image_style_popup_settings =
+    entity_load('image_style', $image_style_popup); */
     $popup_width = 750;
-    foreach ($image_style_popup_settings['effects'] as $key => $effect) {
+    foreach ($image_style_popup_settings['effects'] as $effect) {
       if ($effect['id'] == 'image_scale') {
         $popup_width = $effect['data']['width'];
       }
@@ -200,11 +197,11 @@ class ImagePopupFieldFormatter extends ImageFormatterBase implements ContainerFa
       }
       global $base_url;
       $img = "<img src='" . $absolute_path . "'>";
-      $img_link = "<a href='" . $base_url . "/image_popup/render/" . $image_fid. "/" .  $image_style_popup. "' class='use-ajax' data-dialog-type='modal' data-dialog-options='{\"width\":". $popup_width ."}'>" . $img . "</a>";
-      $elements[$delta] = array(
+      $img_link = "<a href='" . $base_url . "/image_popup/render/" . $image_fid . "/" . $image_style_popup . "' class='use-ajax' data-dialog-type='modal' data-dialog-options='{\"width\":" . $popup_width . "}'>" . $img . "</a>";
+      $elements[$delta] = [
         '#markup' => $img_link,
         '#attached' => ['library' => ['core/drupal.dialog.ajax']],
-      );
+      ];
 
     }
 
