mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2024-12-18 08:54:20 +03:00
41df17bc46
* test: refactor test suite * docs * refactor * yup * docs
32 lines
794 B
PHP
32 lines
794 B
PHP
<?php
|
|
|
|
if (!function_exists('str_starts_with')) {
|
|
function str_starts_with($haystack, $needle)
|
|
{
|
|
return (string)$needle !== '' && strncmp($haystack, $needle, strlen($needle)) === 0;
|
|
}
|
|
}
|
|
|
|
if (!function_exists('str_ends_with')) {
|
|
function str_ends_with($haystack, $needle)
|
|
{
|
|
return $needle !== '' && substr($haystack, -strlen($needle)) === (string)$needle;
|
|
}
|
|
}
|
|
|
|
if (!function_exists('str_contains')) {
|
|
function str_contains($haystack, $needle)
|
|
{
|
|
return $needle !== '' && mb_strpos($haystack, $needle) !== false;
|
|
}
|
|
}
|
|
|
|
if (!function_exists('array_is_list')) {
|
|
function array_is_list(array $arr)
|
|
{
|
|
if ($arr === []) {
|
|
return true;
|
|
}
|
|
return array_keys($arr) === range(0, count($arr) - 1);
|
|
}
|
|
}
|