Whitespace police
Remove unnecessary trailing whitespace
This commit is contained in:
parent
c5dceb9a6f
commit
1ab993edaf
|
@ -30,7 +30,7 @@ class User
|
||||||
* @ORM\Column(name="login", type="string", length=255)
|
* @ORM\Column(name="login", type="string", length=255)
|
||||||
*/
|
*/
|
||||||
private $login;
|
private $login;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*
|
*
|
||||||
|
@ -51,14 +51,14 @@ class User
|
||||||
* @ORM\OneToMany(targetEntity="Subscription", mappedBy="subscriber")
|
* @ORM\OneToMany(targetEntity="Subscription", mappedBy="subscriber")
|
||||||
*/
|
*/
|
||||||
private $subscriptions;
|
private $subscriptions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var ArrayCollection
|
* @var ArrayCollection
|
||||||
*
|
*
|
||||||
* @ORM\OneToMany(targetEntity="SubscriptionEvent", mappedBy="subscriber")
|
* @ORM\OneToMany(targetEntity="SubscriptionEvent", mappedBy="subscriber")
|
||||||
*/
|
*/
|
||||||
private $newSubscriptionEvents;
|
private $newSubscriptionEvents;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var ArrayCollection
|
* @var ArrayCollection
|
||||||
* @ORM\OneToMany(targetEntity="SubscriptionEvent", mappedBy="author")
|
* @ORM\OneToMany(targetEntity="SubscriptionEvent", mappedBy="author")
|
||||||
|
@ -83,20 +83,20 @@ class User
|
||||||
{
|
{
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set id of user (for API services only)
|
* Set id of user (for API services only)
|
||||||
*
|
*
|
||||||
* @param integer $id
|
* @param integer $id
|
||||||
* @return User
|
* @return User
|
||||||
*/
|
*/
|
||||||
public function setId($id)
|
public function setId($id)
|
||||||
{
|
{
|
||||||
$this->id = $id;
|
$this->id = $id;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set login
|
* Set login
|
||||||
*
|
*
|
||||||
|
@ -169,7 +169,7 @@ class User
|
||||||
/**
|
/**
|
||||||
* Get subscribers
|
* Get subscribers
|
||||||
*
|
*
|
||||||
* @return ArrayCollection
|
* @return ArrayCollection
|
||||||
*/
|
*/
|
||||||
public function getSubscribers()
|
public function getSubscribers()
|
||||||
{
|
{
|
||||||
|
@ -202,7 +202,7 @@ class User
|
||||||
/**
|
/**
|
||||||
* Get subscriptions
|
* Get subscriptions
|
||||||
*
|
*
|
||||||
* @return ArrayCollection
|
* @return ArrayCollection
|
||||||
*/
|
*/
|
||||||
public function getSubscriptions()
|
public function getSubscriptions()
|
||||||
{
|
{
|
||||||
|
@ -268,7 +268,7 @@ class User
|
||||||
/**
|
/**
|
||||||
* Get newSubscriberEvents
|
* Get newSubscriberEvents
|
||||||
*
|
*
|
||||||
* @return ArrayCollection
|
* @return ArrayCollection
|
||||||
*/
|
*/
|
||||||
public function getNewSubscriberEvents()
|
public function getNewSubscriberEvents()
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,7 +4,7 @@ services:
|
||||||
arguments: [ "http://point.im/" ]
|
arguments: [ "http://point.im/" ]
|
||||||
tags:
|
tags:
|
||||||
- { name: guzzle.client }
|
- { name: guzzle.client }
|
||||||
|
|
||||||
skobkin_point_tools.api_user:
|
skobkin_point_tools.api_user:
|
||||||
class: Skobkin\Bundle\PointToolsBundle\UserApi
|
class: Skobkin\Bundle\PointToolsBundle\UserApi
|
||||||
arguments: [ @skobkin_point_tools.http_client ]
|
arguments: [ @skobkin_point_tools.http_client ]
|
||||||
|
|
|
@ -13,15 +13,15 @@ class AbstractApi
|
||||||
* @var Client HTTP-client from Guzzle
|
* @var Client HTTP-client from Guzzle
|
||||||
*/
|
*/
|
||||||
protected $client;
|
protected $client;
|
||||||
|
|
||||||
public function __construct($httpClient)
|
public function __construct($httpClient)
|
||||||
{
|
{
|
||||||
$this->client = $httpClient;
|
$this->client = $httpClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make GET request and return Response object
|
* Make GET request and return Response object
|
||||||
*
|
*
|
||||||
* @param string $pathTemplate
|
* @param string $pathTemplate
|
||||||
* @param array $parameters
|
* @param array $parameters
|
||||||
* @return GuzzleResponse
|
* @return GuzzleResponse
|
||||||
|
@ -29,9 +29,9 @@ class AbstractApi
|
||||||
public function sendGetRequest($pathTemplate, array $parameters = [])
|
public function sendGetRequest($pathTemplate, array $parameters = [])
|
||||||
{
|
{
|
||||||
$path = vsprintf($pathTemplate, $parameters);
|
$path = vsprintf($pathTemplate, $parameters);
|
||||||
|
|
||||||
$request = $this->client->get($path);
|
$request = $this->client->get($path);
|
||||||
|
|
||||||
return $request->send();
|
return $request->send();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,45 +12,45 @@ class UserApi extends AbstractApi
|
||||||
const PATH_USER_INFO = '/api/user/%s';
|
const PATH_USER_INFO = '/api/user/%s';
|
||||||
const PATH_USER_SUBSCRIPTIONS = '/api/user/%s/subscriptions';
|
const PATH_USER_SUBSCRIPTIONS = '/api/user/%s/subscriptions';
|
||||||
const PATH_USER_SUBSCRIBERS = '/api/user/%s/subscribers';
|
const PATH_USER_SUBSCRIBERS = '/api/user/%s/subscribers';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string Base URL for user avatars
|
* @var string Base URL for user avatars
|
||||||
*/
|
*/
|
||||||
protected $avatarsBaseUrl = '//i.point.im/a/';
|
protected $avatarsBaseUrl = '//i.point.im/a/';
|
||||||
|
|
||||||
public function getName()
|
public function getName()
|
||||||
{
|
{
|
||||||
return 'skobkin_point_tools_api_user';
|
return 'skobkin_point_tools_api_user';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get user subscribers by his/her name
|
* Get user subscribers by his/her name
|
||||||
*
|
*
|
||||||
* @param string $login
|
* @param string $login
|
||||||
* @return User[]
|
* @return User[]
|
||||||
*/
|
*/
|
||||||
public function getUserSubscribersByLogin($login)
|
public function getUserSubscribersByLogin($login)
|
||||||
{
|
{
|
||||||
$response = $this->sendGetRequest(self::PATH_USER_SUBSCRIBERS, [$login]);
|
$response = $this->sendGetRequest(self::PATH_USER_SUBSCRIBERS, [$login]);
|
||||||
|
|
||||||
$body = $response->getBody(true);
|
$body = $response->getBody(true);
|
||||||
|
|
||||||
// @todo use JMSSerializer
|
// @todo use JMSSerializer
|
||||||
$data = json_decode($body);
|
$data = json_decode($body);
|
||||||
|
|
||||||
$users = [];
|
$users = [];
|
||||||
|
|
||||||
if (is_array($data)) {
|
if (is_array($data)) {
|
||||||
foreach ($data as $apiUser) {
|
foreach ($data as $apiUser) {
|
||||||
$user = new User();
|
$user = new User();
|
||||||
$user->setId($apiUser->id);
|
$user->setId($apiUser->id);
|
||||||
$user->setLogin($apiUser->login);
|
$user->setLogin($apiUser->login);
|
||||||
$user->setName($apiUser->name);
|
$user->setName($apiUser->name);
|
||||||
|
|
||||||
$users[] = $user;
|
$users[] = $user;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $users;
|
return $users;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue