Inheritance: extends Crummy\Phlack\Common\Hash, implements Crummy\Phlack\WebHook\CommandInterface
コード例 #1
0
ファイル: WebHook.php プロジェクト: mcrumm/phlack
 /**
  * @param OptionsResolver $resolver
  */
 protected function setDefaultOptions(OptionsResolver $resolver)
 {
     parent::setDefaultOptions($resolver);
     $resolver->setDefaults(['command' => function (Options $options) {
         $text = $options['text'];
         $delimiterPos = strpos($text, self::COMMAND_DELIMITER);
         $delimiterPos = false === $delimiterPos ? strpos($text, ' ') : $delimiterPos;
         return false === $delimiterPos ? $text : substr($text, 0, $delimiterPos);
     }]);
     $resolver->setNormalizers(['command' => function (Options $options, $value) {
         if (null !== $value) {
             $value = preg_replace('/[^a-z0-9\\-]/', '', strtolower($value));
             if (false === strpos($value, self::COMMAND_DELIMITER)) {
                 $value .= self::COMMAND_DELIMITER;
             }
         }
         return $value;
     }]);
 }
コード例 #2
0
ファイル: SlashCommand.php プロジェクト: mcrumm/phlack
 public function setDefaultOptions(OptionsResolver $resolver)
 {
     parent::setDefaultOptions($resolver);
     $resolver->setDefined(['team_domain', 'service_id']);
 }