view modules/contrib/views_slideshow/src/FormatAddonsName.php @ 5:c69a71b4f40f

Add slideshow module
author Chris Cannam
date Thu, 07 Dec 2017 14:46:23 +0000
parents
children
line wrap: on
line source
<?php

namespace Drupal\views_slideshow;

/**
 * Provides a class to manipulate addons names.
 */
class FormatAddonsName implements FormatAddonsNameInterface {

  /**
   * Format callback to move from underscore separated words to camelCase.
   */
  public function format($subject) {
    return preg_replace_callback('/_(.?)/', function ($matches) {
      if (isset($matches[1])) {
        return strtoupper($matches[1]);
      }
    }, $subject);
  }

}