protected function setAppleConfig(array $config, $os)
    {
        $supportedAppleOS = array("mac", "ios");
        //Check if the OS is supported
        if (!in_array($os, $supportedAppleOS, true)) {
            throw new \RuntimeException(sprintf('This Apple OS "%s" is not supported', $os));
        }

        $pemFile = null;
        if (isset($config[$os]["pem"])) {
            // If PEM is set, it must be a real file
            if (realpath($config[$os]["pem"])) {
                // Absolute path
                $pemFile = $config[$os]["pem"];
            } elseif (realpath($this->kernelRootDir.DIRECTORY_SEPARATOR.$config[$os]["pem"]) ) {
                // Relative path
                $pemFile = $this->kernelRootDir.DIRECTORY_SEPARATOR.$config[$os]["pem"];
            } else {
                // path isn't valid
                throw new \RuntimeException(sprintf('Pem file "%s" not found.', $config[$os]["pem"]));
            }
        }

        if ($config[$os]['json_unescaped_unicode']) {
            // Not support JSON_UNESCAPED_UNICODE option
            if (!version_compare(PHP_VERSION, '5.4.0', '>=')) {
                throw new \LogicException(sprintf(
                    'Can\'t use JSON_UNESCAPED_UNICODE option. This option can use only PHP Version >= 5.4.0. Your version: %s',
                    PHP_VERSION
                ));
            }
        }

        $this->container->setParameter(sprintf('rms_push_notifications.%s.enabled', $os), true);
        $this->container->setParameter(sprintf('rms_push_notifications.%s.timeout', $os), $config[$os]["timeout"]);
        $this->container->setParameter(sprintf('rms_push_notifications.%s.sandbox', $os), $config[$os]["sandbox"]);
        $this->container->setParameter(sprintf('rms_push_notifications.%s.pem', $os), $pemFile);
        $this->container->setParameter(sprintf('rms_push_notifications.%s.passphrase', $os), $config[$os]["passphrase"]);
        $this->container->setParameter(sprintf('rms_push_notifications.%s.json_unescaped_unicode', $os), (bool) $config[$os]['json_unescaped_unicode']);
    }
protected function setAppleConfig(array $config, $os)
    {
        $supportedAppleOS = array("mac", "ios");
        //Check if the OS is supported
        if (!in_array($os, $supportedAppleOS, true)) {
            throw new \RuntimeException(sprintf('This Apple OS "%s" is not supported', $os));
        }

        $pemFile = null;
        if (isset($config[$os]["pem"])) {
            // If PEM is set, it must be a real file
            if (realpath($config[$os]["pem"])) {
                // Absolute path
                $pemFile = $config[$os]["pem"];
            } elseif (realpath($this->kernelRootDir.DIRECTORY_SEPARATOR.$config[$os]["pem"]) ) {
                // Relative path
                $pemFile = $this->kernelRootDir.DIRECTORY_SEPARATOR.$config[$os]["pem"];
            } else {
                // path isn't valid
                throw new \RuntimeException(sprintf('Pem file "%s" not found.', $config[$os]["pem"]));
            }
        }

        if ($config[$os]['json_unescaped_unicode']) {
            // Not support JSON_UNESCAPED_UNICODE option
            if (!version_compare(PHP_VERSION, '5.4.0', '>=')) {
                throw new \LogicException(sprintf(
                    'Can\'t use JSON_UNESCAPED_UNICODE option. This option can use only PHP Version >= 5.4.0. Your version: %s',
                    PHP_VERSION
                ));
            }
        }

        $this->container->setParameter(sprintf('rms_push_notifications.%s.enabled', $os), true);
        $this->container->setParameter(sprintf('rms_push_notifications.%s.timeout', $os), $config[$os]["timeout"]);
        $this->container->setParameter(sprintf('rms_push_notifications.%s.sandbox', $os), $config[$os]["sandbox"]);
        $this->container->setParameter(sprintf('rms_push_notifications.%s.pem', $os), $pemFile);
        $this->container->setParameter(sprintf('rms_push_notifications.%s.passphrase', $os), $config[$os]["passphrase"]);
        $this->container->setParameter(sprintf('rms_push_notifications.%s.json_unescaped_unicode', $os), (bool) $config[$os]['json_unescaped_unicode']);
    }
protected function setAppleConfig ( array $ config , $ os ) { $ supportedAppleOS = array ( "mac" , "ios" ) ; //Check if the OS is supported if ( ! in_array ( $ os , $ supportedAppleOS , true ) ) { throw new \ RuntimeException ( sprintf ( 'This Apple OS "%s" is not supported' , $ os ) ) ; } $ pemFile = null ; if ( isset ( $ config [ $ os ] [ "pem" ] ) ) { // If PEM is set, it must be a real file if ( realpath ( $ config [ $ os ] [ "pem" ] ) ) { // Absolute path $ pemFile = $ config [ $ os ] [ "pem" ] ; } elseif ( realpath ( $ this -> kernelRootDir . DIRECTORY_SEPARATOR . $ config [ $ os ] [ "pem" ] ) ) { // Relative path $ pemFile = $ this -> kernelRootDir . DIRECTORY_SEPARATOR . $ config [ $ os ] [ "pem" ] ; } else { // path isn't valid throw new \ RuntimeException ( sprintf ( 'Pem file "%s" not found.' , $ config [ $ os ] [ "pem" ] ) ) ; } } if ( $ config [ $ os ] [ 'json_unescaped_unicode' ] ) { // Not support JSON_UNESCAPED_UNICODE option if ( ! version_compare ( PHP_VERSION , '5.4.0' , '>=' ) ) { throw new \ LogicException ( sprintf ( 'Can\'t use JSON_UNESCAPED_UNICODE option. This option can use only PHP Version >= 5.4.0. Your version: %s' , PHP_VERSION ) ) ; } } $ this -> container -> setParameter ( sprintf ( 'rms_push_notifications.%s.enabled' , $ os ) , true ) ; $ this -> container -> setParameter ( sprintf ( 'rms_push_notifications.%s.timeout' , $ os ) , $ config [ $ os ] [ "timeout" ] ) ; $ this -> container -> setParameter ( sprintf ( 'rms_push_notifications.%s.sandbox' , $ os ) , $ config [ $ os ] [ "sandbox" ] ) ; $ this -> container -> setParameter ( sprintf ( 'rms_push_notifications.%s.pem' , $ os ) , $ pemFile ) ; $ this -> container -> setParameter ( sprintf ( 'rms_push_notifications.%s.passphrase' , $ os ) , $ config [ $ os ] [ "passphrase" ] ) ; $ this -> container -> setParameter ( sprintf ( 'rms_push_notifications.%s.json_unescaped_unicode' , $ os ) , ( bool ) $ config [ $ os ] [ 'json_unescaped_unicode' ] ) ; }
Sets Apple config into container

@param  array             $config
@param $os
@throws \RuntimeException
@throws \LogicException
Sets Apple config into container