Exemple #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='pocket'", 'bind' => ['user_id' => $user_id]]);
         if ($oauth) {
             global $config;
             $token = $oauth->access_token;
             $pocket = new Pocket($token);
             $pocket->setConfig($config);
             $pocket->addItem($arguments[0]);
         }
         return '';
     }
     throw new InvalidArgumentException('strings invalid');
 }