<?php

namespace WPIS;

class Tools {

    static public function ucfirst($string){
        if (!is_string($string)) {
            return false;
        }

        $string = trim($string);
        if ($string === '') {
            return '';
        }

        $firstChar = mb_substr($string, 0, 1);
        $restOfString = mb_substr($string, 1);
        $firstChar = mb_strtoupper($firstChar);

        return $firstChar . $restOfString;
    }

    static public function formatDashesToCamelCase($string, $capitalizeFirstCharacter = false) {
        $str = str_replace(' ', '', ucwords(str_replace('-', ' ', $string)));

        if (!$capitalizeFirstCharacter) {
            $str[0] = strtolower($str[0]);
        }

        return $str;
    }

}