}
else {
$c['language'] = $id->get_value_exact();
- $this->request[self::REQUEST_ACCEPT_LANGUAGE]['data']['weight'][$weight][$c['language']] = (string) c_base_utf8::s_lowercase($c['choice'])->get_value();
+ $this->request[self::REQUEST_ACCEPT_LANGUAGE]['data']['weight'][$weight][$c['language']] = c_base_utf8::s_lowercase($c['choice'])->get_value_exact();
unset($c['choice']);
}
}
// convert the known values into integers for improved processing.
foreach ($this->request[self::REQUEST_ACCEPT_ENCODING]['data']['choices'] as $weight => &$choice) {
foreach ($choice as $key => &$c) {
- $lowercase = (string) c_base_utf8::s_lowercase($c['choice'])->get_value();
+ $lowercase = c_base_utf8::s_lowercase($c['choice'])->get_value_exact();
if ($lowercase == 'chunked') {
$c['encoding'] = self::ENCODING_CHUNKED;
$this->request[self::REQUEST_ACCEPT_ENCODING]['data']['weight'][$weight][self::ENCODING_CHUNKED] = $lowercase;
// convert the known values into integers for improved processing.
foreach ($this->request[self::REQUEST_ACCEPT_CHARSET]['data']['choices'] as $weight => &$choice) {
foreach ($choice as $key => &$c) {
- $lowercase = (string) c_base_utf8::s_lowercase($c['choice'])->get_value();
+ $lowercase = c_base_utf8::s_lowercase($c['choice'])->get_value_exact();
if ($lowercase == 'ascii') {
$c['charset'] = c_base_charset::ASCII;
$this->request[self::REQUEST_ACCEPT_CHARSET]['data']['weight'][$weight][c_base_charset::ASCII] = $lowercase;
* @see: https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS#Access-Control-Request-Method
*/
private function p_load_request_access_control_request_method() {
- $method_string = (string) c_base_utf8::s_lowercase($this->headers['access_control_request_method'])->get_value();
+ $method_string = c_base_utf8::s_lowercase($this->headers['access_control_request_method'])->get_value_exact();
$method_string = str_replace(' ', '', $method_string);
$methods = explode(',', $method_string);
$parts = mb_split(', ', $cache_control);
foreach ($parts as $part) {
- $cleaned_up = (string) c_base_utf8::s_lowercase(preg_replace('/(^\s+)|(\s+$)/us', '', $part))->get_value();
+ $cleaned_up = c_base_utf8::s_lowercase(preg_replace('/(^\s+)|(\s+$)/us', '', $part))->get_value_exact();
if ($cleaned_up == 'no-cache') {
$this->request[self::REQUEST_CACHE_CONTROL]['defined'] = TRUE;
$this->request[self::REQUEST_CACHE_CONTROL]['data']['methods'][SELF::CACHE_CONTROL_NO_CACHE] = SELF::CACHE_CONTROL_NO_CACHE;
return;
}
- $cleaned_up = (string) c_base_utf8::s_lowercase(preg_replace('/(^\s+)|(\s+$)/us', '', $pragma))->get_value();
+ $cleaned_up = c_base_utf8::s_lowercase(preg_replace('/(^\s+)|(\s+$)/us', '', $pragma))->get_value_exact();
if ($cleaned_up == 'no-cache') {
$this->request[self::REQUEST_CACHE_CONTROL]['defined'] = TRUE;
$this->request[self::REQUEST_CACHE_CONTROL]['data'][SELF::CACHE_CONTROL_NO_CACHE] = SELF::CACHE_CONTROL_NO_CACHE;
}
$content_type_parts = mb_split(';', $content_type);
- $content_type_part = (string) c_base_utf8::s_lowercase(preg_replace('/(^\s+)|(\s+$)/us', '', $content_type_parts[0]))->get_value();
+ $content_type_part = c_base_utf8::s_lowercase(preg_replace('/(^\s+)|(\s+$)/us', '', $content_type_parts[0]))->get_value_exact();
$this->request[self::REQUEST_CONTENT_TYPE]['defined'] = TRUE;
$this->request[self::REQUEST_CONTENT_TYPE]['data'] = $content_type_part;
// convert the known values into integers for improved processing.
foreach ($this->request[self::REQUEST_TE]['data']['choices'] as $weight => &$choice) {
foreach ($choice as $key => &$c) {
- $lowercase = (string) c_base_utf8::s_lowercase($c['choice'])->get_value();
+ $lowercase = c_base_utf8::s_lowercase($c['choice'])->get_value_exact();
if ($c['choice'] == 'compress') {
$c['encoding'] = self::ENCODING_COMPRESS;
}
$this->request[$key]['defined'] = TRUE;
$this->request[$key]['invalid'] = FALSE;
- $this->request[$key]['data'] = (string) c_base_utf8::s_lowercase(preg_replace('/(^\s+)|(\s+$)/us', '', $raw))->get_value();
+ $this->request[$key]['data'] = c_base_utf8::s_lowercase(preg_replace('/(^\s+)|(\s+$)/us', '', $raw))->get_value_exact();
if (!is_null($max_length)) {
- $this->request[$key]['data'] = c_base_utf8::s_substring($this->request[$key]['data'], 0, $max_length);
+ $this->request[$key]['data'] = c_base_utf8::s_substring($this->request[$key]['data'], 0, $max_length)->get_value_exact();
}
unset($raw);
}
$this->request[$key]['invalid'] = FALSE;
- $this->request[$key]['data'][$field] = (string) c_base_utf8::s_lowercase(preg_replace('/(^\s+)|(\s+$)/us', '', $raw))->get_value();
+ $this->request[$key]['data'][$field] = c_base_utf8::s_lowercase(preg_replace('/(^\s+)|(\s+$)/us', '', $raw))->get_value_exact();
if (!is_null($max_length)) {
- $this->request[$key]['data'][$field] = c_base_utf8::s_substring($this->request[$key]['data'][$field], 0, $max_length);
+ $this->request[$key]['data'][$field] = c_base_utf8::s_substring($this->request[$key]['data'][$field], 0, $max_length)->get_value_exact();
}
unset($raw);
}
return FALSE;
}
- $raw = (string) c_base_utf8::s_lowercase(preg_replace('/(^\s+)|(\s+$)/us', '', $original))->get_value();
+ $raw = c_base_utf8::s_lowercase(preg_replace('/(^\s+)|(\s+$)/us', '', $original))->get_value_exact();
// rfc5322 is the preferred/recommended format.
- $rfc5322 = (string) c_base_utf8::s_lowercase(preg_replace('/(^\s+)|(\s+$)/us', '', date(self::TIMESTAMP_RFC_5322, $timestamp)))->get_value();
+ $rfc5322 = c_base_utf8::s_lowercase(preg_replace('/(^\s+)|(\s+$)/us', '', date(self::TIMESTAMP_RFC_5322, $timestamp)))->get_value_exact();
if ($raw == $rfc5322) {
unset($raw);
unset($timestamp);
}
unset($rfc5322);
- $rfc1123 = (string) c_base_utf8::s_lowercase(preg_replace('/(^\s+)|(\s+$)/us', '', date(self::TIMESTAMP_RFC_1123, $timestamp)))->get_value();
+ $rfc1123 = c_base_utf8::s_lowercase(preg_replace('/(^\s+)|(\s+$)/us', '', date(self::TIMESTAMP_RFC_1123, $timestamp)))->get_value_exact();
if ($raw == $rfc1123) {
unset($raw);
unset($timestamp);
}
unset($rfc1123);
- $rfc850 = (string) c_base_utf8::s_lowercase(preg_replace('/(^\s+)|(\s+$)/us', '', date(self::TIMESTAMP_RFC_850, $timestamp)))->get_value();
+ $rfc850 = c_base_utf8::s_lowercase(preg_replace('/(^\s+)|(\s+$)/us', '', date(self::TIMESTAMP_RFC_850, $timestamp)))->get_value_exact();
if ($raw == $rfc850) {
unset($raw);
unset($timestamp);
private function p_process_accept_parts_sub($super, &$value, &$priority) {
$parts_sub = mb_split(self::DELIMITER_ACCEPT_SUB, $super);
- $part_sub_value = (string) c_base_utf8::s_lowercase(preg_replace('/(^\s+)|(\s+$)/us', '', $parts_sub[0]))->get_value();
+ $part_sub_value = c_base_utf8::s_lowercase(preg_replace('/(^\s+)|(\s+$)/us', '', $parts_sub[0]))->get_value_exact();
$part_sub_priority = NULL;
if (count($parts_sub) > 1) {
- $part_sub_priority = (string) c_base_utf8::s_lowercase(preg_replace('/(^\s+)|(\s+$)/us', '', $parts_sub[1]))->get_value();
+ $part_sub_priority = c_base_utf8::s_lowercase(preg_replace('/(^\s+)|(\s+$)/us', '', $parts_sub[1]))->get_value_exact();
}
if (self::p_length_string($part_sub_value) > 2) {
}
if (isset($pieces[1])) {
- $lower_piece_1 = (string) preg_replace('/(^\s+)|(\s+$)/us', '', c_base_utf8::s_lowercase($pieces[0]))->get_value();
- $lower_piece_2 = (string) preg_replace('/(^\s+)|(\s+$)/us', '', c_base_utf8::s_lowercase($pieces[1]))->get_value();
+ $lower_piece_1 = preg_replace('/(^\s+)|(\s+$)/us', '', c_base_utf8::s_lowercase($pieces[0]))->get_value_exact();
+ $lower_piece_2 = preg_replace('/(^\s+)|(\s+$)/us', '', c_base_utf8::s_lowercase($pieces[1]))->get_value_exact();
if ($lower_piece_1 == 'trident') {
$result['engine_name_machine'] = 'trident';
unset($lower_piece_2);
}
elseif (isset($pieces[0])) {
- $lower_cased = (string) c_base_utf8::s_lowercase($pieces[0])->get_value();
+ $lower_cased = c_base_utf8::s_lowercase($pieces[0])->get_value_exact();
$lower_piece_1 = preg_replace('/(^\s+)|(\s+$)/us', '', $lower_cased);
unset($lower_cased);
}
if (isset($pieces[1])) {
- $lower_cased = (string) c_base_utf8::s_lowercase($pieces[0])->get_value();
+ $lower_cased = c_base_utf8::s_lowercase($pieces[0])->get_value_exact();
$lower_piece_1 = preg_replace('/(^\s+)|(\s+$)/us', '', $lower_cased);
unset($lower_cased);
- $lower_cased = (string) c_base_utf8::s_lowercase($pieces[1])->get_value();
+ $lower_cased = c_base_utf8::s_lowercase($pieces[1])->get_value_exact();
$lower_piece_2 = preg_replace('/(^\s+)|(\s+$)/us', '', $lower_cased);
unset($lower_cased);
unset($lower_piece_2);
}
elseif (isset($pieces[0])) {
- $lower_cased = (string) c_base_utf8::s_lowercase($pieces[0])->get_value();
+ $lower_cased = c_base_utf8::s_lowercase($pieces[0])->get_value_exact();
$lower_piece_1 = preg_replace('/(^\s+)|(\s+$)/us', '', $lower_cased);
unset($lower_cased);
$pieces = mb_split('/', $agent_matches[0]);
$total_pieces = count($pieces);
if ($total_pieces == 2) {
- $lower_piece_1 = (string) preg_replace('/(^\s+)|(\s+$)/us', '', c_base_utf8::s_lowercase($pieces[0]))->get_value();
- $lower_piece_2 = (string) preg_replace('/(^\s+)|(\s+$)/us', '', c_base_utf8::s_lowercase($pieces[1]))->get_value();
+ $lower_piece_1 = preg_replace('/(^\s+)|(\s+$)/us', '', c_base_utf8::s_lowercase($pieces[0]))->get_value_exact();
+ $lower_piece_2 = preg_replace('/(^\s+)|(\s+$)/us', '', c_base_utf8::s_lowercase($pieces[1]))->get_value_exact();
if ($lower_piece_1 == 'curl') {
$result['engine_name_machine'] = 'curl';
unset($lower_piece_2);
}
elseif ($total_pieces == 1) {
- $lower_piece = (string) preg_replace('/(^\s+)|(\s+$)/us', '', c_base_utf8::s_lowercase($pieces[0]))->get_value();
+ $lower_piece = preg_replace('/(^\s+)|(\s+$)/us', '', c_base_utf8::s_lowercase($pieces[0]))->get_value_exact();
if ($lower_piece == 'links') {
$result['engine_name_machine'] = 'links';
'invalid' => FALSE,
);
- $fixed_checksum = (string) c_base_utf8::s_lowercase(preg_replace('/(^\s+)|(\s+$)/us', '', $checksum))->get_value();
+ $fixed_checksum = c_base_utf8::s_lowercase(preg_replace('/(^\s+)|(\s+$)/us', '', $checksum))->get_value_exact();
if (empty($fixed_checksum)) {
$result['invalid'] = TRUE;
unset($fixed_checksum);
'invalid' => FALSE,
);
- $fixed_checksum = (string) c_base_utf8::s_lowercase(preg_replace("/(^( |\t)+)|(( |\t)+$)/us", '', $checksum_headers))->get_value();
+ $fixed_checksum = c_base_utf8::s_lowercase(preg_replace("/(^( |\t)+)|(( |\t)+$)/us", '', $checksum_headers))->get_value_exact();
if (empty($fixed_checksum)) {
$result['invalid'] = TRUE;
unset($fixed_checksum);
* 0 is returned on any error.
*/
private function p_length_string($string) {
- $length = c_base_utf8::s_length_string($string);
- if ($length instanceof c_base_return_false) {
- unset($length);
- return 0;
- }
-
- return $length->get_value_exact();
+ return c_base_utf8::s_length_string($string)->get_value_exact();
}
/**
foreach ($all_headers as $key => $value) {
// break the header name so that it is consistent until such time that PHP stops clobbering the header names.
$broken = preg_replace('/-/u', '_', $key);
- $broken = (string) c_base_utf8::s_lowercase($broken)->get_value();
+ $broken = c_base_utf8::s_lowercase($broken)->get_value_exact();
$this->headers[$broken] = $value;
unset($broken);
}
// non-apache, or calling php from command line.
if (isset($_SERVER) && is_array($_SERVER) && !empty($_SERVER)) {
foreach ($_SERVER as $key => $value) {
- $part = (string) c_base_utf8::s_lowercase(c_base_utf8::s_substring($key, 0, 5))->get_value();
+ $part = c_base_utf8::s_lowercase(c_base_utf8::s_substring($key, 0, 5))->get_value_exact();
if ($part != 'http_') {
continue;
}
- $part = (string) c_base_utf8::s_lowercase(c_base_utf8::s_substring($key, 5))->get_value();
+ $part = c_base_utf8::s_lowercase(c_base_utf8::s_substring($key, 5))->get_value_exact();
$this->headers[$part] = $value;
}
unset($part);
*/
private function p_prepare_token($token_name, $lower_case = TRUE) {
if ($lower_case) {
- $lower_cased = (string) c_base_utf8::s_lowercase($token_name)->get_value();
+ $lower_cased = c_base_utf8::s_lowercase($token_name)->get_value_exact();
$trimmed = preg_replace('/(^\s+)|(\s+$)/us', '', $lower_cased);
unset($lower_cased);
* @param string $text
* The string for which to find the character length.
*
- * @return c_base_return_int|c_base_return_status
+ * @return c_base_return_int
* Length of the Unicode String.
- * FALSE with error bit set is returned on error.
+ * 0 with error bit set is returned on error.
*
* @see: mb_strlen()
*/
public static function s_length_string($text) {
if (!is_string($text)) {
$error = c_base_error::s_log(NULL, array('arguments' => array(':argument_name' => 'text', ':function_name' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT);
- return c_base_return_error::s_false($error);
+ return c_base_return_error::s_value(0, 'c_base_return_int', $error);
}
$length = self::p_s_length_string($text);
unset($length);
$error = c_base_error::s_log(NULL, array('arguments' => array(':operation_name' => 'self::p_s_length_string', ':function_name' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::OPERATION_FAILURE);
- return c_base_return_error::s_false($error);
+ return c_base_return_error::s_value(0, 'c_base_return_int', $error);
}
return c_base_return_int::s_new($length);
* (optional) When TRUE, the UTF_8 BOM character is removed.
* When FALSE, no action related to the BOM character is performed.
*
- * @return c_base_return_string|c_base_return_status
+ * @return c_base_return_string
* Clean UTF-8 encoded string.
- * FALSE with error bit set is returned on error.
+ * An empty string with error bit set is returned on error.
*/
public static function s_clean($text, $remove_bom = FALSE) {
if (!is_string($text)) {
$error = c_base_error::s_log(NULL, array('arguments' => array(':argument_name' => 'text', ':function_name' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT);
- return c_base_return_error::s_false($error);
+ return c_base_return_error::s_value('', 'c_base_return_string', $error);
}
if (!is_bool($remove_bom)) {
$error = c_base_error::s_log(NULL, array('arguments' => array(':argument_name' => 'remove_bom', ':function_name' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT);
- return c_base_return_error::s_false($error);
+ return c_base_return_error::s_value('', 'c_base_return_string', $error);
}
$sanitized = self::p_s_clean($text);
unset($sanitized);
$error = c_base_error::s_log(NULL, array('arguments' => array(':operation_name' => 'self::p_s_clean', ':function_name' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::OPERATION_FAILURE);
- return c_base_return_error::s_false($error);
+ return c_base_return_error::s_value('', 'c_base_return_string', $error);
}
return c_base_return_string::s_new($sanitized);
* @param int $split_length
* Max character length of each array element.
*
- * @return c_base_return_array|c_base_return_status
+ * @return c_base_return_array
* An array containing chunks of the string.
- * FALSE with error bit set is returned on error.
+ * An empty string with error bit set is returned on error.
*/
public static function s_split($text, $split_length = 1) {
if (!is_string($text)) {
$error = c_base_error::s_log(NULL, array('arguments' => array(':argument_name' => 'text', ':function_name' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT);
- return c_base_return_error::s_false($error);
+ return c_base_return_error::s_value('', 'c_base_return_string', $error);
}
if (!is_int($split_length)) {
$error = c_base_error::s_log(NULL, array('arguments' => array(':argument_name' => 'split_length', ':function_name' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT);
- return c_base_return_error::s_false($error);
+ return c_base_return_error::s_value('', 'c_base_return_string', $error);
}
$split = self::p_s_split($text, $split_length);
unset($split);
$error = c_base_error::s_log(NULL, array('arguments' => array(':operation_name' => 'self::p_s_split', ':function_name' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::OPERATION_FAILURE);
- return c_base_return_error::s_false($error);
+ return c_base_return_error::s_value('', 'c_base_return_string', $error);
}
return c_base_return_array::s_new($split);
* @param string $text
* The original Unicode string.
*
- * @return c_base_return_array|c_base_return_status
+ * @return c_base_return_array
* An array of byte lengths of each character.
- * FALSE with error bit set is returned on error.
+ * An empty array with error bit set is returned on error.
*/
public static function s_character_size_list($text) {
if (!is_string($text)) {
$error = c_base_error::s_log(NULL, array('arguments' => array(':argument_name' => 'text', ':function_name' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT);
- return c_base_return_error::s_false($error);
+ return c_base_return_error::s_value(array(), 'c_base_return_array', $error);
}
$size_list = self::p_s_character_size_list($text);
unset($size_list);
$error = c_base_error::s_log(NULL, array('arguments' => array(':operation_name' => 'self::p_s_character_size_list', ':function_name' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::OPERATION_FAILURE);
- return c_base_return_error::s_false($error);
+ return c_base_return_error::s_value(array(), 'c_base_return_array', $error);
}
return c_base_return_array::s_new($size_list);
* @param string $text
* The original Unicode string.
*
- * @return c_base_return_int|c_base_return_status
+ * @return c_base_return_int
* An integer representing the max character width found within the passed string.
- * FALSE with error bit set is returned on error.
+ * 0 with error bit set is returned on error.
*
* @see: p_s_character_size_list()
*/
public static function s_character_max_width($text) {
if (!is_string($text)) {
$error = c_base_error::s_log(NULL, array('arguments' => array(':argument_name' => 'text', ':function_name' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT);
- return c_base_return_error::s_false($error);
+ return c_base_return_error::s_value(0, 'c_base_return_int', $error);
}
$size_list = self::p_s_character_size_list($text);
unset($size_list);
$error = c_base_error::s_log(NULL, array('arguments' => array(':operation_name' => 'self::p_s_character_size_list', ':function_name' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::OPERATION_FAILURE);
- return c_base_return_error::s_false($error);
+ return c_base_return_error::s_value(0, 'c_base_return_int', $error);
}
return c_base_return_int::s_new(max($size_list));
* @param string $character
* The Unicode character to be encoded as numbered entity
*
- * @return c_base_return_string|c_base_return_status
+ * @return c_base_return_string
* HTML numbered entity.
- * FALSE with error bit set is returned on error.
+ * An empty string error bit set is returned on error.
*
* @see: p_s_encode_html_character()
*/
public static function s_encode_html_character($character) {
if (!is_string($character)) {
$error = c_base_error::s_log(NULL, array('arguments' => array(':argument_name' => 'character', ':function_name' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT);
- return c_base_return_error::s_false($error);
+ return c_base_return_error::s_value('', 'c_base_return_string', $error);
}
$encoded = self::p_s_encode_html_character($character);
unset($encoded);
$error = c_base_error::s_log(NULL, array('arguments' => array(':operation_name' => 'self::p_s_encode_html_character', ':function_name' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::OPERATION_FAILURE);
- return c_base_return_error::s_false($error);
+ return c_base_return_error::s_value('', 'c_base_return_string', $error);
}
return c_base_return_string::s_new($encoded);
* @param string $text
* The Unicode string to be encoded as numbered entities.
*
- * @return c_base_return_string|c_base_return_status
+ * @return c_base_return_string
* HTML numbered entities.
- * FALSE with error bit set is returned on error.
+ * An empty string error bit set is returned on error.
*/
public static function s_encode_html($text) {
if (!is_string($text)) {
$error = c_base_error::s_log(NULL, array('arguments' => array(':argument_name' => 'text', ':function_name' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT);
- return c_base_return_error::s_false($error);
+ return c_base_return_error::s_value('', 'c_base_return_string', $error);
}
$split = self::p_s_split($text);
unset($split);
$error = c_base_error::s_log(NULL, array('arguments' => array(':operation_name' => 'self::p_s_split', ':function_name' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::OPERATION_FAILURE);
- return c_base_return_error::s_false($error);
+ return c_base_return_error::s_value('', 'c_base_return_string', $error);
}
$new_array = array();
* (optional) The length of the substring.
* If NULL, then the length is PHP_INT_MAX.
*
+ * @return c_base_return_string
+ * A substring of the specified string.
+ * An empty string error bit set is returned on error.
+ *
* @see: mb_substr()
*/
public static function s_substring($text, $start = 0, $length = NULL) {
if (!is_string($text)) {
$error = c_base_error::s_log(NULL, array('arguments' => array(':argument_name' => 'text', ':function_name' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT);
- return c_base_return_error::s_false($error);
+ return c_base_return_error::s_value('', 'c_base_return_string', $error);
}
if (!is_int($start)) {
$error = c_base_error::s_log(NULL, array('arguments' => array(':argument_name' => 'start', ':function_name' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT);
- return c_base_return_error::s_false($error);
+ return c_base_return_error::s_value('', 'c_base_return_string', $error);
}
if (!is_null($length) && !is_int($length)) {
$error = c_base_error::s_log(NULL, array('arguments' => array(':argument_name' => 'length', ':function_name' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT);
- return c_base_return_error::s_false($error);
+ return c_base_return_error::s_value('', 'c_base_return_string', $error);
}
return c_base_return_string::s_new(self::p_s_substring($text, $start, $length));
* @param string $text
* The string to transform to lowercase from.
*
+ * @return c_base_return_string
+ * A string with its characters all in lowercase.
+ * An empty string error bit set is returned on error.
+ *
* @see: mb_strtolower()
*/
public static function s_lowercase($text) {
if (!is_string($text)) {
$error = c_base_error::s_log(NULL, array('arguments' => array(':argument_name' => 'text', ':function_name' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT);
- return c_base_return_error::s_false($error);
+ return c_base_return_error::s_value('', 'c_base_return_string', $error);
}
return c_base_return_string::s_new(self::p_s_lowercase($text));
* @param string $text
* The string to transform to lowercase from.
*
+ * @return c_base_return_string
+ * A string with its characters all in uppercase.
+ * An empty string error bit set is returned on error.
+ *
* @see: mb_strtoupper()
*/
public static function s_uppercase($text) {
if (!is_string($text)) {
$error = c_base_error::s_log(NULL, array('arguments' => array(':argument_name' => 'text', ':function_name' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT);
- return c_base_return_error::s_false($error);
+ return c_base_return_error::s_value('', 'c_base_return_string', $error);
}
return c_base_return_string::s_new(self::p_s_uppercase($text));
* @param string $text
* The input string.
*
- * @return c_base_return_string|c_base_return_status
+ * @return c_base_return_string
* The string with characters in the reverse sequence.
- * FALSE with error bit set is returned on error.
+ * An empty string error bit set is returned on error.
*/
public static function s_reverse($text) {
if (!is_string($text)) {
$error = c_base_error::s_log(NULL, array('arguments' => array(':argument_name' => 'text', ':function_name' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT);
- return c_base_return_error::s_false($error);
+ return c_base_return_error::s_value('', 'c_base_return_string', $error);
}
$split = self::p_s_split($text);
unset($split);
$error = c_base_error::s_log(NULL, array('arguments' => array(':operation_name' => 'self::p_s_split', ':function_name' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::OPERATION_FAILURE);
- return c_base_return_error::s_false($error);
+ return c_base_return_error::s_value('', 'c_base_return_string', $error);
}
return c_base_return_string::s_new(implode(array_reverse($split)));
* @param array $ordinals
* An array of ordinals.
*
- * @return c_base_return_array|c_base_return_status
+ * @return c_base_return_array
* An array of characters represnting the ordinals array.
- * FALSE with error bit set is returned on error.
+ * An empty array with error bit set is returned on error.
+ * A partially populate array with error bit set is returned on error of individual characters.
*/
public static function s_ordinals_to_string_array($ordinals) {
if (!is_array($ordinals)) {
$error = c_base_error::s_log(NULL, array('arguments' => array(':argument_name' => 'ordinals', ':function_name' => __CLASS__ . '->' . __FUNCTION__)), i_base_error_messages::INVALID_ARGUMENT);
- return c_base_return_error::s_false($error);
+ return c_base_return_error::s_value(array(), 'c_base_return_array', $error);
}
$errors = array();
}
if ($offset || $length) {
- $haystack = s_substring($haystack, $offset, $length);
+ $haystack = self::s_substring($haystack, $offset, $length)->get_value_exact();
}
if (is_null($length)) {