Bolt\Twig\Handler\HtmlHandler::shy PHP Method

shy() public method

Add 'soft hyphens' ­ to a string, so that it won't break layout in HTML when using strings without spaces or dashes.
public shy ( string $str ) : string
$str string
return string
    public function shy($str)
    {
        if (is_string($str)) {
            $str = Str::shyphenate($str);
        }
        return $str;
    }

Usage Example

Example #1
0
 public function testShy()
 {
     $app = $this->getApp();
     $handler = new HtmlHandler($app);
     $result = $handler->shy('SomePeopleSayTheyAreShyOtherPeopleSayTheyAreNotWhatDoYouSay');
     $this->assertSame('SomePeople­SayTheyAre­ShyOtherPe­opleSayThe­yAreNotWha­tDoYouSay', $result);
 }