Mercurial > hg > isophonics-drupal-site
comparison 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 |
comparison
equal
deleted
inserted
replaced
4:8948ab6c87d2 | 5:c69a71b4f40f |
---|---|
1 <?php | |
2 | |
3 namespace Drupal\views_slideshow; | |
4 | |
5 /** | |
6 * Provides a class to manipulate addons names. | |
7 */ | |
8 class FormatAddonsName implements FormatAddonsNameInterface { | |
9 | |
10 /** | |
11 * Format callback to move from underscore separated words to camelCase. | |
12 */ | |
13 public function format($subject) { | |
14 return preg_replace_callback('/_(.?)/', function ($matches) { | |
15 if (isset($matches[1])) { | |
16 return strtoupper($matches[1]); | |
17 } | |
18 }, $subject); | |
19 } | |
20 | |
21 } |