Skip to content

Commit

Permalink
Correct phpDoc
Browse files Browse the repository at this point in the history
  • Loading branch information
maxailloud committed Feb 4, 2014
1 parent a3c4631 commit 888940a
Showing 1 changed file with 30 additions and 22 deletions.
52 changes: 30 additions & 22 deletions Service/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
use Pagerfanta\Exception\NotValidCurrentPageException;
use Pagerfanta\Pagerfanta;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\Security\Core\SecurityContext;
use Icap\NotificationBundle\Entity\ColorChooser;
use Symfony\Component\DependencyInjection\Container;

Expand All @@ -23,23 +22,23 @@ class Manager
protected $container;

/**
* @return Icap\NotificationBundle\Entity\Notification repository
* @return \Icap\NotificationBundle\Entity\Notification repository
*/
protected function getNotificationRepository()
{
return $this->getEntityManager()->getRepository('IcapNotificationBundle:Notification');
}

/**
* @return Icap\NotificationBundle\Entity\NotificationViewer repository
* @return \Icap\NotificationBundle\Entity\NotificationViewer repository
*/
protected function getNotificationViewerRepository()
{
return $this->getEntityManager()->getRepository('IcapNotificationBundle:NotificationViewer');
}

/**
* @return Icap\NotificationBundle\Entity\FollowerResource repository
* @return \Icap\NotificationBundle\Entity\FollowerResource repository
*/
protected function getFollowerResourceRepository()
{
Expand All @@ -49,14 +48,13 @@ protected function getFollowerResourceRepository()
/**
* Constructor
*
* @param Doctrine\ORM\EntityManager
* @param Symfony\Component\Form\FormFactory
* @param \Symfony\Component\DependencyInjection\Container $container
*/
public function __construct(Container $container)
{
$this->container = $container;
$this->em = $container->get('doctrine.orm.entity_manager');
$this->security = $container->get('security.context');
$this->em = $container->get('doctrine.orm.entity_manager');
$this->security = $container->get('security.context');
}

/**
Expand All @@ -70,7 +68,9 @@ public function getEntityManager()
/**
* Get Hash for a given object which must implement notifiable interface
*
* @param Icap\NotificationBundle\Entity\NotifiableInterface $notifiable
* @param int $resourceId
* @param string $resourceClass
*
* @return string The generated hash
*/
public function getHash($resourceId, $resourceClass)
Expand All @@ -84,7 +84,9 @@ public function getHash($resourceId, $resourceClass)
}

/**
* @param $resourceId
* @param int $resourceId
* @param string $resourceClass
*
* @return mixed
*/
public function getFollowersByResourceIdAndClass($resourceId, $resourceClass)
Expand All @@ -95,14 +97,16 @@ public function getFollowersByResourceIdAndClass($resourceId, $resourceClass)
foreach ($followerResults as $followerResult) {
array_push($followerIds, $followerResult['id']);
}

return $followerIds;
}

/**
* Create new Tag given its name
*
* @param String $name
* @return Tag the generated Tag
* @param \Icap\NotificationBundle\Entity\NotifiableInterface $notifiable
*
* @return Notification
*/
public function createNotification(NotifiableInterface $notifiable)
{
Expand Down Expand Up @@ -199,7 +203,7 @@ public function notifyUsers(Notification $notification, NotifiableInterface $not
/**
* Creates a notification and notifies the concerned users
*
* @param NotifiableInterface $notifiable
* @param NotifiableInterface $notifiable
* @return Notification
*/
public function createNotificationAndNotify(NotifiableInterface $notifiable)
Expand All @@ -213,9 +217,9 @@ public function createNotificationAndNotify(NotifiableInterface $notifiable)
/**
* Retrieves the notifications list
*
* @param int $userId
* @param int $page
* @param int $maxResult
* @param int $userId
* @param int $page
* @param int $maxResult
* @return query
*/
public function getUserNotificationsList($userId, $page = 1, $maxResult = -1)
Expand Down Expand Up @@ -269,8 +273,11 @@ protected function renderNotifications($notificationsViews)
}

/**
* @param $userId
* @param $resourceId
* @param int $userId
* @param int $resourceId
* @param string $resourceClass
*
* @return
*/
public function getFollowerResource($userId, $resourceId, $resourceClass)
{
Expand Down Expand Up @@ -325,22 +332,23 @@ public function unfollowResource($userId, $resourceId, $resourceClass)
/**
* @param $notificationViewIds
*/
public function markNotificationsAsViewed ($notificationViewIds)
public function markNotificationsAsViewed($notificationViewIds)
{
if (!empty($notificationViewIds)) {
$this->getNotificationViewerRepository()->markAsViewed($notificationViewIds);
}
}

/**
* @param null $viewerId
* @param null $viewerId
* @return int
*/
public function countUnviewedNotifications ($viewerId = null)
public function countUnviewedNotifications($viewerId = null)
{
if (empty($viewerId)) {
$viewerId = $this->security->getToken()->getUser()->getId();
}

return intval($this->getNotificationViewerRepository()->countUnviewedNotifications($viewerId)["total"]);
}
}
}

0 comments on commit 888940a

Please sign in to comment.