wikimedia/wrappedstring
Automatically compact sequentially-outputted strings that share a common prefix / suffix pair.
v3.0.1
2018-06-05 20:33 UTC
Requires
- php: >=5.5.9
Requires (Dev)
- jakub-onderka/php-parallel-lint: 1.0.0
- jakub-onderka/php-console-highlighter: 0.3.2
- mediawiki/mediawiki-codesniffer: 20.0.0
- mediawiki/minus-x: 0.3.1
- ockcyp/covers-validator: 0.5.1 || 0.6.1
- phpunit/phpunit: 4.8.36 || ^6.5
README
WrappedString is a small PHP library for compacting redundant string-wrapping code in text output. The most common use-case is to eliminate redundant runs of HTML open/close tags and JavaScript boilerplate.
Here is how you use it:
use Wikimedia\WrappedString; $buffer = [ new WrappedString( '[foo]', '[', ']' ), new WrappedString( '[bar]', '[', ']' ), ]; $output = WrappedString::join( "\n", $buffer ); // Result: '[foobar]'
License
The project is licensed under the MIT license.