* Generates a pseudo-random string of hexadecimal characters
*
* @param int $size Size of string (default: 64)
+ *
* @return string Pseudo-random string
* @throws \Exception
*/
*
* @param string $network Network name of the contact (e.g. dfrn, rss and so on)
* @param string $url The contact url
+ *
* @return string Formatted network name
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
* Check if the trimmed provided string is starting with one of the provided characters
*
* @param string $string
- * @param array $chars
+ * @param array $chars
+ *
* @return bool
*/
public static function startsWithChars(string $string, array $chars): bool
* @see http://maettig.com/code/php/php-performance-benchmarks.php#endswith
* @param string $string
* @param string $end
+ *
* @return bool
*/
- public static function endsWith(string $string, string $end): string
+ public static function endsWith(string $string, string $end): bool
{
- $return = substr_compare($string, $end, -strlen($end)) === 0;
-
- return $return;
+ return (substr_compare($string, $end, -strlen($end)) === 0);
}
/**
/**
* Ensures a single path item doesn't contain any path-traversing characters
*
- * @see https://stackoverflow.com/a/46097713
* @param string $pathItem
+ *
+ * @see https://stackoverflow.com/a/46097713
* @return string
*/
public static function sanitizeFilePathItem(string $pathItem): string
* @param string $replacement
* @param int $start
* @param int|null $length
+ *
* @return string
* @see substr_replace()
*/
* @param string $text
* @param string $regex
* @param callable $callback
+ *
* @return string
*/
public static function performWithEscapedBlocks(string $text, string $regex, callable $callback): string