$string = 'Daenerys Targaryen'; $stringWithPrefix = Strings::appendMissingPrefix($string, 'Daenerys ');
Daenerys Targaryen
public static function prependIfMissing($string, $prefix) { if (Strings::startsWith($string, $prefix)) { return $string; } return Strings::appendPrefix($string, $prefix); }
public function bind($className, $name = '') { $className = Strings::prependIfMissing($className, '\\'); $binder = new Binder($className, $name); $this->binders[$className . '_' . $name] = $binder; return $binder; }