clean() публичный статический Метод

Cleans up a Text::insert() formatted string with given $options depending on the 'clean' option. The goal of this function is to replace all whitespace and unneeded mark-up around place-holders that did not get replaced by Text::insert().
public static clean ( string $str, array $options = [] ) : string
$str string The string to clean.
$options array Available options are: - `'before'`: characters marking the start of targeted substring. - `'after'`: characters marking the end of targeted substring. - `'escape'`: The character or string used to escape the before character or string (defaults to `'\\'`). - `'gap'`: Regular expression matching gaps. - `'word'`: Regular expression matching words. - `'replacement'`: String to use for cleaned substrings (defaults to `''`).
Результат string The cleaned string.
Пример #1
0
     it("cleans placeholder and adjacent `'and'`", function () {
         $result = Text::clean('{:a} and 2 and 3');
         $this->expect($result)->toBe('2 and 3');
         $result = Text::clean('2 and {:a} and 3');
         $this->expect($result)->toBe('2 and 3');
         $result = Text::clean('{:a} and {:b} and 3');
         $this->expect($result)->toBe('3');
         $result = Text::clean('{:a} and 3 and {:b}');
         $this->expect($result)->toBe('3');
         $result = Text::clean('{:a} and {:b} and {:c}');
         $this->expect($result)->toBe('');
     });
     it("cleans placeholder and adjacent comma and `'and'`", function () {
         $result = Text::clean('{:a}, 2 and 3');
         $this->expect($result)->toBe('2 and 3');
         $result = Text::clean('{:a}, 2 and {:c}');
         $this->expect($result)->toBe('2');
     });
 });
 describe("::toString()", function () {
     it("exports an empty array", function () {
         $dump = Text::toString([]);
         $this->expect($dump)->toBe("[]");
     });
     it("exports an object", function () {
         $dump = Text::toString(new stdClass());
         $this->expect($dump)->toBe("`stdClass`");
     });
     it("exports an object supporting __toString()", function () {
         $stub = Double::instance();
         allow($stub)->toReceive('__toString')->andReturn('jedi');