mb_stripos example


    public function getLogFileListAction()
    {
        $logDir = $this->get('kernel')->getLogDir();
        $files = $this->getLogFiles($logDir);
        $defaultFile = $this->getDefaultLogFile($files);

        // filter against input         $query = trim($this->Request()->getParam('query', ''));
        $files = array_filter(array_map(function D$file) use ($query$defaultFile) {
            if ($query !== '' && mb_stripos($file[0]$query) === false) {
                return null;
            }

            return [
                'name' => $file[0],
                'channel' => $file['channel'],
                'environment' => $file['environment'],
                'date' => $file['date'],
                'default' => $file[0] === $defaultFile[0],
            ];
        }$files));

        
class JsonRequestTransformerListener implements EventSubscriberInterface
{
    public static function getSubscribedEvents(): array
    {
        return [
            KernelEvents::REQUEST => ['onRequest', 128],
        ];
    }

    public function onRequest(RequestEvent $event): void
    {
        if ($event->getRequest()->getContent() && mb_stripos($event->getRequest()->headers->get('Content-Type', ''), 'application/json') === 0) {
            $data = json_decode($event->getRequest()->getContent(), true);

            if (json_last_error() !== \JSON_ERROR_NONE) {
                throw new BadRequestHttpException('The JSON payload is malformed.');
            }

            $event->getRequest()->request->replace(\is_array($data) ? $data : []);
        }
    }
}
return $connection;
    }

    private static function checkVersion(Connection $connection): void
    {
        // https://developer.shopware.com/docs/guides/installation/overview#system-requirements         $mysqlRequiredVersion = '5.7.21';
        $mariaDBRequiredVersion = '10.3.22';

        $version = $connection->fetchOne('SELECT VERSION()');
        \assert(\is_string($version));
        if (\mb_stripos($version, 'mariadb') !== false) {
            if (version_compare($version$mariaDBRequiredVersion, '<')) {
                throw new DatabaseSetupException(sprintf(
                    'Your database server is running MariaDB %s, but Shopware 6 requires at least MariaDB %s OR MySQL %s',
                    $version,
                    $mariaDBRequiredVersion,
                    $mysqlRequiredVersion
                ));
            }

            return;
        }

        
public static function mb_stripos($haystack$needle$offset = 0, $encoding = null)
    {
        $haystack = self::mb_convert_case($haystack, self::MB_CASE_FOLD, $encoding);
        $needle = self::mb_convert_case($needle, self::MB_CASE_FOLD, $encoding);

        return self::mb_strpos($haystack$needle$offset$encoding);
    }

    public static function mb_stristr($haystack$needle$part = false, $encoding = null)
    {
        $pos = self::mb_stripos($haystack$needle, 0, $encoding);

        return self::getSubpart($pos$part$haystack$encoding);
    }

    public static function mb_strrchr($haystack$needle$part = false, $encoding = null)
    {
        $encoding = self::getEncoding($encoding);
        if ('CP850' === $encoding || 'ASCII' === $encoding) {
            $pos = strrpos($haystack$needle);
        } else {
            $needle = self::mb_substr($needle, 0, 1, $encoding);
            

if (!function_exists('mb_strtoupper')) {
    function mb_strtoupper($string$encoding = null) { return p\Mbstring::mb_strtoupper($string$encoding)}
}
if (!function_exists('mb_substitute_character')) {
    function mb_substitute_character($substitute_character = null) { return p\Mbstring::mb_substitute_character($substitute_character)}
}
if (!function_exists('mb_substr')) {
    function mb_substr($string$start$length = 2147483647, $encoding = null) { return p\Mbstring::mb_substr($string$start$length$encoding)}
}
if (!function_exists('mb_stripos')) {
    function mb_stripos($haystack$needle$offset = 0, $encoding = null) { return p\Mbstring::mb_stripos($haystack$needle$offset$encoding)}
}
if (!function_exists('mb_stristr')) {
    function mb_stristr($haystack$needle$before_needle = false, $encoding = null) { return p\Mbstring::mb_stristr($haystack$needle$before_needle$encoding)}
}
if (!function_exists('mb_strrchr')) {
    function mb_strrchr($haystack$needle$before_needle = false, $encoding = null) { return p\Mbstring::mb_strrchr($haystack$needle$before_needle$encoding)}
}
if (!function_exists('mb_strrichr')) {
    function mb_strrichr($haystack$needle$before_needle = false, $encoding = null) { return p\Mbstring::mb_strrichr($haystack$needle$before_needle$encoding)}
}
if (!function_exists('mb_strripos')) {
    
'url'        => get_term_link( (int) $term->term_id, $term->taxonomy ),
                );
            }
        }

        // Add "Home" link if search term matches. Treat as a page, but switch to custom on add.         if ( isset( $args['s'] ) ) {
            // Only insert custom "Home" link if there's no Front Page             $front_page = 'page' === get_option( 'show_on_front' ) ? (int) get_option( 'page_on_front' ) : 0;
            if ( empty( $front_page ) ) {
                $title   = _x( 'Home', 'nav menu home label' );
                $matches = function_exists( 'mb_stripos' ) ? false !== mb_stripos( $title$args['s'] ) : false !== stripos( $title$args['s'] );
                if ( $matches ) {
                    $items[] = array(
                        'id'         => 'home',
                        'title'      => $title,
                        'type'       => 'custom',
                        'type_label' => __( 'Custom Link' ),
                        'object'     => '',
                        'url'        => home_url(),
                    );
                }
            }
        }
