Example #1
0
 protected function execute(array $arguments)
 {
     if (isset($arguments[0]) && ($user_id = (int) $GLOBALS['user_id'])) {
         $oauth = \UserOauth::findFirst(["user_id = :user_id: and app='pushbullet'", 'bind' => ['user_id' => $user_id]]);
         if ($oauth) {
             $token = $oauth->access_token;
             $pushbullet = new Pushbullet($token);
             $pushbullet->pushNote('', $arguments[0]);
         }
         return '';
     }
     throw new InvalidArgumentException('strings invalid');
 }