Mercurial > hg > isophonics-drupal-site
annotate modules/contrib/views_slideshow/src/FormatAddonsName.php @ 19:fa3358dc1485 tip
Add ndrum files
author | Chris Cannam |
---|---|
date | Wed, 28 Aug 2019 13:14:47 +0100 |
parents | c69a71b4f40f |
children |
rev | line source |
---|---|
Chris@5 | 1 <?php |
Chris@5 | 2 |
Chris@5 | 3 namespace Drupal\views_slideshow; |
Chris@5 | 4 |
Chris@5 | 5 /** |
Chris@5 | 6 * Provides a class to manipulate addons names. |
Chris@5 | 7 */ |
Chris@5 | 8 class FormatAddonsName implements FormatAddonsNameInterface { |
Chris@5 | 9 |
Chris@5 | 10 /** |
Chris@5 | 11 * Format callback to move from underscore separated words to camelCase. |
Chris@5 | 12 */ |
Chris@5 | 13 public function format($subject) { |
Chris@5 | 14 return preg_replace_callback('/_(.?)/', function ($matches) { |
Chris@5 | 15 if (isset($matches[1])) { |
Chris@5 | 16 return strtoupper($matches[1]); |
Chris@5 | 17 } |
Chris@5 | 18 }, $subject); |
Chris@5 | 19 } |
Chris@5 | 20 |
Chris@5 | 21 } |