diff --git a/ctools/plugins/export_ui/picture_mapping.inc b/ctools/plugins/export_ui/picture_mapping.inc
index 7beee01..50c81b2 100644
--- a/ctools/plugins/export_ui/picture_mapping.inc
+++ b/ctools/plugins/export_ui/picture_mapping.inc
@@ -1,12 +1,16 @@
 <?php
 
 /**
- * Implements HOOK_PLUGIN_ctools_export_ui().
+ * @file
+ * CTools export UI definition for Picture module mappings.
+ */
+
+/**
+ * Implements hook_ctools_plugin_export_ui().
  */
 function picture_picture_mapping_ctools_export_ui() {
-  /**
-   * Form functions.
-   */
+
+  // Form functions.
   module_load_include('inc', 'picture', 'picture.admin');
 
   return array(
diff --git a/flexslider_picture/theme/flexslider_picture.theme.inc b/flexslider_picture/theme/flexslider_picture.theme.inc
index fcbfdfe..46c23fd 100644
--- a/flexslider_picture/theme/flexslider_picture.theme.inc
+++ b/flexslider_picture/theme/flexslider_picture.theme.inc
@@ -143,5 +143,10 @@ function theme_flexslider_picture_list(&$vars) {
     return $output;
   }
   // If this isn't a picture optionset use the default theming.
-  return theme_flexslider_list($vars);
+  // Fallback: return default list as render array.
+  return render([
+    '#theme' => 'flexslider_list',
+    '#items' => $variables['items'],
+    '#settings' => $variables['settings'],
+  ]);
 }
diff --git a/includes/PictureMapping.php b/includes/PictureMapping.php
index 91f233b..3129b1c 100644
--- a/includes/PictureMapping.php
+++ b/includes/PictureMapping.php
@@ -15,7 +15,7 @@ class PictureMapping {
    *
    * @var string
    */
-  protected $machine_name;
+  protected $machineName;
 
   /**
    * The picture mapping label.
@@ -33,11 +33,15 @@ class PictureMapping {
 
   /**
    * The breakpoint group.
+   *
+   * @var string
    */
-  protected $breakpoint_group = '';
+  protected $breakpointGroup = '';
 
   /**
    * Boolean flag, used internally.
+   *
+   * @var bool
    */
   protected $isExporting = FALSE;
 
@@ -125,7 +129,7 @@ class PictureMapping {
     $clone = clone $this;
     $clone->id = NULL;
     $clone->machine_name = $this->machine_name . '_clone';
-    $clone->label = t('Clone of !label', array('!label' => check_plain($this->label)));
+    $clone->label = t('Clone of !label', ['!label' => $this->label]);
     $clone->mapping = $this->mapping;
     return $clone;
   }
@@ -135,8 +139,8 @@ class PictureMapping {
    */
   protected function loadBreakpointGroup() {
     if ($this->breakpoint_group && !is_object($this->breakpoint_group)) {
-      $breakpoint_group = breakpoints_breakpoint_group_load($this->breakpoint_group);
-      $this->breakpoint_group = $breakpoint_group;
+      $breakpointGroup = breakpoints_breakpoint_group_load($this->breakpoint_group);
+      $this->breakpoint_group = $breakpointGroup;
     }
   }
 
@@ -146,8 +150,8 @@ class PictureMapping {
   protected function loadAllMappings() {
     $loaded_mappings = $this->mapping;
     $all_mappings = array();
-    if ($breakpoint_group = $this->breakpoint_group) {
-      $breakpoints = $breakpoint_group->breakpoints;
+    if ($breakpointGroup = $this->breakpoint_group) {
+      $breakpoints = $breakpointGroup->breakpoints;
       foreach ($breakpoints as $breakpoint_id) {
         $breakpoint = breakpoints_breakpoint_load_by_fullkey($breakpoint_id);
         if ($breakpoint) {
@@ -211,7 +215,7 @@ class PictureMapping {
    * Check if there are mappings.
    *
    * @return bool
-   *    TRUE if this PictureMapping has mappings, FALSE otherwise.
+   *   TRUE if this PictureMapping has mappings, FALSE otherwise.
    */
   public function hasMappings() {
     $mapping_found = FALSE;
@@ -230,7 +234,7 @@ class PictureMapping {
    * Check if a mapping definition is empty.
    *
    * @return bool
-   *    TRUE if this mapping definition is considered empty, FALSE otherwise.
+   *   TRUE if this mapping definition is considered empty, FALSE otherwise.
    */
   public static function isEmptyMappingDefinition($mapping_definition) {
     if (!empty($mapping_definition) && isset($mapping_definition['mapping_type'])) {
@@ -255,7 +259,7 @@ class PictureMapping {
    * Get the machine name.
    *
    * @return string
-   *    The machine name.
+   *   The machine name.
    */
   public function getMachineName() {
     return $this->machine_name;
@@ -264,15 +268,15 @@ class PictureMapping {
   /**
    * Set the machine name.
    */
-  public function setMachineName($machine_name) {
-    $this->machine_name = $machine_name;
+  public function setMachineName($machineName) {
+    $this->machine_name = $machineName;
   }
 
   /**
    * Get the picture mappings.
    *
    * @return array
-   *    The mappings.
+   *   The mappings.
    */
   public function getMappings() {
     return $this->mapping;
@@ -296,7 +300,7 @@ class PictureMapping {
    * Get the label.
    *
    * @return string
-   *    The label.
+   *   The label.
    */
   public function label() {
     return $this->label;
@@ -305,9 +309,9 @@ class PictureMapping {
   /**
    * Set the breakpoint group.
    */
-  public function setBreakpointGroup($breakpoint_group) {
-    if (!$this->getBreakpointGroup() || $breakpoint_group != $this->getBreakpointGroup()->name) {
-      $this->breakpoint_group = $breakpoint_group;
+  public function setBreakpointGroup($breakpointGroup) {
+    if (!$this->getBreakpointGroup() || $breakpointGroup != $this->getBreakpointGroup()->name) {
+      $this->breakpoint_group = $breakpointGroup;
       $this->loadBreakpointGroup();
       $this->loadAllMappings();
     }
@@ -387,7 +391,7 @@ class PictureMapping {
    * Export this PictureMapping.
    *
    * @return string
-   *    The export string.
+   *   The export string.
    */
   public function export($indent = '') {
     $this->cleanMappings();
diff --git a/picture.admin.inc b/picture.admin.inc
index e20d581..e044432 100644
--- a/picture.admin.inc
+++ b/picture.admin.inc
@@ -1,4 +1,5 @@
 <?php
+
 /**
  * @file
  * Picture - map breakpoints and image styles.
diff --git a/picture.drush.inc b/picture.drush.inc
index dc51505..a5a87d7 100644
--- a/picture.drush.inc
+++ b/picture.drush.inc
@@ -6,7 +6,7 @@
  */
 
 /**
- * Implementation of hook_drush_command().
+ * Implements hook_drush_command().
  */
 function picture_drush_command() {
   $items['picture-mapping-flush'] = array(
@@ -24,6 +24,13 @@ function picture_drush_command() {
   return $items;
 }
 
+/**
+ * Flush all derived images for a given picture mapping.
+ *
+ * @param string|null $name
+ *   The machine name of the picture mapping.
+ *   If NULL, user can select from a list.
+ */
 function drush_picture_mapping_flush($name = NULL) {
   if (empty($name)) {
     $choices = drupal_map_assoc(array_keys(picture_get_mapping_options()));
diff --git a/picture.file_entity_1.inc b/picture.file_entity_1.inc
index b33d4ba..1ffdffc 100644
--- a/picture.file_entity_1.inc
+++ b/picture.file_entity_1.inc
@@ -99,11 +99,10 @@ function picture_file_formatter_picture_view($file, $display, $langcode) {
 
     };
 
-
     $element = array(
       '#theme' => 'picture_formatter',
       '#attached' => array(
-        'library' => $libraries
+        'library' => $libraries,
       ),
       '#item' => array(
         'style_name' => $fallback_image_style,
@@ -175,8 +174,8 @@ function picture_file_formatter_picture_settings($form, &$form_state, $settings)
       'visible' => array(
         ':input[name="displays[file_picture][settings][lazyload]"]' => array('checked' => TRUE),
         ':input[name="displays[file_picture][settings][fallback_image_style]"]' => array('value' => PICTURE_EMPTY_IMAGE),
-      )
-    )
+      ),
+    ),
   );
 
   $element['alt'] = array(
diff --git a/picture.install b/picture.install
index 3df4e31..3e65c72 100644
--- a/picture.install
+++ b/picture.install
@@ -1,4 +1,5 @@
 <?php
+
 /**
  * @file
  * Install/schema hooks for the picture module.
@@ -94,11 +95,11 @@ function picture_uninstall() {
     $view_modes = array_keys($entity_info['view modes']);
     $view_modes[] = 'default';
     $formatters = array(
-        'file_picture',
-        'file_field_picture',
-        'file_picture_sizes_formatter',
-        'file_field_picture_sizes_formatter'
-        );
+      'file_picture',
+      'file_field_picture',
+      'file_picture_sizes_formatter',
+      'file_field_picture_sizes_formatter',
+    );
     foreach ($file_types as $file_type) {
       foreach ($view_modes as $view_mode) {
         foreach ($formatters as $formatter) {
diff --git a/picture.module b/picture.module
index 45d098b..b1d6d41 100644
--- a/picture.module
+++ b/picture.module
@@ -153,7 +153,7 @@ function picture_library() {
             'weight' => -10,
             'group' => JS_DEFAULT,
             'scope' => variable_get('picture_js_scope', 'footer'),
-            'need_jquery' => FALSE
+            'need_jquery' => FALSE,
           ),
         ),
       );
@@ -167,7 +167,7 @@ function picture_library() {
             'weight' => -10,
             'group' => JS_DEFAULT,
             'scope' => variable_get('picture_js_scope', 'footer'),
-            'need_jquery' => FALSE
+            'need_jquery' => FALSE,
           ),
         ),
       );
@@ -180,7 +180,7 @@ function picture_library() {
             'type' => 'file',
             'weight' => -20,
             'group' => JS_LIBRARY,
-            'need_jquery' => FALSE
+            'need_jquery' => FALSE,
           ),
         ),
       );
@@ -193,7 +193,7 @@ function picture_library() {
             'type' => 'file',
             'weight' => -10,
             'group' => JS_LIBRARY,
-            'need_jquery' => FALSE
+            'need_jquery' => FALSE,
           ),
         ),
         'css' => array(
@@ -230,7 +230,7 @@ function picture_library() {
             'weight' => -10,
             'group' => JS_DEFAULT,
             'scope' => variable_get('picture_js_scope', 'footer'),
-            'need_jquery' => FALSE
+            'need_jquery' => FALSE,
           ),
         ),
       );
@@ -244,7 +244,7 @@ function picture_library() {
             'weight' => -10,
             'group' => JS_DEFAULT,
             'scope' => variable_get('picture_js_scope', 'footer'),
-            'need_jquery' => FALSE
+            'need_jquery' => FALSE,
           ),
         ),
       );
@@ -255,15 +255,15 @@ function picture_library() {
         'js' => array(
           drupal_get_path('module', 'picture') . '/lazysizes/lazysizes.js' => array(
             'type' => 'file',
-            // file has async, put before all files to prevent JS concatenation breaking
+            // File has async, put before all files
+            // to prevent JS concatenation breaking.
             'weight' => -20,
             'group' => JS_LIBRARY,
-            'need_jquery' => FALSE
+            'need_jquery' => FALSE,
           ),
         ),
       );
 
-
       $libraries['lazysizes_aspect_ratio'] = array(
         'title' => t('Aspect ratio plugin for lazysizes'),
         'version' => '1.0.1',
@@ -272,7 +272,7 @@ function picture_library() {
             'type' => 'file',
             'weight' => -10,
             'group' => JS_LIBRARY,
-            'need_jquery' => FALSE
+            'need_jquery' => FALSE,
           ),
         ),
         'css' => array(
@@ -492,7 +492,7 @@ function picture_field_formatter_settings_picture_form($field, $instance, $setti
     '#title' => t('Picture lazyload'),
     '#description' => t('Image will be rendered when it appears in viewport, helps to optimize page load speed.'),
     '#type' => 'checkbox',
-    '#default_value' => $settings['lazyload'] ? $settings['lazyload'] : FALSE ,
+    '#default_value' => $settings['lazyload'] ? $settings['lazyload'] : FALSE,
   );
 
   $element['lazyload_aspect_ratio'] = array(
@@ -506,8 +506,8 @@ function picture_field_formatter_settings_picture_form($field, $instance, $setti
       'visible' => array(
         ':input[name="fields[field_image][settings_edit_form][settings][lazyload]"]' => array('checked' => TRUE),
         ':input[name="fields[field_image][settings_edit_form][settings][fallback_image_style]"]' => array('value' => PICTURE_EMPTY_IMAGE),
-      )
-    )
+      ),
+    ),
   );
 
   $link_types = picture_link_types($instance);
@@ -690,9 +690,9 @@ function picture_field_formatter_settings_picture_sizes_formatter_form($field, $
     '#type' => 'select',
     '#default_value' => $settings['fallback_image_style'] ? $settings['fallback_image_style'] : PICTURE_EMPTY_IMAGE,
     '#options' => $image_styles + array(
-        PICTURE_EMPTY_IMAGE => t('Empty image'),
-        PICTURE_ORIGINAL_IMAGE => t('Original image'),
-      ),
+      PICTURE_EMPTY_IMAGE => t('Empty image'),
+      PICTURE_ORIGINAL_IMAGE => t('Original image'),
+    ),
     '#required' => TRUE,
   );
 
@@ -1071,7 +1071,11 @@ function picture_field_formatter_picture_view($entity_type, $entity, $field, $in
           break;
 
         case 'custom':
-          $caption = token_replace($colorbox_settings['colorbox_caption_custom'], array($entity_type => $entity, 'file' => (object) $item), array('clear' => TRUE));
+          $caption = token_replace(
+            $colorbox_settings['colorbox_caption_custom'],
+            array($entity_type => $entity, 'file' => (object) $item),
+            array('clear' => TRUE)
+          );
           break;
 
         default:
@@ -1280,7 +1284,9 @@ function theme_picture_sizes_formatter($variables) {
 
     $output = theme('image_srcset', $variables);
     if (isset($variables['lazyload_data_attributes']) && $variables['lazyload_data_attributes']) {
-      $output = str_replace(array('src="', 'srcset="'), array('data-src="', 'data-srcset="'), $output);
+      $output = str_replace(
+        array('src="', 'srcset="'), array('data-src="', 'data-srcset="'), $output
+      );
     }
     return $output;
   }
@@ -1422,7 +1428,7 @@ function theme_picture(array $variables) {
               // Get mime type.
               // $derivative_mime_type = $mime_type;
               // $image_style->transformMimeType($derivative_mime_type);
-              // $derivative_mime_types[] = $derivative_mime_type;
+              // $derivative_mime_types[] = $derivative_mime_type;.
               $srcset[$dimensions_clone['width']] = _picture_image_style_url($image_style_name, $variables['uri'], $variables['timestamp']) . ' ' . round($dimensions_clone['width']) . 'w';
               $sizes = array_merge(explode(',', $mapping_definition['sizes']), $sizes);
             }
@@ -1432,7 +1438,7 @@ function theme_picture(array $variables) {
             // Get mime type (not implemented in Drupal 7.
             // $derivative_mime_type = $mime_type;
             // $image_style->transformMimeType($derivative_mime_type);
-            // $derivative_mime_types[] = $derivative_mime_type;
+            // $derivative_mime_types[] = $derivative_mime_type;.
             $srcset[$multiplier] = _picture_image_style_url($mapping_definition['image_style'], $variables['uri'], $variables['timestamp']) . ' ' . $multiplier;
             break;
         }
@@ -1448,7 +1454,7 @@ function theme_picture(array $variables) {
           'height' => $variables['height'],
         );
         $dimensions = picture_get_image_dimensions($mapping_definition['image_style'], $dimensions);
-        // store as a string, JS plugin will do calculation
+        // Store as a string, JS plugin will do calculation.
         $aspect_ratio = $dimensions['width'] . '/' . $dimensions['height'];
       }
 
@@ -1497,13 +1503,14 @@ function theme_picture(array $variables) {
         $attributes['class'] = array();
       }
       elseif (!is_array($attributes['class'])) {
-        $attributes['class'] = (array)$attributes['class'];
+        $attributes['class'] = (array) $attributes['class'];
       }
       $attributes['class'][] = 'lazyload';
     }
 
     if (!empty($variables['lazyload_aspect_ratio'])) {
-      // img tag has to have data-aspectratio attribute even if its dummy placeholder
+      // Img tag has to have data-aspectratio
+      // attribute even if its dummy placeholder.
       $attributes['data-aspectratio'] = '';
     }
 
@@ -1523,7 +1530,9 @@ function theme_picture(array $variables) {
         '#uri' => $src,
         '#alt' => isset($attributes['alt']) ? $attributes['alt'] : '',
         '#title' => isset($attributes['title']) ? $attributes['title'] : '',
-        '#attributes' => array_diff_key($attributes, array('alt' => '', 'title' => '')),
+        '#attributes' => array_diff_key(
+          $attributes, array('alt' => '', 'title' => '')
+        ),
         '#lazyload' => !empty($variables['lazyload']),
         '#lazyload_aspect_ratio' => $aspect_ratio,
         '#width' => isset($dimensions['width']) ? $dimensions['width'] : NULL,
@@ -1538,7 +1547,9 @@ function theme_picture(array $variables) {
         '#uri' => $src,
         '#alt' => isset($attributes['alt']) ? $attributes['alt'] : '',
         '#title' => isset($attributes['title']) ? $attributes['title'] : '',
-        '#attributes' => array_diff_key($attributes, array('alt' => '', 'title' => '')),
+        '#attributes' => array_diff_key(
+          $attributes, array('alt' => '', 'title' => '')
+        ),
         '#lazyload' => !empty($variables['lazyload']),
       );
       $output[] = '<!--[if lt IE 9]>';
@@ -1559,7 +1570,9 @@ function theme_picture(array $variables) {
         '#srcset' => array($srcset),
         '#alt' => isset($attributes['alt']) ? $attributes['alt'] : '',
         '#title' => isset($attributes['title']) ? $attributes['title'] : '',
-        '#attributes' => array_diff_key($attributes, array('alt' => '', 'title' => '')),
+        '#attributes' => array_diff_key(
+          $attributes, array('alt' => '', 'title' => '')
+        ),
         '#lazyload' => !empty($variables['lazyload']),
       );
       $output[] = '<!--[if !lt IE 9]><!-->';
@@ -1610,7 +1623,7 @@ function theme_image_srcset(array $variables) {
   if (isset($variables['uri']) && !empty($variables['uri'])) {
     $attr_name = !empty($variables['lazyload']) ? 'data-src' : 'src';
 
-    // TODO: remove when https://www.drupal.org/node/1342504 is fixed.
+    // @todo remove when https://www.drupal.org/node/1342504 is fixed.
     if (strpos($variables['uri'], 'data:') === 0) {
       $attributes[$attr_name] = $variables['uri'];
       $uri = $variables['uri'];
@@ -1635,7 +1648,7 @@ function theme_image_srcset(array $variables) {
       // URI is mandatory.
       if (isset($src['uri']) && !empty($src['uri'])) {
         $key = '';
-        // TODO: remove when https://www.drupal.org/node/1342504 is fixed.
+        // @todo remove when https://www.drupal.org/node/1342504 is fixed.
         if (strpos($src['uri'], 'data:') === 0) {
           $source = $src['uri'];
         }
@@ -1808,7 +1821,7 @@ function _picture_filter_prepare_image($image) {
     $mapping_id = $attributes['data-picture-group'];
   }
   else {
-    $mapping_id = null;
+    $mapping_id = NULL;
   }
   $mappings = picture_mapping_load($mapping_id);
   // Make sure we have valid mappings.
@@ -1842,7 +1855,7 @@ function _picture_filter_prepare_image($image) {
   $image_info = image_get_info($uri);
   // Check if stage_file_proxy is active.
   if (!$image_info && module_exists('stage_file_proxy')) {
-    $local = stage_file_proxy_process_file_uri($uri);
+    // $local = stage_file_proxy_process_file_uri($uri);
     $image_info = image_get_info($uri);
   }
 
@@ -1892,10 +1905,10 @@ function _picture_filter_prepare_image($image) {
           'width' => $image_info['width'],
           'height' => $image_info['height'],
         );
-        // Let the the image style transform the dimensions. This way we avoid the
+        // Let the the image style transform the dimensions. This way we avoid
         // performance cost of actually having to generate the derivative. The
-        // image style can transform the dimensions without the derivative having
-        // to exist.
+        // image style can transform the dimensions without the derivative
+        // having to exist.
         $dimensions = picture_get_image_dimensions($image_style, $dimensions);
 
         $image_render_array['#srcset'][] = array(
@@ -1989,7 +2002,8 @@ function picture_page_build(&$page) {
         'label' => $label,
         'ckeditorDefaultMapping' => variable_get('picture_ckeditor_default_mapping', 'not_set'),
         'editorCSS' => picture_ckeditor_css(),
-      )), 'setting');
+      ),
+    ), 'setting');
 
     // Do not add inline css, unless when editing.
     if (!isset($page['content']['system_main']['#node_edit_form']) || !$page['content']['system_main']['#node_edit_form']) {
@@ -2223,7 +2237,7 @@ function picture_wysiwyg_editor_settings_alter(&$settings, $context) {
       );
     }
     else {
-      // @todo: try finding the img entry and add data- attributes if needed.
+      // @todo try finding the img entry and add data- attributes if needed.
     }
   }
 }
