Whitespace police

Remove unnecessary trailing whitespace
This commit is contained in:
Dmitri Vereshchagin 2015-03-27 22:49:21 +03:00
parent c5dceb9a6f
commit 1ab993edaf
4 changed files with 28 additions and 28 deletions

View File

@ -30,7 +30,7 @@ class User
* @ORM\Column(name="login", type="string", length=255)
*/
private $login;
/**
* @var string
*
@ -51,14 +51,14 @@ class User
* @ORM\OneToMany(targetEntity="Subscription", mappedBy="subscriber")
*/
private $subscriptions;
/**
* @var ArrayCollection
*
*
* @ORM\OneToMany(targetEntity="SubscriptionEvent", mappedBy="subscriber")
*/
private $newSubscriptionEvents;
/**
* @var ArrayCollection
* @ORM\OneToMany(targetEntity="SubscriptionEvent", mappedBy="author")
@ -83,20 +83,20 @@ class User
{
return $this->id;
}
/**
* Set id of user (for API services only)
*
*
* @param integer $id
* @return User
*/
public function setId($id)
{
$this->id = $id;
return $this;
}
/**
* Set login
*
@ -169,7 +169,7 @@ class User
/**
* Get subscribers
*
* @return ArrayCollection
* @return ArrayCollection
*/
public function getSubscribers()
{
@ -202,7 +202,7 @@ class User
/**
* Get subscriptions
*
* @return ArrayCollection
* @return ArrayCollection
*/
public function getSubscriptions()
{
@ -268,7 +268,7 @@ class User
/**
* Get newSubscriberEvents
*
* @return ArrayCollection
* @return ArrayCollection
*/
public function getNewSubscriberEvents()
{

View File

@ -4,7 +4,7 @@ services:
arguments: [ "http://point.im/" ]
tags:
- { name: guzzle.client }
skobkin_point_tools.api_user:
class: Skobkin\Bundle\PointToolsBundle\UserApi
arguments: [ @skobkin_point_tools.http_client ]
arguments: [ @skobkin_point_tools.http_client ]

View File

@ -13,15 +13,15 @@ class AbstractApi
* @var Client HTTP-client from Guzzle
*/
protected $client;
public function __construct($httpClient)
{
$this->client = $httpClient;
}
/**
* Make GET request and return Response object
*
*
* @param string $pathTemplate
* @param array $parameters
* @return GuzzleResponse
@ -29,9 +29,9 @@ class AbstractApi
public function sendGetRequest($pathTemplate, array $parameters = [])
{
$path = vsprintf($pathTemplate, $parameters);
$request = $this->client->get($path);
return $request->send();
}
}

View File

@ -12,45 +12,45 @@ class UserApi extends AbstractApi
const PATH_USER_INFO = '/api/user/%s';
const PATH_USER_SUBSCRIPTIONS = '/api/user/%s/subscriptions';
const PATH_USER_SUBSCRIBERS = '/api/user/%s/subscribers';
/**
* @var string Base URL for user avatars
*/
protected $avatarsBaseUrl = '//i.point.im/a/';
public function getName()
{
return 'skobkin_point_tools_api_user';
}
/**
* Get user subscribers by his/her name
*
*
* @param string $login
* @return User[]
*/
public function getUserSubscribersByLogin($login)
{
$response = $this->sendGetRequest(self::PATH_USER_SUBSCRIBERS, [$login]);
$body = $response->getBody(true);
// @todo use JMSSerializer
$data = json_decode($body);
$users = [];
if (is_array($data)) {
foreach ($data as $apiUser) {
$user = new User();
$user->setId($apiUser->id);
$user->setLogin($apiUser->login);
$user->setName($apiUser->name);
$users[] = $user;
}
}
return $users;
}
}