Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 3
CRAP
0.00% covered (danger)
0.00%
0 / 1
Presence
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 3
12
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
 get
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 history
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2namespace Ably;
3
4use Ably\Models\PaginatedResult;
5
6class Presence {
7
8    private $ably;
9    private $channel;
10
11    /**
12     * Constructor
13     * @param AblyRest $ably Ably API instance
14     * @param Channel $channel Associated channel
15     */
16    public function __construct( AblyRest $ably, Channel $channel ) {
17        $this->ably = $ably;
18        $this->channel = $channel;
19    }
20
21    /**
22     * Retrieves channel's presence data
23     * @param array $params Parameters to be sent with the request
24     * @return PaginatedResult
25     */
26    public function get( $params = [] ) {
27        return new PaginatedResult( $this->ably, 'Ably\Models\PresenceMessage', $this->channel->getCipherParams(), 'GET', $this->channel->getPath() . '/presence', $params );
28    }
29
30    /**
31     * Retrieves channel's history of presence data
32     * @param array $params Parameters to be sent with the request
33     * @return PaginatedResult
34     */
35    public function history( $params = [] ) {
36        return new PaginatedResult( $this->ably, 'Ably\Models\PresenceMessage', $this->channel->getCipherParams(), 'GET', $this->channel->getPath() . '/presence/history', $params );
37    }
38}