<?php

namespace Sibs;

class SibsUtils
{
    public static function getCredentials()
    {
        $credentials                = [];
        $credentials['channel_id']  = 'web';
        $credentials['token']       = \Configuration::get('SIBS_GENERAL_BEARER');
        $credentials['server_mode'] = self::getServerMode();

        return $credentials;
    }

    public static function getServerMode()
    {
        return \Configuration::get('SIBS_GENERAL_ENVIRONMENT');
    }

    public static function getTestMode($paymentMethod)
    {
        if (self::getServerMode($paymentMethod) === 'LIVE') {
            return false;
        }

        return 'EXTERNAL';
    }

    public static function strContains(string $haystack, string $needle)
    {
        return empty($needle) || strpos($haystack, $needle) !== false;
    }
}
