Exemplo n.º 1
0
 /**
  * @param string $icon
  *
  * @return $this
  */
 public function setIcon($icon)
 {
     // This makes the icon accessible for native commands when it's embedded inside a phar
     if (PharExtractor::isLocatedInsideAPhar($icon)) {
         $icon = PharExtractor::extractFile($icon);
     }
     $this->icon = $icon;
     return $this;
 }
 /**
  * {@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();
 }