Convert current string to PascalCase

@return \BuildR\Utils\StringObject
322975
public function toPascalCase() {
        $newValue = $this->toLower()->toTitleCase()->toString();
        $newValue = implode('', explode(' ', $newValue));

        return $this->createClone($newValue);
    }
177563
public static function toString()
    {
        $return = [];

        foreach (static::$globals as $key => $value) {
            $type = gettype($value);

            if (is_callable($value)) {
                $valueString = 'callable';
                $type = 'callable';
            } elseif (is_array($value)) {
                $valueString = implode(', ', $value);
            } else {
                $valueString = (string)$value;
            }

            $return[] = sprintf(
                '"%s": (%s) %s',
                $key,
                $type,
                $valueString
            );
        }

        return implode(PHP_EOL, $return);
    }
543020
function toString()
    {
        $modes = array();
        $levels = array(E_USER_NOTICE  => 'notice',
                        E_USER_WARNING => 'warning',
                        E_USER_ERROR   => 'error');
        if ($this->mode & PEAR_ERROR_CALLBACK) {
            if (is_array($this->callback)) {
                $callback = (is_object($this->callback[0]) ?
                    strtolower(get_class($this->callback[0])) :
                    $this->callback[0]) . '::' .
                    $this->callback[1];
            } else {
                $callback = $this->callback;
            }
            return sprintf('[%s: message="%s" code=%d mode=callback '.
                           'callback=%s prefix="%s" info="%s"]',
                           strtolower(get_class($this)), $this->message, $this->code,
                           $callback, $this->error_message_prefix,
                           $this->userinfo);
        }
        if ($this->mode & PEAR_ERROR_PRINT) {
            $modes[] = 'print';
        }
        if ($this->mode & PEAR_ERROR_TRIGGER) {
            $modes[] = 'trigger';
        }
        if ($this->mode & PEAR_ERROR_DIE) {
            $modes[] = 'die';
        }
        if ($this->mode & PEAR_ERROR_RETURN) {
            $modes[] = 'return';
        }
        return sprintf('[%s: message="%s" code=%d mode=%s level=%s '.
                       'prefix="%s" info="%s"]',
                       strtolower(get_class($this)), $this->message, $this->code,
                       implode("|", $modes), $levels[$this->level],
                       $this->error_message_prefix,
                       $this->userinfo);
    }
36143
public static function camelCase(string $name): string
    {
        // Return an empty String if input is an empty String
        if (empty($name)) {
            return "";
        }

        // Convert to PascalCase first and then convert PascalCase to camelCase
        $pascal = self::pascalCase($name);
        return sprintf("%s%s", strtolower($pascal[0]), substr($pascal, 1));
    }
1324090
public function toString()
    {
        if (!empty($this->alias)) {
            return $this->alias;
        }

        $version = '';

        if (!empty($this->nickname)) {
            $version .= $this->nickname . ' ';
        }

        if (!empty($this->value)) {
            if (preg_match("/([0-9]+)(?:\.([0-9]+))?(?:\.([0-9]+))?(?:\.([0-9]+))?(?:([ab])([0-9]+))?/", $this->value, $match)) {
                $v = [ $match[1] ];

                if (array_key_exists(2, $match) && strlen($match[2])) {
                    $v[] = $match[2];
                }

                if (array_key_exists(3, $match) && strlen($match[3])) {
                    $v[] = $match[3];
                }

                if (array_key_exists(4, $match) && strlen($match[4])) {
                    $v[] = $match[4];
                }

                if (!empty($this->details)) {
                    if ($this->details < 0) {
                        array_splice($v, $this->details, 0 - $this->details);
                    }

                    if ($this->details > 0) {
                        array_splice($v, $this->details, count($v) - $this->details);
                    }
                }

                if (isset($this->builds) && !$this->builds) {
                    $count = count($v);
                    for ($i = 0; $i < $count; $i++) {
                        if ($v[$i] > 999) {
                            array_splice($v, $i, 1);
                        }
                    }
                }

                $version .= implode($v, '.');

                if (array_key_exists(5, $match) && strlen($match[5])) {
                    $version .= $match[5] . (!empty($match[6]) ? $match[6] : '');
                }
            }
        }

        return $version;
    }
402688
public static function pascalCase(string $value): string
    {
        $value = ucwords(str_replace(['-', '_'], ' ', $value));
        return str_replace(' ', '', $value);
    }
277161
protected function changeCase($string)
    {
        if ($this->isLowercase()) {
            return strtolower($string);
        }

        if ($this->isUppercase()) {
            return strtoupper($string);
        }

        return $string;
    }
