src/Factories/StringFactory.php
public static function create($string) {
        if(is_array($string)) {
            throw new InvalidArgumentException('Arrays cannot be casted to string!');
        }

        if(is_object($string) &&
            !(($string instanceof StringConvertibleInterface) || (method_exists($string, '__toString')))) {
            throw new InvalidArgumentException('The given value is an object but cant converted to string!');
        }

        $value = (string) $string;
        return new StringObject($value);
    }
public static function create($string) {
        if(is_array($string)) {
            throw new InvalidArgumentException('Arrays cannot be casted to string!');
        }

        if(is_object($string) &&
            !(($string instanceof StringConvertibleInterface) || (method_exists($string, '__toString')))) {
            throw new InvalidArgumentException('The given value is an object but cant converted to string!');
        }

        $value = (string) $string;
        return new StringObject($value);
    }
public static function create ( $ string ) { if ( is_array ( $ string ) ) { throw new InvalidArgumentException ( 'Arrays cannot be casted to string!' ) ; } if ( is_object ( $ string ) && ! ( ( $ string instanceof StringConvertibleInterface ) || ( method_exists ( $ string , '__toString' ) ) ) ) { throw new InvalidArgumentException ( 'The given value is an object but cant converted to string!' ) ; } $ value = ( string ) $ string ; return new StringObject ( $ value ) ; }
Creates a new stringObject class from the given value.
If the given value is an object and is string convertible the object
will be converted to string, before consumed.

@param string $string

@return \BuildR\Utils\StringObject

@throws \BuildR\Foundation\Exception\InvalidArgumentException
Creates a new stringObject class from the given value . If the given value is an object and is string convertible the object will be converted to string before consumed .