} else { // Author info $prefix = '/* ' . $title . ' Released by Jerry Jäppinen under the MIT license http://eiskis.net/layers ' . date('Y-m-d H:i e') . ' */ '; // Print report $output = array(); $previousName = ''; foreach ($breakpoints as $name => $value) { // Breakpoint offset $barelyValue = intval(substr($value, 0, -2)); if (suffixed($value, 'em')) { $barelyValue = $barelyValue - 0.0625 . 'em'; } else { $barelyValue = $barelyValue - 1 . 'px'; } // String replacement in template $keys = array('{{name}}', '{{barelyWidth}}', '{{width}}'); $values = array($name, $barelyValue, $value); // Raw template $temp = ''; if ($previousName) { $temp = $templateConsecutive; $keys[] = '{{previousName}}'; $values[] = $previousName; } else { $temp = $template;
/** * Remove a part from the end of a string if it exists. * * @param $subject * ... * * @param $suffix * ... * * @param $caseInsensitive * ... * * @return * The contents $subject, with $suffix removed if needed. */ function unsuffix($subject, $suffix = '', $caseInsensitive = false) { // No need to do anything if (empty($suffix) or !suffixed($subject, $suffix, $caseInsensitive)) { $result = $subject; // Cut the suffix out } else { $result = mb_substr($subject, 0, -mb_strlen($suffix)); } return $result; }