Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.6.3

Request #16475 Support for "mentions" timeline
Submitted: 2009-07-26 18:17 UTC Modified: 2009-08-26 13:32 UTC
From: sotarok Assigned: izi
Status: Closed Package: Services_Twitter (version 0.2.1)
PHP Version: 5.2.5 OS:
Roadmaps: (Not assigned)    
Subscription  



Patch support_for_statuses_mentions Revisions
Revision 2009-07-26 18:18 UTC
Developer sotarok
 
Download patch

Index: Twitter/Statuses.php
===================================================================
--- Twitter/Statuses.php	(revision 976)
+++ Twitter/Statuses.php	(working copy)
@@ -156,6 +156,39 @@
     }
 
     /**
+     * Get statuses/mentions
+     *
+     *
+     * @param array $params Parameters array
+     * 
+     * @return object Instance of SimpleXMLElement of new status
+     * @throws Services_Twitter_Exception
+     * @see Services_Twitter_Common::sendRequest()
+     */
+    public function mentions(array $params = array())
+    {
+        $allowed = array('since_id', 'page');
+        $tmp     = array();
+        foreach ($params as $key => $val) {
+            if (in_array($key, $allowed)) {
+                $tmp[$key] = $val;
+            }
+        }
+
+        $endPoint = '/statuses/mentions';
+
+        $res = $this->sendRequest($endPoint, $tmp);
+        if (!isset($res->status) ||
+            (is_array($res->status) && !count($res->status))) {
+            throw new Services_Twitter_Exception(
+                $this->user . " has no status updates"
+            );
+        }
+
+        return $res;
+    }
+
+    /**
      * Returns up to 100 of the user's friends 
      *
      * @param array $params Parameters array