From 5197f31b5f6e39dacebd4995d08abdfc174f5304 Mon Sep 17 00:00:00 2001
From: Josh <NGUTustin@gmail.com>
Date: Sat, 29 Sep 2018 16:29:17 -0500
Subject: [PATCH] examples and some changes

---
 examples/User.php | 26 ++++++++++++++++++++++++++
 src/Api/User.php  | 19 ++++++++++++-------
 src/Client.php    |  4 ++--
 3 files changed, 40 insertions(+), 9 deletions(-)
 create mode 100644 examples/User.php

diff --git a/examples/User.php b/examples/User.php
new file mode 100644
index 0000000..98b5eda
--- /dev/null
+++ b/examples/User.php
@@ -0,0 +1,26 @@
+<?php
+require_once "../vendor/autoload.php";
+
+use PlayStation\Client;
+
+$client = new Client(["verify" => false, "proxy" => "127.0.0.1:8888"]);
+
+$client->login(getenv("PSN_PHP_TOKEN"));
+
+$me = $client->user();
+
+echo sprintf("%s\n", $me->onlineId());
+echo sprintf("\tAbout me: %s\n", $me->aboutMe());
+echo sprintf("\tAvatar: %s\n", $me->avatarUrl());
+echo sprintf("\tFriends with? %d\n", $me->friend());
+echo sprintf("\tClose friends with? %d\n", $me->closeFriend());
+echo sprintf("\tVerified? %d\n", $me->verified());
+
+$you = $client->user("Hakoom");
+
+echo sprintf("%s\n", $you->onlineId());
+echo sprintf("\tAbout me: %s\n", $you->aboutMe());
+echo sprintf("\tAvatar: %s\n", $you->avatarUrl());
+echo sprintf("\tFriends with? %d\n", $you->friend());
+echo sprintf("\tClose friends with? %d\n", $you->closeFriend());
+echo sprintf("\tVerified? %d\n", $you->verified());
\ No newline at end of file
diff --git a/src/Api/User.php b/src/Api/User.php
index 35b4bc3..2efa2d5 100644
--- a/src/Api/User.php
+++ b/src/Api/User.php
@@ -136,12 +136,14 @@ public function closeFriend() : bool
     /**
      * Add the User to friends list.
      *
+     *  Will not do anything if called on the logged in user.
+     * 
      * @param string $requestMessage Message to send with the request.
      * @return void
      */
     public function add(string $requestMessage = null) : void
     {
-        if ($this->onlineId() === null) return;
+        if ($this->onlineIdParameter() === 'me') return;
 
         $data = ($requestMessage === null) ? new \stdClass() : [
             "requestMessage" => $requestMessage
@@ -153,11 +155,13 @@ public function add(string $requestMessage = null) : void
     /**
      * Remove the User from friends list.
      *
+     *  Will not do anything if called on the logged in user.
+     * 
      * @return void
      */
     public function remove() : void
     {
-        if ($this->onlineId() === null) return;
+        if ($this->onlineIdParameter() === 'me') return;
 
         $this->delete(sprintf(self::USERS_ENDPOINT . 'friendList/%s', $this->client->onlineId(), $this->onlineId()));
     }
@@ -169,19 +173,21 @@ public function remove() : void
      */
     public function block() : void
     {
-        if ($this->onlineId() === null) return;
+        if ($this->onlineIdParameter() === 'me') return;
 
         $this->post(sprintf(self::USERS_ENDPOINT . 'blockList/%s', $this->client->onlineId(), $this->onlineId()), null);
     }
 
     /**
      * Unblock the User.
+     * 
+     * Will not do anything if called on the logged in user.
      *
      * @return void
      */
     public function unblock() : void
     {
-        if ($this->onlineId() === null) return;
+        if ($this->onlineIdParameter() === 'me') return;
 
         $this->delete(sprintf(self::USERS_ENDPOINT . 'blockList/%s', $this->client->onlineId(), $this->onlineId()));
     }
@@ -189,11 +195,10 @@ public function unblock() : void
     /**
      * Get the User's friends.
      *
-     * @param string $filter Online Filter.
      * @param integer $limit How many users to return.
      * @return array Array of Api\User.
      */
-    public function friends($filter = 'online', $limit = 36) : array
+    public function friends($limit = 36) : array
     {
         $result = [];
 
@@ -411,7 +416,7 @@ public function communities() : array
      */
     private function messageGroup() : ?MessageThread
     {
-        if ($this->onlineId() === null) return null;
+        if ($this->onlineIdParameter() === 'me') return null;
 
         $thread = $this->privateMessageThread();
 
diff --git a/src/Client.php b/src/Client.php
index 044a794..64ae2c0 100644
--- a/src/Client.php
+++ b/src/Client.php
@@ -32,10 +32,10 @@ class Client {
     private $refreshToken;
     private $expiresIn;
 
-    public function __construct(HttpClient $httpClient = null, array $options = [])
+    public function __construct(array $options = [])
     {
         $this->options = $options;
-        $this->httpClient = $httpClient ?? new HttpClient(new \GuzzleHttp\Client($this->options));
+        $this->httpClient = new HttpClient(new \GuzzleHttp\Client($this->options));
     }
     
     /**