json token for .ini file

private $config;
        private static $instance;

        private static function getInstance() {
            if(is_null(self::$instance)){
                self::$instance = new DSConfig();
            }

            return self::$instance;
        }

        public function __construct() {
            date_default_timezone_set('UTC');

            $clientId = getenv("DS_CLIENT_ID");
            if (!is_null($clientId) and !empty($clientId)) {
                $this->config["DS_CLIENT_ID"] = $clientId;
                $this->config["DS_AUTH_SERVER"] = getenv("DS_AUTH_SERVER");
                $this->config["DS_IMPERSONATED_USER_GUID"] = getenv("DS_IMPERSONATED_USER_GUID");
                $this->config["DS_TARGET_ACCOUNT_ID"] = getenv("DS_TARGET_ACCOUNT_ID");
                $this->config["SIGNER_EMAIL"] = getenv("SIGNER_EMAIL");
                $this->config["SIGNER_NAME"] = getenv("SIGNER_NAME");
                $this->config["CC_EMAIL"] = getenv("CC_EMAIL");
                $this->config["CC_NAME"] = getenv("CC_NAME");
                $this->config["DS_PRIVATE_KEY"] = getenv("DS_PRIVATE_KEY");
            } else {
                $this->config = parse_ini_file('ds_config.ini', true);
            }
        }

        private function _auth_server() {
            return $this->config["DS_AUTH_SERVER"];
        }
        public static  function auth_server() {
            return self::getInstance()->_auth_server();
        }
        private function _client_id() {
            return $this->config["DS_CLIENT_ID"];
        }
        public static  function client_id() {
            return self::getInstance()->_client_id();
        }
        private function _impersonated_user_guid() {
            return $this->config["DS_IMPERSONATED_USER_GUID"];
        }
        public static  function impersonated_user_guid() {
            return self::getInstance()->_impersonated_user_guid();
        }
        private function _target_account_id() {
            return $this->config["DS_TARGET_ACCOUNT_ID"];
        }
        public static  function target_account_id(){
            return self::getInstance()->_target_account_id();
        }
        private function _signer_email() {
            return $this->config["SIGNER_EMAIL"];
        }
        public static  function signer_email(){
            return self::getInstance()->_signer_email();
        }
        private function _signer_name(){
            return $this->config["SIGNER_NAME"];
        }
        public static  function signer_name(){
            return self::getInstance()->_signer_name();
        }
        private function _cc_email() {
            return $this->config["CC_EMAIL"];
        }
        public static function cc_email(){
            return self::getInstance()->_cc_email();
        }
        private function _cc_name(){
            return $this->config["CC_NAME"];
        }
        public static function cc_name(){
            return self::getInstance()->_cc_name();
        }
        private function _private_key() {
            return $this->config["DS_PRIVATE_KEY"];
        }
        public static function private_key(){
            return self::getInstance()->_private_key();
        }
        public static function aud() {
            $auth_server = self::getInstance()->_auth_server();

            if (strpos($auth_server, 'https://') !== false) {
                $aud = substr($auth_server, 8);
            } else { # assuming http://blah
                $aud = substr($auth_server, 7);
            }
            return $aud;
        }
        public static function api() {
            return "restapi/v2";
        }
        public static function jwt_scope() {
             return "signature";
        }

Are there any code examples left?
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source