PHP Classes
elePHPant
Icontem

Problem in the SVGStyle class

Recommend this page to a friend!

      phpSVG  >  All threads  >  Problem in the SVGStyle class  >  (Un) Subscribe thread alerts  
Subject:Problem in the SVGStyle class
Summary:need to update the fromCamelCase and toCamelCase
Messages:1
Author:Bilal Yousaf
Date:2017-03-15 13:55:21
 

  1. Problem in the SVGStyle class   Reply   Report abuse  
Bilal Yousaf - 2017-03-15 13:55:21
Hello,
can you please update the fromCamelCase and toCamelCase in SVGStyle class because some regular expression is not supported anymore. and i am getting always the error. so i overwirte the functions locally and then it's work for me. code you can use to modify the main. so that it's available via composer.

protected static function fromCamelCase($str)
{
$str[0] = strtolower($str[0]);
$func = create_function('$c', 'return "-" . strtolower($c[1]);');
return preg_replace_callback('/([A-Z])/', $func, $str);
}


protected static function toCamelCase($str)
{
$func = create_function('$c', 'return strtoupper($c[1]);');
return preg_replace_callback('/_([a-z])/', $func, $str);
}