Example #1
0
 /**
  * @inheritdoc
  */
 public function __construct(PushData $pushData, $registrationTokens, $badges, $parameters, LoggerInterface $logger)
 {
     parent::__construct($pushData, $registrationTokens, $parameters, $logger);
     $this->badges = $badges;
     if (!isset($parameters['environment'])) {
         throw new PushException("No environment specified");
     } else {
         $env = strtolower($parameters['environment']);
         if ($env == 'sandbox') {
             $this->parameters['environment'] = \ApnsPHP_Abstract::ENVIRONMENT_SANDBOX;
             if (isset($parameters['sand_cert']) && file_exists($parameters['sand_cert'])) {
                 $this->certificate = $parameters['sand_cert'];
             } else {
                 throw new PushException("No APNS sandbox certificate file specified or file doesn't exist");
             }
         } elseif ($env == 'production') {
             $this->parameters['environment'] = \ApnsPHP_Abstract::ENVIRONMENT_PRODUCTION;
             if (isset($parameters['prod_cert']) && file_exists($parameters['prod_cert'])) {
                 $this->certificate = $parameters['prod_cert'];
             } else {
                 throw new PushException("No APNS production certificate specified");
             }
         } else {
             throw new PushException("APNS environment must be 'production' or 'sandbox'");
         }
     }
     if (!isset($parameters['ca_cert'])) {
         throw new PushException("No APNS root CA certificate specified");
     }
 }
Example #2
0
 /**
  * @inheritdoc
  */
 public function __construct(PushData $pushData, $registrationTokens, $parameters, LoggerInterface $logger)
 {
     parent::__construct($pushData, $registrationTokens, $parameters, $logger);
 }