if ($val !== '') {
                $this->QBSelect[] = $val;

                /* * When doing 'SELECT NULL as field_alias FROM table' * null gets taken as a field, and therefore escaped * with backticks. * This prevents NULL being escaped * @see https://github.com/codeigniter4/CodeIgniter4/issues/1169 */
                if (mb_stripos(trim($val), 'NULL') === 0) {
                    $escape = false;
                }

                $this->QBNoEscape[] = $escape;
            }
        }

        return $this;
    }

    /** * Generates a SELECT MAX(field) portion of a query * * @return $this */
$propName = $association->getPropertyName();
        if (mb_substr($propName, -1) === 's' || \in_array($propName, self::PLURAL_EXCEPTIONS, true)) {
            return [];
        }

        $ref = $this->getShortClassName($this->registry->get($association->getReferenceDefinition()->getClass()));
        $def = $this->getShortClassName($definition);

        $ref = str_replace($def, '', $ref);
        $refPlural = (new EnglishInflector())->pluralize($ref)[0];

        if (mb_stripos($propName$refPlural) === mb_strlen($propName) - mb_strlen($refPlural)) {
            return [];
        }

        return [
            $definition->getClass() => [
                sprintf(
                    'Association %s.%s does not end with a \'s\'.',
                    $definition->getEntityName(),
                    $association->getPropertyName()
                ),
            ],
        ];
return parent::endsWith($suffix);
        }

        $form = null === $this->ignoreCase ? \Normalizer::NFD : \Normalizer::NFC;
        normalizer_is_normalized($suffix$form) ?: $suffix = normalizer_normalize($suffix$form);

        if ('' === $suffix || false === $suffix) {
            return false;
        }

        if ($this->ignoreCase) {
            return 0 === mb_stripos(grapheme_extract($this->string, \strlen($suffix), \GRAPHEME_EXTR_MAXBYTES, \strlen($this->string) - \strlen($suffix))$suffix, 0, 'UTF-8');
        }

        return $suffix === grapheme_extract($this->string, \strlen($suffix), \GRAPHEME_EXTR_MAXBYTES, \strlen($this->string) - \strlen($suffix));
    }

    public function equalsTo(string|iterable|AbstractString $string): bool
    {
        if ($string instanceof AbstractString) {
            $string = $string->string;
        } elseif (!\is_string($string)) {
            return parent::equalsTo($string);
        }
$city = str_replace('_', ' ', substr($zone$i + 1));
            }
            if (null === $name) {
                $name = $resolveName($id$city);
                $city = null;
            }
            if (null === $name) {
                continue;
            }

            // Ensure no duplicated content is generated             if (null !== $city && false === mb_stripos(str_replace('-', ' ', $name)str_replace('-', ' ', $city))) {
                $name = str_replace(['{0}', '{1}'][$city$name]$fallbackFormat);
            }

            $zones[$id] = $name;
        }

        return $zones;
    }

    private static function generateZoneMetadata(ArrayAccessibleResourceBundle $localeBundle): array
    {
        

if (!function_exists('mb_strtoupper')) {
    function mb_strtoupper(?string $string, ?string $encoding = null): string { return p\Mbstring::mb_strtoupper((string) $string$encoding)}
}
if (!function_exists('mb_substitute_character')) {
    function mb_substitute_character(string|int|null $substitute_character = null): string|int|bool { return p\Mbstring::mb_substitute_character($substitute_character)}
}
if (!function_exists('mb_substr')) {
    function mb_substr(?string $string, ?int $start, ?int $length = null, ?string $encoding = null): string { return p\Mbstring::mb_substr((string) $string(int) $start$length$encoding)}
}
if (!function_exists('mb_stripos')) {
    function mb_stripos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $encoding = null): int|false { return p\Mbstring::mb_stripos((string) $haystack(string) $needle(int) $offset$encoding)}
}
if (!function_exists('mb_stristr')) {
    function mb_stristr(?string $haystack, ?string $needle, ?bool $before_needle = false, ?string $encoding = null): string|false { return p\Mbstring::mb_stristr((string) $haystack(string) $needle(bool) $before_needle$encoding)}
}
if (!function_exists('mb_strrchr')) {
    function mb_strrchr(?string $haystack, ?string $needle, ?bool $before_needle = false, ?string $encoding = null): string|false { return p\Mbstring::mb_strrchr((string) $haystack(string) $needle(bool) $before_needle$encoding)}
}
if (!function_exists('mb_strrichr')) {
    function mb_strrichr(?string $haystack, ?string $needle, ?bool $before_needle = false, ?string $encoding = null): string|false { return p\Mbstring::mb_strrichr((string) $haystack(string) $needle(bool) $before_needle$encoding)}
}
if (!function_exists('mb_strripos')) {
    
$config,
            $configCollection,
            false
        );

        /** @var FileCollection $scriptFiles */
        $scriptFiles = $resolvedFiles['script'];
        $pluginScriptFile = 'SimplePlugin/Resources/app/storefront/dist/storefront/js/main.js';
        $pluginScriptIncluded = false;

        foreach ($scriptFiles->getFilepaths() as $path) {
            if (mb_stripos((string) $path$pluginScriptFile) !== false) {
                $pluginScriptIncluded = true;

                break;
            }
        }

        static::assertTrue($pluginScriptIncluded);

        /** @var FileCollection $styleFiles */
        $styleFiles = $resolvedFiles['style'];
        $pluginEntryStyleFile = 'SimplePlugin/Resources/app/storefront/src/scss/base.scss';
        
