for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Cdf\BiCoreBundle\Utils\String;
class StringUtils
{
/**
* Translates a string with underscores into camel case (e.g. first_name -> firstName).
*
* @param array $parametri
* @return string $str translated into camel caps
*/
public static function toCamelCase($parametri = array())
$str = $parametri['str'];
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.
To visualize
$a = "a"; $ab = "ab"; $abc = "abc";
will produce issues in the first and second line, while this second example
will produce no issues.
$capitalise_first_char = isset($parametri['primamaiuscola']) ? $parametri['primamaiuscola'] : false;
if ($capitalise_first_char) {
$str[0] = strtoupper($str[0]);
}
$func = function ($matches) {
return strtoupper($matches[1]);
};
return preg_replace_callback('/_([a-z])/', $func, $str);
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.
To visualize
will produce issues in the first and second line, while this second example
will produce no issues.