1: <?php
2: namespace Contrib\Bundle\CoverallsV1Bundle\Api;
3:
4: use Guzzle\Http\Client;
5: use Contrib\Bundle\CoverallsV1Bundle\Config\Configuration;
6:
7: /**
8: * Coveralls API client.
9: *
10: * @author Kitamura Satoshi <with.no.parachute@gmail.com>
11: */
12: abstract class CoverallsApi
13: {
14: /**
15: * Configuration.
16: *
17: * @var Contrib\Bundle\CoverallsV1Bundle\Config\Configuration
18: */
19: protected $config;
20:
21: /**
22: * HTTP client.
23: *
24: * @var \Guzzle\Http\Client
25: */
26: protected $client;
27:
28: /**
29: * Constructor.
30: *
31: * @param Configuration $config Configuration.
32: * @param \Guzzle\Http\Client $client HTTP client.
33: */
34: public function __construct(Configuration $config, Client $client = null)
35: {
36: $this->config = $config;
37: $this->client = $client;
38: }
39:
40: // accessor
41:
42: /**
43: * Return configuration.
44: *
45: * @return \Contrib\Bundle\CoverallsV1Bundle\Config\Configuration
46: */
47: public function getConfiguration()
48: {
49: return $this->config;
50: }
51:
52: /**
53: * Set HTTP client.
54: *
55: * @param \Guzzle\Http\Client $client HTTP client.
56: * @return \Contrib\Bundle\CoverallsV1Bundle\Api\CoverallsApi
57: */
58: public function setHttpClient(Client $client)
59: {
60: $this->client = $client;
61:
62: return $this;
63: }
64:
65: /**
66: * Return HTTP client.
67: *
68: * @return \Guzzle\Http\Client
69: */
70: public function getHttpClient()
71: {
72: return $this->client;
73: }
74: }
75: