-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from MekDrop/fix/for-older-php
This probably would fix running on older PHP versions than 8.0 when installing with ImpressCMS
- Loading branch information
Showing
6 changed files
with
60 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
|
||
namespace ImpressCMS\Composer\AddonInstaller\Utils; | ||
|
||
/** | ||
* Few string malipulation related functions | ||
* | ||
* @package ImpressCMS\Composer\AddonInstaller\Utils | ||
*/ | ||
final class StrHelper | ||
{ | ||
|
||
/** | ||
* StrHelper disabled constructor. | ||
*/ | ||
private function __construct() | ||
{ | ||
} | ||
|
||
/** | ||
* Checks if string starts with another string | ||
* | ||
* @param string $str String where to look | ||
* @param string $needle String to look for | ||
* | ||
* @return bool | ||
*/ | ||
public static function str_starts_with(string $str, string $needle): bool | ||
{ | ||
return strpos($str, $needle) === 0; | ||
} | ||
|
||
/** | ||
* Checks if string ends with such string | ||
* | ||
* @param string $str Where to look | ||
* @param string $needle What to look | ||
* | ||
* @return bool | ||
*/ | ||
public static function str_ends_with(string $str, string $needle): bool | ||
{ | ||
return substr($str, -strlen($needle)) === $needle; | ||
} | ||
|
||
|
||
} |