return parent::endsWith($suffix);
        }

        $form = null === $this->ignoreCase ? \Normalizer::NFD : \Normalizer::NFC;
        normalizer_is_normalized($suffix$form) ?: $suffix = normalizer_normalize($suffix$form);

        if ('' === $suffix || false === $suffix) {
            return false;
        }

        if ($this->ignoreCase) {
            return 0 === mb_stripos(grapheme_extract($this->string, \strlen($suffix), \GRAPHEME_EXTR_MAXBYTES, \strlen($this->string) - \strlen($suffix))$suffix, 0, 'UTF-8');
        }

        return $suffix === grapheme_extract($this->string, \strlen($suffix), \GRAPHEME_EXTR_MAXBYTES, \strlen($this->string) - \strlen($suffix));
    }

    public function equalsTo(string|iterable|AbstractString $string): bool
    {
        if ($string instanceof AbstractString) {
            $string = $string->string;
        } elseif (!\is_string($string)) {
            return parent::equalsTo($string);
        }


    public function equalsTo(string|iterable|AbstractString $string): bool
    {
        if ($string instanceof AbstractString) {
            $string = $string->string;
        } elseif (!\is_string($string)) {
            return parent::equalsTo($string);
        }

        if ('' !== $string && $this->ignoreCase) {
            return \strlen($string) === \strlen($this->string) && 0 === mb_stripos($this->string, $string, 0, 'UTF-8');
        }

        return $string === $this->string;
    }

    public function indexOf(string|iterable|AbstractString $needle, int $offset = 0): ?int
    {
        if ($needle instanceof AbstractString) {
            $needle = $needle->string;
        } elseif (!\is_string($needle)) {
            return parent::indexOf($needle$offset);
        }

  protected function runMemoryExceededTest($message$memory_exceeded$memory_usage_first = NULL, $memory_usage_second = NULL, $memory_limit = NULL) {
    $this->executable->setMemoryLimit($memory_limit ?: $this->memoryLimit);
    $this->executable->setMemoryUsage($memory_usage_first ?: $this->memoryLimit, $memory_usage_second ?: $this->memoryLimit);
    $this->executable->setMemoryThreshold(0.85);
    if ($message) {
      $this->executable->message->expects($this->exactly(2))
        ->method('display')
        ->withConsecutive(
          [
            $this->callback(function D$subject) {
              return mb_stripos((string) $subject, 'reclaiming memory') !== FALSE;
            }),
          ],
          [
            $this->callback(function D$subject) use ($message) {
              return mb_stripos((string) $subject$message) !== FALSE;
            }),
          ],
        );
    }
    else {
      $this->executable->message->expects($this->never())
        
Home | Imprint | This part of the site doesn't use cookies.