Code Duplication    Length = 14-14 lines in 4 locations

plugins/actions/twitter/twitter.php 4 locations

@@ 1666-1679 (lines=14) @@
1663
     * @internal param $string [optional] $userId        Specfies the screen name of the user for whom to return results for. Helpful for disambiguating when a valid screen name is also a user ID.
1664
     * @internal param $string [optional] $screenName    Specfies the ID of the user for whom to return results for. Helpful for disambiguating when a valid user ID is also a valid screen name.
1665
     */
1666
    public function directMessagesNew($text, $id = null, $userId = null, $screenName = null)
1667
    {
1668
        // validate
1669
        if ($id == '' && $userId == '' && $screenName == '') throw new TwitterException('Specify an id or an userId or a screenName.');
1670
1671
        // build parameters
1672
        $parameters['text'] = (string)$text;
1673
        if ($id != null) $parameters['user'] = (string)$id;
1674
        if ($userId != null) $parameters['user_id'] = (string)$userId;
1675
        if ($screenName != null) $parameters['screen_name'] = (string)$screenName;
1676
1677
        // make the call
1678
        return (array)$this->doCall('direct_messages/new.json', $parameters, true, 'POST');
1679
    }
1680
1681
    /**
1682
     * Destroys the direct message specified in the required ID parameter. The authenticating user must be the recipient of the specified direct message.
@@ 1715-1728 (lines=14) @@
1712
     * @internal param $string [optional] $screenName    Specfies the ID of the user for whom to return results for. Helpful for disambiguating when a valid user ID is also a valid screen name.
1713
     * @internal param $bool [optional] $follow            Returns public statuses that reference the given set of users.
1714
     */
1715
    public function friendshipsCreate($id = null, $userId = null, $screenName = null, $follow = false)
1716
    {
1717
        // validate
1718
        if ($id == '' && $userId == '' && $screenName == '') throw new TwitterException('Specify an id or an userId or a screenName.');
1719
1720
        // build parameters
1721
        if ($id != null) $parameters['id'] = (string)$id;
1722
        if ($userId != null) $parameters['user_id'] = (string)$userId;
1723
        if ($screenName != null) $parameters['screen_name'] = (string)$screenName;
1724
        $parameters['follow'] = $follow ? 'true' : 'false';
1725
1726
        // make the call
1727
        return (array)$this->doCall('friendships/create.json', $parameters, true, 'POST');
1728
    }
1729
1730
    /**
1731
     * Allows the authenticating users to unfollow the user specified in the ID parameter.
@@ 1853-1866 (lines=14) @@
1850
     * @internal param $string [optional] $screenName    Specfies the ID of the user for whom to return results for. Helpful for disambiguating when a valid user ID is also a valid screen name.
1851
     * @internal param $string [optional] $cursor    Breaks the results into pages. This is recommended for users who are following many users. Provide a value of -1  to begin paging. Provide values as returned to in the response body's next_cursor  and previous_cursor attributes to page back and forth in the list.
1852
     */
1853
    public function friendsIds($id = null, $userId = null, $screenName = null, $cursor = null)
1854
    {
1855
        // validate
1856
        if ($id == '' && $userId == '' && $screenName == '') throw new TwitterException('Specify an id or an userId or a screenName.');
1857
1858
        // build parameters
1859
        if ($id != null) $parameters['id'] = (string)$id;
1860
        if ($userId != null) $parameters['user_id'] = (string)$userId;
1861
        if ($screenName != null) $parameters['screen_name'] = (string)$screenName;
1862
        if ($cursor != null) $parameters['cursor'] = (string)$cursor;
1863
1864
        // make the call
1865
        return (array)$this->doCall('friends/ids.json', $parameters);
1866
    }
1867
1868
    /**
1869
     * Returns an array of numeric IDs for every user following the specified user.
@@ 1883-1896 (lines=14) @@
1880
     * @internal param $string [optional] $screenName    Specfies the ID of the user for whom to return results for. Helpful for disambiguating when a valid user ID is also a valid screen name.
1881
     * @internal param $string [optional] $cursor    Breaks the results into pages. This is recommended for users who are following many users. Provide a value of -1  to begin paging. Provide values as returned to in the response body's next_cursor  and previous_cursor attributes to page back and forth in the list.
1882
     */
1883
    public function followersIds($id = null, $userId = null, $screenName = null, $cursor = null)
1884
    {
1885
        // validate
1886
        if ($id == '' && $userId == '' && $screenName == '') throw new TwitterException('Specify an id or an userId or a screenName.');
1887
1888
        // build parameters
1889
        if ($id != null) $parameters['id'] = (string)$id;
1890
        if ($userId != null) $parameters['user_id'] = (string)$userId;
1891
        if ($screenName != null) $parameters['screen_name'] = (string)$screenName;
1892
        if ($cursor != null) $parameters['cursor'] = (string)$cursor;
1893
1894
        // make the call
1895
        return (array)$this->doCall('followers/ids.json', $parameters);
1896
    }
1897
1898
1899
    // Account resources