protected function padTrim($input, $pad = '0', $length = 3, $mode = STR_PAD_LEFT)
    {
        // Make sure we have a string.
        if (!is_string($input)) {
            $input = (string) $input;
        }

        return substr(str_pad($input, $length, $pad, $mode), 0, $length);
    }