mirror of
https://github.com/danielstjules/Stringy.git
synced 2025-08-11 15:54:04 +02:00
Remove some useless else.
This commit is contained in:
@@ -141,9 +141,9 @@ class Stringy implements \Countable, \IteratorAggregate, \ArrayAccess
|
||||
function ($match) use ($encoding) {
|
||||
if (isset($match[1])) {
|
||||
return mb_strtoupper($match[1], $encoding);
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
|
||||
return '';
|
||||
},
|
||||
$stringy->str
|
||||
);
|
||||
@@ -201,9 +201,9 @@ class Stringy implements \Countable, \IteratorAggregate, \ArrayAccess
|
||||
|
||||
if ($caseSensitive) {
|
||||
return (mb_strpos($this->str, $needle, 0, $encoding) !== false);
|
||||
} else {
|
||||
return (mb_stripos($this->str, $needle, 0, $encoding) !== false);
|
||||
}
|
||||
|
||||
return (mb_stripos($this->str, $needle, 0, $encoding) !== false);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -394,11 +394,10 @@ class Stringy implements \Countable, \IteratorAggregate, \ArrayAccess
|
||||
|
||||
if ($n < 0) {
|
||||
$stringy->str = '';
|
||||
} else {
|
||||
return $stringy->substr(0, $n);
|
||||
return $stringy;
|
||||
}
|
||||
|
||||
return $stringy;
|
||||
return $stringy->substr(0, $n);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -661,11 +660,10 @@ class Stringy implements \Countable, \IteratorAggregate, \ArrayAccess
|
||||
|
||||
if ($n <= 0) {
|
||||
$stringy->str = '';
|
||||
} else {
|
||||
return $stringy->substr(-$n);
|
||||
return $stringy;
|
||||
}
|
||||
|
||||
return $stringy;
|
||||
return $stringy->substr(-$n);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1279,9 +1277,9 @@ class Stringy implements \Countable, \IteratorAggregate, \ArrayAccess
|
||||
function ($match) use ($encoding) {
|
||||
if ($match[0] == mb_strtoupper($match[0], $encoding)) {
|
||||
return mb_strtolower($match[0], $encoding);
|
||||
} else {
|
||||
return mb_strtoupper($match[0], $encoding);
|
||||
}
|
||||
|
||||
return mb_strtoupper($match[0], $encoding);
|
||||
},
|
||||
$stringy->str
|
||||
);
|
||||
@@ -1331,10 +1329,11 @@ class Stringy implements \Countable, \IteratorAggregate, \ArrayAccess
|
||||
function ($match) use ($encoding, $ignore) {
|
||||
if ($ignore && in_array($match[0], $ignore)) {
|
||||
return $match[0];
|
||||
} else {
|
||||
$stringy = new Stringy($match[0], $encoding);
|
||||
return (string) $stringy->toLowerCase()->upperCaseFirst();
|
||||
}
|
||||
|
||||
$stringy = new Stringy($match[0], $encoding);
|
||||
|
||||
return (string) $stringy->toLowerCase()->upperCaseFirst();
|
||||
},
|
||||
$stringy->str
|
||||
);
|
||||
@@ -1395,9 +1394,9 @@ class Stringy implements \Countable, \IteratorAggregate, \ArrayAccess
|
||||
return $map[$key];
|
||||
} elseif (is_numeric($this->str)) {
|
||||
return (intval($this->str) > 0);
|
||||
} else {
|
||||
return (bool) $this->regexReplace('[[:space:]]', '')->str;
|
||||
}
|
||||
|
||||
return (bool) $this->regexReplace('[[:space:]]', '')->str;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user