protected function getMemoryLimit(): ?int
    {
        $short = [
            'k' => 1024,
            'm' => 1048576,
            'g' => 1073741824,
        ];

        $setting = (string) ini_get('memory_limit');

        if (!($len = strlen($setting))) {
            return null;
        }

        $last = strtolower($setting[$len - 1]);
        $numeric = (int) $setting;
        $numeric *= isset($short[$last]) ? $short[$last] : 1;

        return $numeric;
    }