444143
public static function fromString($string)
	{
		$lowercaseString = trim(strtolower($string), "\\");

		// TODO: variant types

		if ($lowercaseString === "mixed") {
			return MixedType::getInstance();

		} elseif ($lowercaseString === "scalar") {
			return ScalarType::getInstance();

		} elseif ($lowercaseString === "object") {
			return ObjectType::getInstance();

		} elseif ($lowercaseString === "void" || $lowercaseString === "null") {
			return VoidType::getInstance();

		} elseif ($lowercaseString === "numeric" || $lowercaseString === "number") {
			return NumericType::getInstance();

		} elseif ($lowercaseString === "int" || $lowercaseString === "integer") {
			return IntType::getInstance();

		} elseif ($lowercaseString === "float" || $lowercaseString === "double") {
			return FloatType::getInstance();

		} elseif ($lowercaseString === "bool" || $lowercaseString === "boolean") {
			return BoolType::getInstance();

		} elseif ($lowercaseString === "string") {
			return StringType::getInstance();

		} elseif ($lowercaseString === "resource" || $lowercaseString === "stream") {
			return ResourceType::getInstance();

		} elseif ($lowercaseString === "callable" || $lowercaseString === "callback" || trim($lowercaseString, "\\") === "closure") {
			return CallableType::getInstance();

		} elseif (strncmp($lowercaseString, "array", 5 /* strlen("array") */) === 0) {
			return ArrayType::create(MixedType::getInstance());

		} else {
			if (func_num_args() > 1) {
				$stack = func_get_arg(1);
			} else {
				$stack = new \ArrayObject();
			}

			if (func_num_args() > 2) {
				$reader = func_get_arg(2);
			} else {
				$reader = new AnnotationReader();
			}

			if (func_num_args() > 3) {
				$phpParser = func_get_arg(3);
			} else {
				$phpParser = new PhpParser();
			}

			if (func_num_args() > 4 && func_get_arg(4) !== null) {
				/** @var Type $declaringType */
				$declaringType = func_get_arg(4);
				$useStatements = $declaringType->getUseStatements();
			} else {
				$declaringType = null;
				$useStatements = array();
			}

			if ($lowercaseString === "\$this" || $lowercaseString === "self" || $lowercaseString === "static") {
				if ($declaringType === null) {
					throw new \InvalidArgumentException("Type string references declaring class, but no declaring class given.");
				}

				return $declaringType;

			} elseif (substr($string, -2) === "[]") {
				$baseString = substr($string, 0, strlen($string) - 2);
				return ArrayType::create(MixedType::fromString($baseString, $stack, $reader, $phpParser, $declaringType));

			} else {
				if ($string[0] === "\\") {
					$typeName = trim($string, "\\");

				} elseif (isset($useStatements[$lowercaseString])) {
					$typeName = $useStatements[$lowercaseString];
					// TODO: `use` with namespace (e.g. `use Doctrine\Mapping as ORM;`)

				} elseif ($declaringType !== null) {
					$typeName = $declaringType->getNamespaceName() . "\\" . $string;

				} else {
					$typeName = $string;
				}

				return Type::fromReflection(new \ReflectionClass($typeName), $stack, $reader, $phpParser);
			}
		}
	}
1130425
public function camelize()
    {
        $encoding = $this->encoding;
        $stringy = $this->trim()->lowerCaseFirst();
        $stringy->str = preg_replace('/^[-_]+/', '', $stringy->str);

        $stringy->str = preg_replace_callback(
            '/[-_\s]+(.)?/u',
            function ($match) use ($encoding) {
                if (isset($match[1])) {
                    return \mb_strtoupper($match[1], $encoding);
                }

                return '';
            },
            $stringy->str
        );

        $stringy->str = preg_replace_callback(
            '/[\d]+(.)?/u',
            function ($match) use ($encoding) {
                return \mb_strtoupper($match[0], $encoding);
            },
            $stringy->str
        );

        return $stringy;
    }
1156828
public function upperCaseFirst()
    {
        $first = UTF8::substr($this->scalarString, 0, 1, $this->encoding);

        $rest = UTF8::substr
        (
            $this->scalarString,
            1,
            $this->getLength() - 1,
            $this->encoding
        );

        return $this->newSelf(UTF8::strtoupper($first, $this->encoding).$rest);
    }
872106
public static function pascalCase($value)
    {
        if (isset(static::$pascalCache[$value])) {
            return static::$pascalCache[$value];
        }

        $value = static::normalizeScreamingCase($value);
        return static::$pascalCache[$value] = str_replace(' ', '', ucwords(str_replace(['-', '_'], ' ', $value)));
    }
1185999
function ToString()
    {
        $result = (string)$this->type;
        if ($this->value)
        {
            $result .= '=' . $this->value;
        }
        return $result;
    }
404266
public function lowerCaseFirst()
    {
        return $this->cloneInstance(
            function (StringObject $new) {
                $new->string = Mbstring::lcfirst($new->string, $this->encoding);
            }
        );
    }
1140782
public function lcfirst(){
		
		if($this->isNullOrWhitespace()){
			return clone $this;
		}
		else if($this->count() === 1){
			return new static(\mb_strtolower($this->_Value, $this->_Encoding), $this->_Encoding);
		}
		
		$str = $this[0]->lcfirst() . $this->substring(1);
		
		return new static($str, $this->_Encoding);
		
	}
256770
public function upperCaseFirst()
    {
        return $this->cloneInstance(
            function (StringObject $new) {
                $new->string = Mbstring::ucfirst($new->string, $this->encoding);
            }
        );
    }
879523
public static function pascalToSnakeCase($input)
    {
        preg_match_all('!([A-Z][A-Z0-9]*(?=$|[A-Z][a-z0-9])|[A-Za-z][a-z0-9]+)!', $input, $matches);

        foreach ($matches[0] as &$match) {
            $match = ($match == strtoupper($match)) ? strtolower($match) : lcfirst($match);
        }

        return implode('_', $matches[0]);
    }
1325858
public function toPascalCase(): Utility
    {
        $string = ucfirst($this->toCamelCase()->value());

        return new static($string, $this->encoding);
    }