Project

General

Profile

1
<?php
2

    
3
/**
4
 * Generic class for Server agent.
5
 *
6
 * @package thrift.transport
7
 */
8
abstract class TServerTransport {
9
  /**
10
   * List for new clients
11
   *
12
   * @abstract
13
   * @return void
14
   */
15
  abstract public function listen();
16

    
17
  /**
18
   * Close the server
19
   *
20
   * @abstract
21
   * @return void
22
   */
23
  abstract public function close();
24

    
25
  /**
26
   * Subclasses should use this to implement
27
   * accept.
28
   *
29
   * @abstract
30
   * @return TTransport
31
   */
32
  protected abstract function acceptImpl();
33

    
34
  /**
35
   * Uses the accept implemtation. If null is returned, an
36
   * exception is thrown.
37
   *
38
   * @throws TTransportException
39
   * @return TTransport
40
   */
41
  public function accept() {
42
    $transport = $this->acceptImpl();
43

    
44
    if ($transport == null) {
45
      throw new TTransportException("accept() may not return NULL");
46
    }
47
    
48
    return $transport;
49
  }
50
}
(8-8/12)