/** * {@inheritdoc} */ protected function configureProcess(ProcessBuilder $processBuilder, Notification $notification) { $script = 'display notification "' . $notification->getBody() . '"'; if ($notification->getTitle()) { $script .= ' with title "' . $notification->getTitle() . '"'; } $processBuilder->add('-e'); $processBuilder->add($script); }
/** * {@inheritdoc} */ protected function configureProcess(ProcessBuilder $processBuilder, Notification $notification) { if ($notification->getIcon()) { $processBuilder->add('--icon'); $processBuilder->add($notification->getIcon()); } if ($notification->getTitle()) { $processBuilder->add($notification->getTitle()); } $processBuilder->add($notification->getBody()); }
/** * {@inheritdoc} */ protected function configureProcess(ProcessBuilder $processBuilder, Notification $notification) { $processBuilder->add('-message'); $processBuilder->add($notification->getBody()); if ($notification->getTitle()) { $processBuilder->add('-title'); $processBuilder->add($notification->getTitle()); } if ($notification->getIcon() && version_compare(OsHelper::getMacOSVersion(), '10.9.0', '>=')) { $processBuilder->add('-appIcon'); $processBuilder->add($notification->getIcon()); } }
/** * {@inheritdoc} */ public function send(Notification $notification) { if (!$notification->getBody()) { throw new InvalidNotificationException($notification, 'Notification body can not be empty'); } $builder = new ProcessBuilder(); if (self::SUPPORT_BINARY_PROVIDED === $this->support && $this instanceof BinaryProvider) { $dir = rtrim($this->getRootDir(), '/') . '/'; $embeddedBinary = $dir . $this->getEmbeddedBinary(); if (PharExtractor::isLocatedInsideAPhar($embeddedBinary)) { $embeddedBinary = PharExtractor::extractFile($embeddedBinary); foreach ($this->getExtraFiles() as $file) { PharExtractor::extractFile($dir . $file); } } $builder->setPrefix($embeddedBinary); } else { $builder->setPrefix($this->getBinary()); } $this->configureProcess($builder, $notification); $process = $builder->getProcess(); $process->run(); return $process->isSuccessful(); }