Stringy\Stringy::create PHP Method

create() public static method

Creates a Stringy object and assigns both str and encoding properties the supplied values. $str is cast to a string prior to assignment, and if $encoding is not specified, it defaults to mb_internal_encoding(). It then returns the initialized object. Throws an InvalidArgumentException if the first argument is an array or object without a __toString method.
public static create ( mixed $str = '', string $encoding = null ) : Stringy
$str mixed Value to modify, after being cast to string
$encoding string The character encoding
return Stringy A Stringy object
    public static function create($str = '', $encoding = null)
    {
        return new static($str, $encoding);
    }

Usage Example

Example #1
8
 /**
  * Generate the full registry string.
  *
  * @return string
  */
 protected function generate()
 {
     $this->resultString = Stringy::create('');
     /*
      * @var Field
      */
     foreach ($this->values as $valueName => $valueClass) {
         $this->resultString = $this->resultString->append($valueClass->getValue());
     }
     return (string) $this->resultString;
 }
All Usage Examples Of Stringy\Stringy::create