Code Duplication    Length = 14-15 lines in 2 locations

src/Pulse.php 1 location

@@ 503-517 (lines=15) @@
500
     *
501
     * @throws HttpException Subscribing a user failed; access the exception for more information.
502
     */
503
    public function addSubscriber ($user_id, $as_admin = null)
504
    {
505
        if ($user_id instanceof PulseUser)
506
        {
507
            $user_id = $user_id->getId();
508
        }
509
510
        $url = sprintf("%s/%d/subscribers.json", parent::apiEndpoint(), $this->getId());
511
        $params = array(
512
            "user_id" => $user_id
513
        );
514
515
        parent::setIfNotNullOrEmpty($params, "as_admin", $as_admin);
516
        parent::sendPut($url, $params);
517
    }
518
519
    /**
520
     * Access a pulse's subscribers

src/PulseUpdate.php 1 location

@@ 289-302 (lines=14) @@
286
     * @param int|PulseUser $user The user that will be liking/un-liking the update
287
     * @param bool          $like True to like the update, false to unlike
288
     */
289
    private function likeUnlikeUpdate ($user, $like)
290
    {
291
        if ($user instanceof PulseUser)
292
        {
293
            $user = $user->getId();
294
        }
295
296
        $url = sprintf("%s/%d/%s.json", self::apiEndpoint(), $this->getId(), (($like) ? "like" : "unlike"));
297
        $params = array(
298
            "user" => $user
299
        );
300
301
        self::sendPost($url, $params);
302
    }
303
304
    // =================================================================================================================
305
    //   PulseUpdate functions