@@ -28,17 +28,17 @@ |
||
28 | 28 | class BsdTest extends TestCase |
29 | 29 | { |
30 | 30 | |
31 | - public function testGetBSDs() |
|
32 | - { |
|
33 | - $mock = $this->createMock(ApiInterface::class); |
|
34 | - $mock |
|
35 | - ->expects($this->once()) |
|
36 | - ->method('get') |
|
37 | - ->with( |
|
38 | - $this->equalTo('https://api-ssl.bitly.com/v4/bsds') |
|
39 | - ); |
|
40 | - $bitlink = new Bsd($mock); |
|
41 | - $bitlink->getBSDs(); |
|
42 | - } |
|
31 | + public function testGetBSDs() |
|
32 | + { |
|
33 | + $mock = $this->createMock(ApiInterface::class); |
|
34 | + $mock |
|
35 | + ->expects($this->once()) |
|
36 | + ->method('get') |
|
37 | + ->with( |
|
38 | + $this->equalTo('https://api-ssl.bitly.com/v4/bsds') |
|
39 | + ); |
|
40 | + $bitlink = new Bsd($mock); |
|
41 | + $bitlink->getBSDs(); |
|
42 | + } |
|
43 | 43 | |
44 | 44 | } |
@@ -28,114 +28,114 @@ |
||
28 | 28 | class CampaignTest extends TestCase |
29 | 29 | { |
30 | 30 | |
31 | - public function testCreateChannel() |
|
32 | - { |
|
33 | - $mock = $this->createMock(ApiInterface::class); |
|
34 | - $mock |
|
35 | - ->expects($this->once()) |
|
36 | - ->method('post') |
|
37 | - ->with( |
|
38 | - $this->equalTo('https://api-ssl.bitly.com/v4/channels'), |
|
39 | - $this->identicalTo(['key' => 'value']) |
|
40 | - ); |
|
41 | - $bitlink = new Campaign($mock); |
|
42 | - $bitlink->createChannel(['key' => 'value']); |
|
43 | - } |
|
31 | + public function testCreateChannel() |
|
32 | + { |
|
33 | + $mock = $this->createMock(ApiInterface::class); |
|
34 | + $mock |
|
35 | + ->expects($this->once()) |
|
36 | + ->method('post') |
|
37 | + ->with( |
|
38 | + $this->equalTo('https://api-ssl.bitly.com/v4/channels'), |
|
39 | + $this->identicalTo(['key' => 'value']) |
|
40 | + ); |
|
41 | + $bitlink = new Campaign($mock); |
|
42 | + $bitlink->createChannel(['key' => 'value']); |
|
43 | + } |
|
44 | 44 | |
45 | - public function testGetChannels() |
|
46 | - { |
|
47 | - $mock = $this->createMock(ApiInterface::class); |
|
48 | - $mock |
|
49 | - ->expects($this->once()) |
|
50 | - ->method('get') |
|
51 | - ->with( |
|
52 | - $this->equalTo('https://api-ssl.bitly.com/v4/channels'), |
|
53 | - $this->identicalTo(['key' => 'value']) |
|
54 | - ); |
|
55 | - $bitlink = new Campaign($mock); |
|
56 | - $bitlink->getChannels(['key' => 'value']); |
|
57 | - } |
|
45 | + public function testGetChannels() |
|
46 | + { |
|
47 | + $mock = $this->createMock(ApiInterface::class); |
|
48 | + $mock |
|
49 | + ->expects($this->once()) |
|
50 | + ->method('get') |
|
51 | + ->with( |
|
52 | + $this->equalTo('https://api-ssl.bitly.com/v4/channels'), |
|
53 | + $this->identicalTo(['key' => 'value']) |
|
54 | + ); |
|
55 | + $bitlink = new Campaign($mock); |
|
56 | + $bitlink->getChannels(['key' => 'value']); |
|
57 | + } |
|
58 | 58 | |
59 | - public function testCreateCampaign() |
|
60 | - { |
|
61 | - $mock = $this->createMock(ApiInterface::class); |
|
62 | - $mock |
|
63 | - ->expects($this->once()) |
|
64 | - ->method('post') |
|
65 | - ->with( |
|
66 | - $this->equalTo('https://api-ssl.bitly.com/v4/campaigns'), |
|
67 | - $this->identicalTo(['key' => 'value']) |
|
68 | - ); |
|
69 | - $bitlink = new Campaign($mock); |
|
70 | - $bitlink->createCampaign(['key' => 'value']); |
|
71 | - } |
|
59 | + public function testCreateCampaign() |
|
60 | + { |
|
61 | + $mock = $this->createMock(ApiInterface::class); |
|
62 | + $mock |
|
63 | + ->expects($this->once()) |
|
64 | + ->method('post') |
|
65 | + ->with( |
|
66 | + $this->equalTo('https://api-ssl.bitly.com/v4/campaigns'), |
|
67 | + $this->identicalTo(['key' => 'value']) |
|
68 | + ); |
|
69 | + $bitlink = new Campaign($mock); |
|
70 | + $bitlink->createCampaign(['key' => 'value']); |
|
71 | + } |
|
72 | 72 | |
73 | - public function testGetCampaigns() |
|
74 | - { |
|
75 | - $mock = $this->createMock(ApiInterface::class); |
|
76 | - $mock |
|
77 | - ->expects($this->once()) |
|
78 | - ->method('get') |
|
79 | - ->with( |
|
80 | - $this->equalTo('https://api-ssl.bitly.com/v4/campaigns'), |
|
81 | - $this->identicalTo(['key' => 'value']) |
|
82 | - ); |
|
83 | - $bitlink = new Campaign($mock); |
|
84 | - $bitlink->getCampaigns(['key' => 'value']); |
|
85 | - } |
|
73 | + public function testGetCampaigns() |
|
74 | + { |
|
75 | + $mock = $this->createMock(ApiInterface::class); |
|
76 | + $mock |
|
77 | + ->expects($this->once()) |
|
78 | + ->method('get') |
|
79 | + ->with( |
|
80 | + $this->equalTo('https://api-ssl.bitly.com/v4/campaigns'), |
|
81 | + $this->identicalTo(['key' => 'value']) |
|
82 | + ); |
|
83 | + $bitlink = new Campaign($mock); |
|
84 | + $bitlink->getCampaigns(['key' => 'value']); |
|
85 | + } |
|
86 | 86 | |
87 | - public function testGetCampaign() |
|
88 | - { |
|
89 | - $mock = $this->createMock(ApiInterface::class); |
|
90 | - $mock |
|
91 | - ->expects($this->once()) |
|
92 | - ->method('get') |
|
93 | - ->with( |
|
94 | - $this->equalTo('https://api-ssl.bitly.com/v4/campaigns/test') |
|
95 | - ); |
|
96 | - $bitlink = new Campaign($mock); |
|
97 | - $bitlink->getCampaign('test'); |
|
98 | - } |
|
87 | + public function testGetCampaign() |
|
88 | + { |
|
89 | + $mock = $this->createMock(ApiInterface::class); |
|
90 | + $mock |
|
91 | + ->expects($this->once()) |
|
92 | + ->method('get') |
|
93 | + ->with( |
|
94 | + $this->equalTo('https://api-ssl.bitly.com/v4/campaigns/test') |
|
95 | + ); |
|
96 | + $bitlink = new Campaign($mock); |
|
97 | + $bitlink->getCampaign('test'); |
|
98 | + } |
|
99 | 99 | |
100 | - public function testUpdateCampaign() |
|
101 | - { |
|
102 | - $mock = $this->createMock(ApiInterface::class); |
|
103 | - $mock |
|
104 | - ->expects($this->once()) |
|
105 | - ->method('patch') |
|
106 | - ->with( |
|
107 | - $this->equalTo('https://api-ssl.bitly.com/v4/campaigns/test'), |
|
108 | - $this->identicalTo(['key' => 'value']) |
|
109 | - ); |
|
110 | - $bitlink = new Campaign($mock); |
|
111 | - $bitlink->updateCampaign('test', ['key' => 'value']); |
|
112 | - } |
|
100 | + public function testUpdateCampaign() |
|
101 | + { |
|
102 | + $mock = $this->createMock(ApiInterface::class); |
|
103 | + $mock |
|
104 | + ->expects($this->once()) |
|
105 | + ->method('patch') |
|
106 | + ->with( |
|
107 | + $this->equalTo('https://api-ssl.bitly.com/v4/campaigns/test'), |
|
108 | + $this->identicalTo(['key' => 'value']) |
|
109 | + ); |
|
110 | + $bitlink = new Campaign($mock); |
|
111 | + $bitlink->updateCampaign('test', ['key' => 'value']); |
|
112 | + } |
|
113 | 113 | |
114 | - public function testGetChannel() |
|
115 | - { |
|
116 | - $mock = $this->createMock(ApiInterface::class); |
|
117 | - $mock |
|
118 | - ->expects($this->once()) |
|
119 | - ->method('get') |
|
120 | - ->with( |
|
121 | - $this->equalTo('https://api-ssl.bitly.com/v4/channels/test') |
|
122 | - ); |
|
123 | - $bitlink = new Campaign($mock); |
|
124 | - $bitlink->getChannel('test'); |
|
125 | - } |
|
114 | + public function testGetChannel() |
|
115 | + { |
|
116 | + $mock = $this->createMock(ApiInterface::class); |
|
117 | + $mock |
|
118 | + ->expects($this->once()) |
|
119 | + ->method('get') |
|
120 | + ->with( |
|
121 | + $this->equalTo('https://api-ssl.bitly.com/v4/channels/test') |
|
122 | + ); |
|
123 | + $bitlink = new Campaign($mock); |
|
124 | + $bitlink->getChannel('test'); |
|
125 | + } |
|
126 | 126 | |
127 | - public function testUpdateChannel() |
|
128 | - { |
|
129 | - $mock = $this->createMock(ApiInterface::class); |
|
130 | - $mock |
|
131 | - ->expects($this->once()) |
|
132 | - ->method('patch') |
|
133 | - ->with( |
|
134 | - $this->equalTo('https://api-ssl.bitly.com/v4/channels/test'), |
|
135 | - $this->identicalTo(['key' => 'value']) |
|
136 | - ); |
|
137 | - $bitlink = new Campaign($mock); |
|
138 | - $bitlink->updateChannel('test', ['key' => 'value']); |
|
139 | - } |
|
127 | + public function testUpdateChannel() |
|
128 | + { |
|
129 | + $mock = $this->createMock(ApiInterface::class); |
|
130 | + $mock |
|
131 | + ->expects($this->once()) |
|
132 | + ->method('patch') |
|
133 | + ->with( |
|
134 | + $this->equalTo('https://api-ssl.bitly.com/v4/channels/test'), |
|
135 | + $this->identicalTo(['key' => 'value']) |
|
136 | + ); |
|
137 | + $bitlink = new Campaign($mock); |
|
138 | + $bitlink->updateChannel('test', ['key' => 'value']); |
|
139 | + } |
|
140 | 140 | |
141 | 141 | } |
@@ -28,17 +28,17 @@ |
||
28 | 28 | class AppTest extends TestCase |
29 | 29 | { |
30 | 30 | |
31 | - public function testGetOAuthApp() |
|
32 | - { |
|
33 | - $mock = $this->createMock(ApiInterface::class); |
|
34 | - $mock |
|
35 | - ->expects($this->once()) |
|
36 | - ->method('get') |
|
37 | - ->with( |
|
38 | - $this->equalTo('https://api-ssl.bitly.com/v4/apps/test') |
|
39 | - ); |
|
40 | - $bitlink = new App($mock); |
|
41 | - $bitlink->getOAuthApp('test'); |
|
42 | - } |
|
31 | + public function testGetOAuthApp() |
|
32 | + { |
|
33 | + $mock = $this->createMock(ApiInterface::class); |
|
34 | + $mock |
|
35 | + ->expects($this->once()) |
|
36 | + ->method('get') |
|
37 | + ->with( |
|
38 | + $this->equalTo('https://api-ssl.bitly.com/v4/apps/test') |
|
39 | + ); |
|
40 | + $bitlink = new App($mock); |
|
41 | + $bitlink->getOAuthApp('test'); |
|
42 | + } |
|
43 | 43 | |
44 | 44 | } |
@@ -28,58 +28,58 @@ |
||
28 | 28 | class CustomTest extends TestCase |
29 | 29 | { |
30 | 30 | |
31 | - public function testUpdateCustomBitlink() |
|
32 | - { |
|
33 | - $mock = $this->createMock(ApiInterface::class); |
|
34 | - $mock |
|
35 | - ->expects($this->once()) |
|
36 | - ->method('patch') |
|
37 | - ->with( |
|
38 | - $this->equalTo('https://api-ssl.bitly.com/v4/custom_bitlinks/test'), |
|
39 | - $this->identicalTo(['key' => 'value']) |
|
40 | - ); |
|
41 | - $bitlink = new Custom($mock); |
|
42 | - $bitlink->updateCustomBitlink('test', ['key' => 'value']); |
|
43 | - } |
|
31 | + public function testUpdateCustomBitlink() |
|
32 | + { |
|
33 | + $mock = $this->createMock(ApiInterface::class); |
|
34 | + $mock |
|
35 | + ->expects($this->once()) |
|
36 | + ->method('patch') |
|
37 | + ->with( |
|
38 | + $this->equalTo('https://api-ssl.bitly.com/v4/custom_bitlinks/test'), |
|
39 | + $this->identicalTo(['key' => 'value']) |
|
40 | + ); |
|
41 | + $bitlink = new Custom($mock); |
|
42 | + $bitlink->updateCustomBitlink('test', ['key' => 'value']); |
|
43 | + } |
|
44 | 44 | |
45 | - public function testGetCustomBitlink() |
|
46 | - { |
|
47 | - $mock = $this->createMock(ApiInterface::class); |
|
48 | - $mock |
|
49 | - ->expects($this->once()) |
|
50 | - ->method('get') |
|
51 | - ->with( |
|
52 | - $this->equalTo('https://api-ssl.bitly.com/v4/custom_bitlinks/test') |
|
53 | - ); |
|
54 | - $bitlink = new Custom($mock); |
|
55 | - $bitlink->getCustomBitlink('test'); |
|
56 | - } |
|
45 | + public function testGetCustomBitlink() |
|
46 | + { |
|
47 | + $mock = $this->createMock(ApiInterface::class); |
|
48 | + $mock |
|
49 | + ->expects($this->once()) |
|
50 | + ->method('get') |
|
51 | + ->with( |
|
52 | + $this->equalTo('https://api-ssl.bitly.com/v4/custom_bitlinks/test') |
|
53 | + ); |
|
54 | + $bitlink = new Custom($mock); |
|
55 | + $bitlink->getCustomBitlink('test'); |
|
56 | + } |
|
57 | 57 | |
58 | - public function testAddCustomBitlink() |
|
59 | - { |
|
60 | - $mock = $this->createMock(ApiInterface::class); |
|
61 | - $mock |
|
62 | - ->expects($this->once()) |
|
63 | - ->method('post') |
|
64 | - ->with( |
|
65 | - $this->equalTo('https://api-ssl.bitly.com/v4/custom_bitlinks'), |
|
66 | - $this->identicalTo(['key' => 'value']) |
|
67 | - ); |
|
68 | - $bitlink = new Custom($mock); |
|
69 | - $bitlink->addCustomBitlink(['key' => 'value']); |
|
70 | - } |
|
58 | + public function testAddCustomBitlink() |
|
59 | + { |
|
60 | + $mock = $this->createMock(ApiInterface::class); |
|
61 | + $mock |
|
62 | + ->expects($this->once()) |
|
63 | + ->method('post') |
|
64 | + ->with( |
|
65 | + $this->equalTo('https://api-ssl.bitly.com/v4/custom_bitlinks'), |
|
66 | + $this->identicalTo(['key' => 'value']) |
|
67 | + ); |
|
68 | + $bitlink = new Custom($mock); |
|
69 | + $bitlink->addCustomBitlink(['key' => 'value']); |
|
70 | + } |
|
71 | 71 | |
72 | - public function testGetCustomBitlinkMetricsByDestination() |
|
73 | - { |
|
74 | - $mock = $this->createMock(ApiInterface::class); |
|
75 | - $mock |
|
76 | - ->expects($this->once()) |
|
77 | - ->method('get') |
|
78 | - ->with( |
|
79 | - $this->equalTo('https://api-ssl.bitly.com/v4/custom_bitlinks/test/clicks_by_destination') |
|
80 | - ); |
|
81 | - $bitlink = new Custom($mock); |
|
82 | - $bitlink->getCustomBitlinkMetricsByDestination('test'); |
|
83 | - } |
|
72 | + public function testGetCustomBitlinkMetricsByDestination() |
|
73 | + { |
|
74 | + $mock = $this->createMock(ApiInterface::class); |
|
75 | + $mock |
|
76 | + ->expects($this->once()) |
|
77 | + ->method('get') |
|
78 | + ->with( |
|
79 | + $this->equalTo('https://api-ssl.bitly.com/v4/custom_bitlinks/test/clicks_by_destination') |
|
80 | + ); |
|
81 | + $bitlink = new Custom($mock); |
|
82 | + $bitlink->getCustomBitlinkMetricsByDestination('test'); |
|
83 | + } |
|
84 | 84 | |
85 | 85 | } |
@@ -28,31 +28,31 @@ |
||
28 | 28 | class UserTest extends TestCase |
29 | 29 | { |
30 | 30 | |
31 | - public function testUpdateUser() |
|
32 | - { |
|
33 | - $mock = $this->createMock(ApiInterface::class); |
|
34 | - $mock |
|
35 | - ->expects($this->once()) |
|
36 | - ->method('patch') |
|
37 | - ->with( |
|
38 | - $this->equalTo('https://api-ssl.bitly.com/v4/user'), |
|
39 | - $this->identicalTo(['key' => 'value']) |
|
40 | - ); |
|
41 | - $bitlink = new User($mock); |
|
42 | - $bitlink->updateUser(['key' => 'value']); |
|
43 | - } |
|
31 | + public function testUpdateUser() |
|
32 | + { |
|
33 | + $mock = $this->createMock(ApiInterface::class); |
|
34 | + $mock |
|
35 | + ->expects($this->once()) |
|
36 | + ->method('patch') |
|
37 | + ->with( |
|
38 | + $this->equalTo('https://api-ssl.bitly.com/v4/user'), |
|
39 | + $this->identicalTo(['key' => 'value']) |
|
40 | + ); |
|
41 | + $bitlink = new User($mock); |
|
42 | + $bitlink->updateUser(['key' => 'value']); |
|
43 | + } |
|
44 | 44 | |
45 | - public function testGetUser() |
|
46 | - { |
|
47 | - $mock = $this->createMock(ApiInterface::class); |
|
48 | - $mock |
|
49 | - ->expects($this->once()) |
|
50 | - ->method('get') |
|
51 | - ->with( |
|
52 | - $this->equalTo('https://api-ssl.bitly.com/v4/user') |
|
53 | - ); |
|
54 | - $bitlink = new User($mock); |
|
55 | - $bitlink->getUser(); |
|
56 | - } |
|
45 | + public function testGetUser() |
|
46 | + { |
|
47 | + $mock = $this->createMock(ApiInterface::class); |
|
48 | + $mock |
|
49 | + ->expects($this->once()) |
|
50 | + ->method('get') |
|
51 | + ->with( |
|
52 | + $this->equalTo('https://api-ssl.bitly.com/v4/user') |
|
53 | + ); |
|
54 | + $bitlink = new User($mock); |
|
55 | + $bitlink->getUser(); |
|
56 | + } |
|
57 | 57 | |
58 | 58 | } |
@@ -28,155 +28,155 @@ |
||
28 | 28 | class BitlinkTest extends TestCase |
29 | 29 | { |
30 | 30 | |
31 | - public function testGetMetricsForBitlinkByReferrersByDomains() |
|
32 | - { |
|
33 | - $mock = $this->createMock(ApiInterface::class); |
|
34 | - $mock |
|
35 | - ->expects($this->once()) |
|
36 | - ->method('get') |
|
37 | - ->with( |
|
38 | - $this->equalTo('https://api-ssl.bitly.com/v4/bitlinks/test/referrers_by_domains'), |
|
39 | - $this->identicalTo(['key' => 'value']) |
|
40 | - ); |
|
41 | - $bitlink = new Bitlink($mock); |
|
42 | - $bitlink->getMetricsForBitlinkByReferrersByDomains('test', ['key' => 'value']); |
|
43 | - } |
|
31 | + public function testGetMetricsForBitlinkByReferrersByDomains() |
|
32 | + { |
|
33 | + $mock = $this->createMock(ApiInterface::class); |
|
34 | + $mock |
|
35 | + ->expects($this->once()) |
|
36 | + ->method('get') |
|
37 | + ->with( |
|
38 | + $this->equalTo('https://api-ssl.bitly.com/v4/bitlinks/test/referrers_by_domains'), |
|
39 | + $this->identicalTo(['key' => 'value']) |
|
40 | + ); |
|
41 | + $bitlink = new Bitlink($mock); |
|
42 | + $bitlink->getMetricsForBitlinkByReferrersByDomains('test', ['key' => 'value']); |
|
43 | + } |
|
44 | 44 | |
45 | - public function testGetMetricsForBitlinkByCountries() |
|
46 | - { |
|
47 | - $mock = $this->createMock(ApiInterface::class); |
|
48 | - $mock |
|
49 | - ->expects($this->once()) |
|
50 | - ->method('get') |
|
51 | - ->with( |
|
52 | - $this->equalTo('https://api-ssl.bitly.com/v4/bitlinks/test/countries'), |
|
53 | - $this->identicalTo(['key' => 'value']) |
|
54 | - ); |
|
55 | - $bitlink = new Bitlink($mock); |
|
56 | - $bitlink->getMetricsForBitlinkByCountries('test', ['key' => 'value']); |
|
57 | - } |
|
45 | + public function testGetMetricsForBitlinkByCountries() |
|
46 | + { |
|
47 | + $mock = $this->createMock(ApiInterface::class); |
|
48 | + $mock |
|
49 | + ->expects($this->once()) |
|
50 | + ->method('get') |
|
51 | + ->with( |
|
52 | + $this->equalTo('https://api-ssl.bitly.com/v4/bitlinks/test/countries'), |
|
53 | + $this->identicalTo(['key' => 'value']) |
|
54 | + ); |
|
55 | + $bitlink = new Bitlink($mock); |
|
56 | + $bitlink->getMetricsForBitlinkByCountries('test', ['key' => 'value']); |
|
57 | + } |
|
58 | 58 | |
59 | - public function testGetClicksForBitlink() |
|
60 | - { |
|
61 | - $mock = $this->createMock(ApiInterface::class); |
|
62 | - $mock |
|
63 | - ->expects($this->once()) |
|
64 | - ->method('get') |
|
65 | - ->with( |
|
66 | - $this->equalTo('https://api-ssl.bitly.com/v4/bitlinks/test/clicks'), |
|
67 | - $this->identicalTo(['key' => 'value']) |
|
68 | - ); |
|
69 | - $bitlink = new Bitlink($mock); |
|
70 | - $bitlink->getClicksForBitlink('test', ['key' => 'value']); |
|
71 | - } |
|
59 | + public function testGetClicksForBitlink() |
|
60 | + { |
|
61 | + $mock = $this->createMock(ApiInterface::class); |
|
62 | + $mock |
|
63 | + ->expects($this->once()) |
|
64 | + ->method('get') |
|
65 | + ->with( |
|
66 | + $this->equalTo('https://api-ssl.bitly.com/v4/bitlinks/test/clicks'), |
|
67 | + $this->identicalTo(['key' => 'value']) |
|
68 | + ); |
|
69 | + $bitlink = new Bitlink($mock); |
|
70 | + $bitlink->getClicksForBitlink('test', ['key' => 'value']); |
|
71 | + } |
|
72 | 72 | |
73 | - public function testExpandBitlink() |
|
74 | - { |
|
75 | - $mock = $this->createMock(ApiInterface::class); |
|
76 | - $mock |
|
77 | - ->expects($this->once()) |
|
78 | - ->method('post') |
|
79 | - ->with( |
|
80 | - $this->equalTo('https://api-ssl.bitly.com/v4/expand'), |
|
81 | - $this->identicalTo(['key' => 'value']) |
|
82 | - ); |
|
83 | - $bitlink = new Bitlink($mock); |
|
84 | - $bitlink->expandBitlink(['key' => 'value']); |
|
85 | - } |
|
73 | + public function testExpandBitlink() |
|
74 | + { |
|
75 | + $mock = $this->createMock(ApiInterface::class); |
|
76 | + $mock |
|
77 | + ->expects($this->once()) |
|
78 | + ->method('post') |
|
79 | + ->with( |
|
80 | + $this->equalTo('https://api-ssl.bitly.com/v4/expand'), |
|
81 | + $this->identicalTo(['key' => 'value']) |
|
82 | + ); |
|
83 | + $bitlink = new Bitlink($mock); |
|
84 | + $bitlink->expandBitlink(['key' => 'value']); |
|
85 | + } |
|
86 | 86 | |
87 | - public function testGetMetricsForBitlinkByReferrers() |
|
88 | - { |
|
89 | - $mock = $this->createMock(ApiInterface::class); |
|
90 | - $mock |
|
91 | - ->expects($this->once()) |
|
92 | - ->method('get') |
|
93 | - ->with( |
|
94 | - $this->equalTo('https://api-ssl.bitly.com/v4/bitlinks/test/referrers'), |
|
95 | - $this->identicalTo(['key' => 'value']) |
|
96 | - ); |
|
97 | - $bitlink = new Bitlink($mock); |
|
98 | - $bitlink->getMetricsForBitlinkByReferrers('test', ['key' => 'value']); |
|
99 | - } |
|
87 | + public function testGetMetricsForBitlinkByReferrers() |
|
88 | + { |
|
89 | + $mock = $this->createMock(ApiInterface::class); |
|
90 | + $mock |
|
91 | + ->expects($this->once()) |
|
92 | + ->method('get') |
|
93 | + ->with( |
|
94 | + $this->equalTo('https://api-ssl.bitly.com/v4/bitlinks/test/referrers'), |
|
95 | + $this->identicalTo(['key' => 'value']) |
|
96 | + ); |
|
97 | + $bitlink = new Bitlink($mock); |
|
98 | + $bitlink->getMetricsForBitlinkByReferrers('test', ['key' => 'value']); |
|
99 | + } |
|
100 | 100 | |
101 | - public function testCreateFullBitlink() |
|
102 | - { |
|
103 | - $mock = $this->createMock(ApiInterface::class); |
|
104 | - $mock |
|
105 | - ->expects($this->once()) |
|
106 | - ->method('post') |
|
107 | - ->with( |
|
108 | - $this->equalTo('https://api-ssl.bitly.com/v4/bitlinks'), |
|
109 | - $this->identicalTo(['key' => 'value']) |
|
110 | - ); |
|
111 | - $bitlink = new Bitlink($mock); |
|
112 | - $bitlink->createFullBitlink(['key' => 'value']); |
|
113 | - } |
|
101 | + public function testCreateFullBitlink() |
|
102 | + { |
|
103 | + $mock = $this->createMock(ApiInterface::class); |
|
104 | + $mock |
|
105 | + ->expects($this->once()) |
|
106 | + ->method('post') |
|
107 | + ->with( |
|
108 | + $this->equalTo('https://api-ssl.bitly.com/v4/bitlinks'), |
|
109 | + $this->identicalTo(['key' => 'value']) |
|
110 | + ); |
|
111 | + $bitlink = new Bitlink($mock); |
|
112 | + $bitlink->createFullBitlink(['key' => 'value']); |
|
113 | + } |
|
114 | 114 | |
115 | - public function testUpdateBitlink() |
|
116 | - { |
|
117 | - $mock = $this->createMock(ApiInterface::class); |
|
118 | - $mock |
|
119 | - ->expects($this->once()) |
|
120 | - ->method('patch') |
|
121 | - ->with( |
|
122 | - $this->equalTo('https://api-ssl.bitly.com/v4/bitlinks/test'), |
|
123 | - $this->identicalTo(['key' => 'value']) |
|
124 | - ); |
|
125 | - $bitlink = new Bitlink($mock); |
|
126 | - $bitlink->updateBitlink('test', ['key' => 'value']); |
|
127 | - } |
|
115 | + public function testUpdateBitlink() |
|
116 | + { |
|
117 | + $mock = $this->createMock(ApiInterface::class); |
|
118 | + $mock |
|
119 | + ->expects($this->once()) |
|
120 | + ->method('patch') |
|
121 | + ->with( |
|
122 | + $this->equalTo('https://api-ssl.bitly.com/v4/bitlinks/test'), |
|
123 | + $this->identicalTo(['key' => 'value']) |
|
124 | + ); |
|
125 | + $bitlink = new Bitlink($mock); |
|
126 | + $bitlink->updateBitlink('test', ['key' => 'value']); |
|
127 | + } |
|
128 | 128 | |
129 | - public function testGetBitlink() |
|
130 | - { |
|
131 | - $mock = $this->createMock(ApiInterface::class); |
|
132 | - $mock |
|
133 | - ->expects($this->once()) |
|
134 | - ->method('get') |
|
135 | - ->with($this->equalTo('https://api-ssl.bitly.com/v4/bitlinks/test')); |
|
136 | - $bitlink = new Bitlink($mock); |
|
137 | - $bitlink->getBitlink('test'); |
|
138 | - } |
|
129 | + public function testGetBitlink() |
|
130 | + { |
|
131 | + $mock = $this->createMock(ApiInterface::class); |
|
132 | + $mock |
|
133 | + ->expects($this->once()) |
|
134 | + ->method('get') |
|
135 | + ->with($this->equalTo('https://api-ssl.bitly.com/v4/bitlinks/test')); |
|
136 | + $bitlink = new Bitlink($mock); |
|
137 | + $bitlink->getBitlink('test'); |
|
138 | + } |
|
139 | 139 | |
140 | - public function testGetClicksSummaryForBitlink() |
|
141 | - { |
|
142 | - $mock = $this->createMock(ApiInterface::class); |
|
143 | - $mock |
|
144 | - ->expects($this->once()) |
|
145 | - ->method('get') |
|
146 | - ->with( |
|
147 | - $this->equalTo('https://api-ssl.bitly.com/v4/bitlinks/test/clicks/summary'), |
|
148 | - $this->identicalTo(['key' => 'value']) |
|
149 | - ); |
|
150 | - $bitlink = new Bitlink($mock); |
|
151 | - $bitlink->getClicksSummaryForBitlink('test', ['key' => 'value']); |
|
152 | - } |
|
140 | + public function testGetClicksSummaryForBitlink() |
|
141 | + { |
|
142 | + $mock = $this->createMock(ApiInterface::class); |
|
143 | + $mock |
|
144 | + ->expects($this->once()) |
|
145 | + ->method('get') |
|
146 | + ->with( |
|
147 | + $this->equalTo('https://api-ssl.bitly.com/v4/bitlinks/test/clicks/summary'), |
|
148 | + $this->identicalTo(['key' => 'value']) |
|
149 | + ); |
|
150 | + $bitlink = new Bitlink($mock); |
|
151 | + $bitlink->getClicksSummaryForBitlink('test', ['key' => 'value']); |
|
152 | + } |
|
153 | 153 | |
154 | - public function testCreateBitlink() |
|
155 | - { |
|
156 | - $mock = $this->createMock(ApiInterface::class); |
|
157 | - $mock |
|
158 | - ->expects($this->once()) |
|
159 | - ->method('post') |
|
160 | - ->with( |
|
161 | - $this->equalTo('https://api-ssl.bitly.com/v4/shorten'), |
|
162 | - $this->identicalTo(['key' => 'value']) |
|
163 | - ); |
|
164 | - $bitlink = new Bitlink($mock); |
|
165 | - $bitlink->createBitlink(['key' => 'value']); |
|
166 | - } |
|
154 | + public function testCreateBitlink() |
|
155 | + { |
|
156 | + $mock = $this->createMock(ApiInterface::class); |
|
157 | + $mock |
|
158 | + ->expects($this->once()) |
|
159 | + ->method('post') |
|
160 | + ->with( |
|
161 | + $this->equalTo('https://api-ssl.bitly.com/v4/shorten'), |
|
162 | + $this->identicalTo(['key' => 'value']) |
|
163 | + ); |
|
164 | + $bitlink = new Bitlink($mock); |
|
165 | + $bitlink->createBitlink(['key' => 'value']); |
|
166 | + } |
|
167 | 167 | |
168 | - public function testGetMetricsForBitlinkByReferringDomains() |
|
169 | - { |
|
170 | - $mock = $this->createMock(ApiInterface::class); |
|
171 | - $mock |
|
172 | - ->expects($this->once()) |
|
173 | - ->method('get') |
|
174 | - ->with( |
|
175 | - $this->equalTo('https://api-ssl.bitly.com/v4/bitlinks/test/referring_domains'), |
|
176 | - $this->identicalTo(['key' => 'value']) |
|
177 | - ); |
|
178 | - $bitlink = new Bitlink($mock); |
|
179 | - $bitlink->getMetricsForBitlinkByReferringDomains('test', ['key' => 'value']); |
|
180 | - } |
|
168 | + public function testGetMetricsForBitlinkByReferringDomains() |
|
169 | + { |
|
170 | + $mock = $this->createMock(ApiInterface::class); |
|
171 | + $mock |
|
172 | + ->expects($this->once()) |
|
173 | + ->method('get') |
|
174 | + ->with( |
|
175 | + $this->equalTo('https://api-ssl.bitly.com/v4/bitlinks/test/referring_domains'), |
|
176 | + $this->identicalTo(['key' => 'value']) |
|
177 | + ); |
|
178 | + $bitlink = new Bitlink($mock); |
|
179 | + $bitlink->getMetricsForBitlinkByReferringDomains('test', ['key' => 'value']); |
|
180 | + } |
|
181 | 181 | |
182 | 182 | } |
@@ -28,165 +28,165 @@ |
||
28 | 28 | class GroupTest extends TestCase |
29 | 29 | { |
30 | 30 | |
31 | - public function testGetGroupTags() |
|
32 | - { |
|
33 | - $mock = $this->createMock(ApiInterface::class); |
|
34 | - $mock |
|
35 | - ->expects($this->once()) |
|
36 | - ->method('get') |
|
37 | - ->with( |
|
38 | - $this->equalTo('https://api-ssl.bitly.com/v4/groups/test/tags') |
|
39 | - ); |
|
40 | - $bitlink = new Group($mock); |
|
41 | - $bitlink->getGroupTags('test'); |
|
42 | - } |
|
31 | + public function testGetGroupTags() |
|
32 | + { |
|
33 | + $mock = $this->createMock(ApiInterface::class); |
|
34 | + $mock |
|
35 | + ->expects($this->once()) |
|
36 | + ->method('get') |
|
37 | + ->with( |
|
38 | + $this->equalTo('https://api-ssl.bitly.com/v4/groups/test/tags') |
|
39 | + ); |
|
40 | + $bitlink = new Group($mock); |
|
41 | + $bitlink->getGroupTags('test'); |
|
42 | + } |
|
43 | 43 | |
44 | - public function testGetGroupMetricsByReferringNetworks() |
|
45 | - { |
|
46 | - $mock = $this->createMock(ApiInterface::class); |
|
47 | - $mock |
|
48 | - ->expects($this->once()) |
|
49 | - ->method('get') |
|
50 | - ->with( |
|
51 | - $this->equalTo('https://api-ssl.bitly.com/v4/groups/test/referring_networks') |
|
52 | - ); |
|
53 | - $bitlink = new Group($mock); |
|
54 | - $bitlink->getGroupMetricsByReferringNetworks('test'); |
|
55 | - } |
|
44 | + public function testGetGroupMetricsByReferringNetworks() |
|
45 | + { |
|
46 | + $mock = $this->createMock(ApiInterface::class); |
|
47 | + $mock |
|
48 | + ->expects($this->once()) |
|
49 | + ->method('get') |
|
50 | + ->with( |
|
51 | + $this->equalTo('https://api-ssl.bitly.com/v4/groups/test/referring_networks') |
|
52 | + ); |
|
53 | + $bitlink = new Group($mock); |
|
54 | + $bitlink->getGroupMetricsByReferringNetworks('test'); |
|
55 | + } |
|
56 | 56 | |
57 | - public function testGetGroupShortenCounts() |
|
58 | - { |
|
59 | - $mock = $this->createMock(ApiInterface::class); |
|
60 | - $mock |
|
61 | - ->expects($this->once()) |
|
62 | - ->method('get') |
|
63 | - ->with( |
|
64 | - $this->equalTo('https://api-ssl.bitly.com/v4/groups/test/shorten_counts') |
|
65 | - ); |
|
66 | - $bitlink = new Group($mock); |
|
67 | - $bitlink->getGroupShortenCounts('test'); |
|
68 | - } |
|
57 | + public function testGetGroupShortenCounts() |
|
58 | + { |
|
59 | + $mock = $this->createMock(ApiInterface::class); |
|
60 | + $mock |
|
61 | + ->expects($this->once()) |
|
62 | + ->method('get') |
|
63 | + ->with( |
|
64 | + $this->equalTo('https://api-ssl.bitly.com/v4/groups/test/shorten_counts') |
|
65 | + ); |
|
66 | + $bitlink = new Group($mock); |
|
67 | + $bitlink->getGroupShortenCounts('test'); |
|
68 | + } |
|
69 | 69 | |
70 | - public function testGetGroups() |
|
71 | - { |
|
72 | - $mock = $this->createMock(ApiInterface::class); |
|
73 | - $mock |
|
74 | - ->expects($this->once()) |
|
75 | - ->method('get') |
|
76 | - ->with( |
|
77 | - $this->equalTo('https://api-ssl.bitly.com/v4/groups'), |
|
78 | - $this->identicalTo(['key' => 'value']) |
|
79 | - ); |
|
80 | - $bitlink = new Group($mock); |
|
81 | - $bitlink->getGroups(['key' => 'value']); |
|
82 | - } |
|
70 | + public function testGetGroups() |
|
71 | + { |
|
72 | + $mock = $this->createMock(ApiInterface::class); |
|
73 | + $mock |
|
74 | + ->expects($this->once()) |
|
75 | + ->method('get') |
|
76 | + ->with( |
|
77 | + $this->equalTo('https://api-ssl.bitly.com/v4/groups'), |
|
78 | + $this->identicalTo(['key' => 'value']) |
|
79 | + ); |
|
80 | + $bitlink = new Group($mock); |
|
81 | + $bitlink->getGroups(['key' => 'value']); |
|
82 | + } |
|
83 | 83 | |
84 | - public function testGetGroupPreferences() |
|
85 | - { |
|
86 | - $mock = $this->createMock(ApiInterface::class); |
|
87 | - $mock |
|
88 | - ->expects($this->once()) |
|
89 | - ->method('get') |
|
90 | - ->with( |
|
91 | - $this->equalTo('https://api-ssl.bitly.com/v4/groups/test/preferences') |
|
92 | - ); |
|
93 | - $bitlink = new Group($mock); |
|
94 | - $bitlink->getGroupPreferences('test'); |
|
95 | - } |
|
84 | + public function testGetGroupPreferences() |
|
85 | + { |
|
86 | + $mock = $this->createMock(ApiInterface::class); |
|
87 | + $mock |
|
88 | + ->expects($this->once()) |
|
89 | + ->method('get') |
|
90 | + ->with( |
|
91 | + $this->equalTo('https://api-ssl.bitly.com/v4/groups/test/preferences') |
|
92 | + ); |
|
93 | + $bitlink = new Group($mock); |
|
94 | + $bitlink->getGroupPreferences('test'); |
|
95 | + } |
|
96 | 96 | |
97 | - public function testUpdateGroupPreferences() |
|
98 | - { |
|
99 | - $mock = $this->createMock(ApiInterface::class); |
|
100 | - $mock |
|
101 | - ->expects($this->once()) |
|
102 | - ->method('patch') |
|
103 | - ->with( |
|
104 | - $this->equalTo('https://api-ssl.bitly.com/v4/groups/test/preferences'), |
|
105 | - $this->identicalTo(['key' => 'value']) |
|
106 | - ); |
|
107 | - $bitlink = new Group($mock); |
|
108 | - $bitlink->updateGroupPreferences('test', ['key' => 'value']); |
|
109 | - } |
|
97 | + public function testUpdateGroupPreferences() |
|
98 | + { |
|
99 | + $mock = $this->createMock(ApiInterface::class); |
|
100 | + $mock |
|
101 | + ->expects($this->once()) |
|
102 | + ->method('patch') |
|
103 | + ->with( |
|
104 | + $this->equalTo('https://api-ssl.bitly.com/v4/groups/test/preferences'), |
|
105 | + $this->identicalTo(['key' => 'value']) |
|
106 | + ); |
|
107 | + $bitlink = new Group($mock); |
|
108 | + $bitlink->updateGroupPreferences('test', ['key' => 'value']); |
|
109 | + } |
|
110 | 110 | |
111 | - public function testGetBitlinksByGroup() |
|
112 | - { |
|
113 | - $mock = $this->createMock(ApiInterface::class); |
|
114 | - $mock |
|
115 | - ->expects($this->once()) |
|
116 | - ->method('get') |
|
117 | - ->with( |
|
118 | - $this->equalTo('https://api-ssl.bitly.com/v4/groups/test/bitlinks'), |
|
119 | - $this->identicalTo(['key' => 'value']) |
|
120 | - ); |
|
121 | - $bitlink = new Group($mock); |
|
122 | - $bitlink->getBitlinksByGroup('test', ['key' => 'value']); |
|
123 | - } |
|
111 | + public function testGetBitlinksByGroup() |
|
112 | + { |
|
113 | + $mock = $this->createMock(ApiInterface::class); |
|
114 | + $mock |
|
115 | + ->expects($this->once()) |
|
116 | + ->method('get') |
|
117 | + ->with( |
|
118 | + $this->equalTo('https://api-ssl.bitly.com/v4/groups/test/bitlinks'), |
|
119 | + $this->identicalTo(['key' => 'value']) |
|
120 | + ); |
|
121 | + $bitlink = new Group($mock); |
|
122 | + $bitlink->getBitlinksByGroup('test', ['key' => 'value']); |
|
123 | + } |
|
124 | 124 | |
125 | - public function testGetGroupMetricsByCountries() |
|
126 | - { |
|
127 | - $mock = $this->createMock(ApiInterface::class); |
|
128 | - $mock |
|
129 | - ->expects($this->once()) |
|
130 | - ->method('get') |
|
131 | - ->with( |
|
132 | - $this->equalTo('https://api-ssl.bitly.com/v4/groups/test/bitlinks') |
|
133 | - ); |
|
134 | - $bitlink = new Group($mock); |
|
135 | - $bitlink->getBitlinksByGroup('test'); |
|
136 | - } |
|
125 | + public function testGetGroupMetricsByCountries() |
|
126 | + { |
|
127 | + $mock = $this->createMock(ApiInterface::class); |
|
128 | + $mock |
|
129 | + ->expects($this->once()) |
|
130 | + ->method('get') |
|
131 | + ->with( |
|
132 | + $this->equalTo('https://api-ssl.bitly.com/v4/groups/test/bitlinks') |
|
133 | + ); |
|
134 | + $bitlink = new Group($mock); |
|
135 | + $bitlink->getBitlinksByGroup('test'); |
|
136 | + } |
|
137 | 137 | |
138 | - public function testGetSortedBitlinks() |
|
139 | - { |
|
140 | - $mock = $this->createMock(ApiInterface::class); |
|
141 | - $mock |
|
142 | - ->expects($this->once()) |
|
143 | - ->method('get') |
|
144 | - ->with( |
|
145 | - $this->equalTo('https://api-ssl.bitly.com/v4/groups/test/bitlinks/clicks'), |
|
146 | - $this->identicalTo(['key' => 'value']) |
|
147 | - ); |
|
148 | - $bitlink = new Group($mock); |
|
149 | - $bitlink->getSortedBitlinks('test', ['key' => 'value']); |
|
150 | - } |
|
138 | + public function testGetSortedBitlinks() |
|
139 | + { |
|
140 | + $mock = $this->createMock(ApiInterface::class); |
|
141 | + $mock |
|
142 | + ->expects($this->once()) |
|
143 | + ->method('get') |
|
144 | + ->with( |
|
145 | + $this->equalTo('https://api-ssl.bitly.com/v4/groups/test/bitlinks/clicks'), |
|
146 | + $this->identicalTo(['key' => 'value']) |
|
147 | + ); |
|
148 | + $bitlink = new Group($mock); |
|
149 | + $bitlink->getSortedBitlinks('test', ['key' => 'value']); |
|
150 | + } |
|
151 | 151 | |
152 | - public function testUpdateGroup() |
|
153 | - { |
|
154 | - $mock = $this->createMock(ApiInterface::class); |
|
155 | - $mock |
|
156 | - ->expects($this->once()) |
|
157 | - ->method('patch') |
|
158 | - ->with( |
|
159 | - $this->equalTo('https://api-ssl.bitly.com/v4/groups/test'), |
|
160 | - $this->identicalTo(['key' => 'value']) |
|
161 | - ); |
|
162 | - $bitlink = new Group($mock); |
|
163 | - $bitlink->updateGroup('test', ['key' => 'value']); |
|
164 | - } |
|
152 | + public function testUpdateGroup() |
|
153 | + { |
|
154 | + $mock = $this->createMock(ApiInterface::class); |
|
155 | + $mock |
|
156 | + ->expects($this->once()) |
|
157 | + ->method('patch') |
|
158 | + ->with( |
|
159 | + $this->equalTo('https://api-ssl.bitly.com/v4/groups/test'), |
|
160 | + $this->identicalTo(['key' => 'value']) |
|
161 | + ); |
|
162 | + $bitlink = new Group($mock); |
|
163 | + $bitlink->updateGroup('test', ['key' => 'value']); |
|
164 | + } |
|
165 | 165 | |
166 | - public function testGetGroup() |
|
167 | - { |
|
168 | - $mock = $this->createMock(ApiInterface::class); |
|
169 | - $mock |
|
170 | - ->expects($this->once()) |
|
171 | - ->method('get') |
|
172 | - ->with( |
|
173 | - $this->equalTo('https://api-ssl.bitly.com/v4/groups/test') |
|
174 | - ); |
|
175 | - $bitlink = new Group($mock); |
|
176 | - $bitlink->getGroup('test'); |
|
177 | - } |
|
166 | + public function testGetGroup() |
|
167 | + { |
|
168 | + $mock = $this->createMock(ApiInterface::class); |
|
169 | + $mock |
|
170 | + ->expects($this->once()) |
|
171 | + ->method('get') |
|
172 | + ->with( |
|
173 | + $this->equalTo('https://api-ssl.bitly.com/v4/groups/test') |
|
174 | + ); |
|
175 | + $bitlink = new Group($mock); |
|
176 | + $bitlink->getGroup('test'); |
|
177 | + } |
|
178 | 178 | |
179 | - public function testDeleteGroup() |
|
180 | - { |
|
181 | - $mock = $this->createMock(ApiInterface::class); |
|
182 | - $mock |
|
183 | - ->expects($this->once()) |
|
184 | - ->method('delete') |
|
185 | - ->with( |
|
186 | - $this->equalTo('https://api-ssl.bitly.com/v4/groups/test') |
|
187 | - ); |
|
188 | - $bitlink = new Group($mock); |
|
189 | - $bitlink->deleteGroup('test'); |
|
190 | - } |
|
179 | + public function testDeleteGroup() |
|
180 | + { |
|
181 | + $mock = $this->createMock(ApiInterface::class); |
|
182 | + $mock |
|
183 | + ->expects($this->once()) |
|
184 | + ->method('delete') |
|
185 | + ->with( |
|
186 | + $this->equalTo('https://api-ssl.bitly.com/v4/groups/test') |
|
187 | + ); |
|
188 | + $bitlink = new Group($mock); |
|
189 | + $bitlink->deleteGroup('test'); |
|
190 | + } |
|
191 | 191 | |
192 | 192 | } |
@@ -26,21 +26,21 @@ discard block |
||
26 | 26 | |
27 | 27 | class Cache { |
28 | 28 | |
29 | - private $config; |
|
29 | + private $config; |
|
30 | 30 | |
31 | - public function __construct (array $config) |
|
32 | - { |
|
33 | - $this->config = $config; |
|
34 | - } |
|
31 | + public function __construct (array $config) |
|
32 | + { |
|
33 | + $this->config = $config; |
|
34 | + } |
|
35 | 35 | |
36 | - /* |
|
36 | + /* |
|
37 | 37 | This class uses Doctrine Cache. You can look at its doc to add more cache type. |
38 | 38 | Whatever option you need to setup the cache type, must be passed as array to constructor. |
39 | 39 | https://www.doctrine-project.org/projects/doctrine-cache/en/1.8/index.html |
40 | 40 | */ |
41 | - public function getCache () |
|
42 | - { |
|
43 | - switch ($this->config['type']) { |
|
41 | + public function getCache () |
|
42 | + { |
|
43 | + switch ($this->config['type']) { |
|
44 | 44 | case 'apc': |
45 | 45 | $cache = new \Doctrine\Common\Cache\ApcCache(); |
46 | 46 | break; |
@@ -49,15 +49,15 @@ discard block |
||
49 | 49 | break; |
50 | 50 | case 'sqlite3': |
51 | 51 | $db = new \SQLite3($this->config['sqlite3_db']); |
52 | - $cache = new \SQLite3Cache($db, $this->config['sqlite3_table']); |
|
52 | + $cache = new \SQLite3Cache($db, $this->config['sqlite3_table']); |
|
53 | 53 | break; |
54 | 54 | case 'xcache': |
55 | 55 | $cache = new \Doctrine\Common\Cache\XcacheCache(); |
56 | - break; |
|
57 | - default: |
|
56 | + break; |
|
57 | + default: |
|
58 | 58 | throw new CacheException('Invalid cache system'); |
59 | - break; |
|
60 | - } |
|
61 | - return $cache; |
|
62 | - } |
|
59 | + break; |
|
60 | + } |
|
61 | + return $cache; |
|
62 | + } |
|
63 | 63 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | |
29 | 29 | private $config; |
30 | 30 | |
31 | - public function __construct (array $config) |
|
31 | + public function __construct(array $config) |
|
32 | 32 | { |
33 | 33 | $this->config = $config; |
34 | 34 | } |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | Whatever option you need to setup the cache type, must be passed as array to constructor. |
39 | 39 | https://www.doctrine-project.org/projects/doctrine-cache/en/1.8/index.html |
40 | 40 | */ |
41 | - public function getCache () |
|
41 | + public function getCache() |
|
42 | 42 | { |
43 | 43 | switch ($this->config['type']) { |
44 | 44 | case 'apc': |
@@ -25,160 +25,160 @@ |
||
25 | 25 | |
26 | 26 | class Result { |
27 | 27 | |
28 | - protected $error; |
|
29 | - protected $message; |
|
30 | - protected $headers; |
|
31 | - protected $curlInfo; |
|
32 | - protected $reasonPhrases = array( |
|
33 | - // INFORMATIONAL CODES |
|
34 | - 100 => 'Continue', |
|
35 | - 101 => 'Switching Protocols', |
|
36 | - 102 => 'Processing', |
|
37 | - // SUCCESS CODES |
|
38 | - 200 => 'OK', |
|
39 | - 201 => 'Created', |
|
40 | - 202 => 'Accepted', |
|
41 | - 203 => 'Non-Authoritative Information', |
|
42 | - 204 => 'No Content', |
|
43 | - 205 => 'Reset Content', |
|
44 | - 206 => 'Partial Content', |
|
45 | - 207 => 'Multi-status', |
|
46 | - 208 => 'Already Reported', |
|
47 | - // REDIRECTION CODES |
|
48 | - 300 => 'Multiple Choices', |
|
49 | - 301 => 'Moved Permanently', |
|
50 | - 302 => 'Found', |
|
51 | - 303 => 'See Other', |
|
52 | - 304 => 'Not Modified', |
|
53 | - 305 => 'Use Proxy', |
|
54 | - 306 => 'Switch Proxy', // Deprecated |
|
55 | - 307 => 'Temporary Redirect', |
|
56 | - // CLIENT ERROR |
|
57 | - 400 => 'Bad Request', |
|
58 | - 401 => 'Unauthorized', |
|
59 | - 402 => 'Payment Required', |
|
60 | - 403 => 'Forbidden', |
|
61 | - 404 => 'Not Found', |
|
62 | - 405 => 'Method Not Allowed', |
|
63 | - 406 => 'Not Acceptable', |
|
64 | - 407 => 'Proxy Authentication Required', |
|
65 | - 408 => 'Request Time-out', |
|
66 | - 409 => 'Conflict', |
|
67 | - 410 => 'Gone', |
|
68 | - 411 => 'Length Required', |
|
69 | - 412 => 'Precondition Failed', |
|
70 | - 413 => 'Request Entity Too Large', |
|
71 | - 414 => 'Request-URI Too Large', |
|
72 | - 415 => 'Unsupported Media Type', |
|
73 | - 416 => 'Requested range not satisfiable', |
|
74 | - 417 => 'Expectation Failed', |
|
75 | - 418 => 'I\'m a teapot', |
|
76 | - 422 => 'Unprocessable Entity', |
|
77 | - 423 => 'Locked', |
|
78 | - 424 => 'Failed Dependency', |
|
79 | - 425 => 'Unordered Collection', |
|
80 | - 426 => 'Upgrade Required', |
|
81 | - 428 => 'Precondition Required', |
|
82 | - 429 => 'Too Many Requests', |
|
83 | - 431 => 'Request Header Fields Too Large', |
|
84 | - // SERVER ERROR |
|
85 | - 500 => 'Internal Server Error', |
|
86 | - 501 => 'Not Implemented', |
|
87 | - 502 => 'Bad Gateway', |
|
88 | - 503 => 'Service Unavailable', |
|
89 | - 504 => 'Gateway Time-out', |
|
90 | - 505 => 'HTTP Version not supported', |
|
91 | - 506 => 'Variant Also Negotiates', |
|
92 | - 507 => 'Insufficient Storage', |
|
93 | - 508 => 'Loop Detected', |
|
94 | - 511 => 'Network Authentication Required' |
|
95 | - ); |
|
96 | - |
|
97 | - public function __construct($body, $headers, $curlInfo) |
|
98 | - { |
|
99 | - $this->body = $body; |
|
100 | - $this->headers = $headers; |
|
101 | - $this->curlInfo = $curlInfo; |
|
102 | - } |
|
103 | - |
|
104 | - public function isError () |
|
105 | - { |
|
106 | - return isset($this->getResponseObject()->errors) && $this->getResponseObject()->errors; |
|
107 | - } |
|
28 | + protected $error; |
|
29 | + protected $message; |
|
30 | + protected $headers; |
|
31 | + protected $curlInfo; |
|
32 | + protected $reasonPhrases = array( |
|
33 | + // INFORMATIONAL CODES |
|
34 | + 100 => 'Continue', |
|
35 | + 101 => 'Switching Protocols', |
|
36 | + 102 => 'Processing', |
|
37 | + // SUCCESS CODES |
|
38 | + 200 => 'OK', |
|
39 | + 201 => 'Created', |
|
40 | + 202 => 'Accepted', |
|
41 | + 203 => 'Non-Authoritative Information', |
|
42 | + 204 => 'No Content', |
|
43 | + 205 => 'Reset Content', |
|
44 | + 206 => 'Partial Content', |
|
45 | + 207 => 'Multi-status', |
|
46 | + 208 => 'Already Reported', |
|
47 | + // REDIRECTION CODES |
|
48 | + 300 => 'Multiple Choices', |
|
49 | + 301 => 'Moved Permanently', |
|
50 | + 302 => 'Found', |
|
51 | + 303 => 'See Other', |
|
52 | + 304 => 'Not Modified', |
|
53 | + 305 => 'Use Proxy', |
|
54 | + 306 => 'Switch Proxy', // Deprecated |
|
55 | + 307 => 'Temporary Redirect', |
|
56 | + // CLIENT ERROR |
|
57 | + 400 => 'Bad Request', |
|
58 | + 401 => 'Unauthorized', |
|
59 | + 402 => 'Payment Required', |
|
60 | + 403 => 'Forbidden', |
|
61 | + 404 => 'Not Found', |
|
62 | + 405 => 'Method Not Allowed', |
|
63 | + 406 => 'Not Acceptable', |
|
64 | + 407 => 'Proxy Authentication Required', |
|
65 | + 408 => 'Request Time-out', |
|
66 | + 409 => 'Conflict', |
|
67 | + 410 => 'Gone', |
|
68 | + 411 => 'Length Required', |
|
69 | + 412 => 'Precondition Failed', |
|
70 | + 413 => 'Request Entity Too Large', |
|
71 | + 414 => 'Request-URI Too Large', |
|
72 | + 415 => 'Unsupported Media Type', |
|
73 | + 416 => 'Requested range not satisfiable', |
|
74 | + 417 => 'Expectation Failed', |
|
75 | + 418 => 'I\'m a teapot', |
|
76 | + 422 => 'Unprocessable Entity', |
|
77 | + 423 => 'Locked', |
|
78 | + 424 => 'Failed Dependency', |
|
79 | + 425 => 'Unordered Collection', |
|
80 | + 426 => 'Upgrade Required', |
|
81 | + 428 => 'Precondition Required', |
|
82 | + 429 => 'Too Many Requests', |
|
83 | + 431 => 'Request Header Fields Too Large', |
|
84 | + // SERVER ERROR |
|
85 | + 500 => 'Internal Server Error', |
|
86 | + 501 => 'Not Implemented', |
|
87 | + 502 => 'Bad Gateway', |
|
88 | + 503 => 'Service Unavailable', |
|
89 | + 504 => 'Gateway Time-out', |
|
90 | + 505 => 'HTTP Version not supported', |
|
91 | + 506 => 'Variant Also Negotiates', |
|
92 | + 507 => 'Insufficient Storage', |
|
93 | + 508 => 'Loop Detected', |
|
94 | + 511 => 'Network Authentication Required' |
|
95 | + ); |
|
96 | + |
|
97 | + public function __construct($body, $headers, $curlInfo) |
|
98 | + { |
|
99 | + $this->body = $body; |
|
100 | + $this->headers = $headers; |
|
101 | + $this->curlInfo = $curlInfo; |
|
102 | + } |
|
103 | + |
|
104 | + public function isError () |
|
105 | + { |
|
106 | + return isset($this->getResponseObject()->errors) && $this->getResponseObject()->errors; |
|
107 | + } |
|
108 | 108 | |
109 | - public function getDescription () |
|
110 | - { |
|
111 | - return $this->getResponseObject()->description; |
|
112 | - } |
|
113 | - |
|
114 | - public function getHeaders() |
|
115 | - { |
|
116 | - return $this->headers; |
|
117 | - } |
|
118 | - |
|
119 | - public function getResponse() |
|
120 | - { |
|
121 | - return $this->body; |
|
122 | - } |
|
123 | - |
|
124 | - public function getResponseObject() |
|
125 | - { |
|
126 | - return json_decode($this->body); |
|
127 | - } |
|
128 | - |
|
129 | - public function getResponseArray () |
|
130 | - { |
|
131 | - return json_decode($this->body, true); |
|
132 | - } |
|
133 | - |
|
134 | - public function getResponseCode() |
|
135 | - { |
|
136 | - return $this->curlInfo['http_code']; |
|
137 | - } |
|
138 | - |
|
139 | - public function getReasonPhrase() |
|
140 | - { |
|
141 | - return $this->reasonPhrases[$this->curlInfo['http_code']]; |
|
142 | - } |
|
143 | - |
|
144 | - public function getContentType() |
|
145 | - { |
|
146 | - return $this->curlInfo['content_type']; |
|
147 | - } |
|
148 | - |
|
149 | - public function isOk() |
|
150 | - { |
|
151 | - return ($this->curlInfo['http_code'] === 200); |
|
152 | - } |
|
153 | - |
|
154 | - public function isSuccess() |
|
155 | - { |
|
156 | - return (200 <= $this->curlInfo['http_code'] && 300 > $this->curlInfo['http_code']); |
|
157 | - } |
|
158 | - |
|
159 | - public function isNotFound() |
|
160 | - { |
|
161 | - return ($this->curlInfo['http_code'] === 404); |
|
162 | - } |
|
163 | - |
|
164 | - public function isInformational() |
|
165 | - { |
|
166 | - return ($this->curlInfo['http_code'] >= 100 && $this->curlInfo['http_code'] < 200); |
|
167 | - } |
|
168 | - |
|
169 | - public function isRedirect() |
|
170 | - { |
|
171 | - return (300 <= $this->curlInfo['http_code'] && 400 > $this->curlInfo['http_code']); |
|
172 | - } |
|
173 | - |
|
174 | - public function isClientError() |
|
175 | - { |
|
176 | - return ($this->curlInfo['http_code'] < 500 && $this->curlInfo['http_code'] >= 400); |
|
177 | - } |
|
178 | - |
|
179 | - public function isServerError() |
|
180 | - { |
|
181 | - return (500 <= $this->curlInfo['http_code'] && 600 > $this->curlInfo['http_code']); |
|
182 | - } |
|
109 | + public function getDescription () |
|
110 | + { |
|
111 | + return $this->getResponseObject()->description; |
|
112 | + } |
|
113 | + |
|
114 | + public function getHeaders() |
|
115 | + { |
|
116 | + return $this->headers; |
|
117 | + } |
|
118 | + |
|
119 | + public function getResponse() |
|
120 | + { |
|
121 | + return $this->body; |
|
122 | + } |
|
123 | + |
|
124 | + public function getResponseObject() |
|
125 | + { |
|
126 | + return json_decode($this->body); |
|
127 | + } |
|
128 | + |
|
129 | + public function getResponseArray () |
|
130 | + { |
|
131 | + return json_decode($this->body, true); |
|
132 | + } |
|
133 | + |
|
134 | + public function getResponseCode() |
|
135 | + { |
|
136 | + return $this->curlInfo['http_code']; |
|
137 | + } |
|
138 | + |
|
139 | + public function getReasonPhrase() |
|
140 | + { |
|
141 | + return $this->reasonPhrases[$this->curlInfo['http_code']]; |
|
142 | + } |
|
143 | + |
|
144 | + public function getContentType() |
|
145 | + { |
|
146 | + return $this->curlInfo['content_type']; |
|
147 | + } |
|
148 | + |
|
149 | + public function isOk() |
|
150 | + { |
|
151 | + return ($this->curlInfo['http_code'] === 200); |
|
152 | + } |
|
153 | + |
|
154 | + public function isSuccess() |
|
155 | + { |
|
156 | + return (200 <= $this->curlInfo['http_code'] && 300 > $this->curlInfo['http_code']); |
|
157 | + } |
|
158 | + |
|
159 | + public function isNotFound() |
|
160 | + { |
|
161 | + return ($this->curlInfo['http_code'] === 404); |
|
162 | + } |
|
163 | + |
|
164 | + public function isInformational() |
|
165 | + { |
|
166 | + return ($this->curlInfo['http_code'] >= 100 && $this->curlInfo['http_code'] < 200); |
|
167 | + } |
|
168 | + |
|
169 | + public function isRedirect() |
|
170 | + { |
|
171 | + return (300 <= $this->curlInfo['http_code'] && 400 > $this->curlInfo['http_code']); |
|
172 | + } |
|
173 | + |
|
174 | + public function isClientError() |
|
175 | + { |
|
176 | + return ($this->curlInfo['http_code'] < 500 && $this->curlInfo['http_code'] >= 400); |
|
177 | + } |
|
178 | + |
|
179 | + public function isServerError() |
|
180 | + { |
|
181 | + return (500 <= $this->curlInfo['http_code'] && 600 > $this->curlInfo['http_code']); |
|
182 | + } |
|
183 | 183 | |
184 | 184 | } |
@@ -101,12 +101,12 @@ discard block |
||
101 | 101 | $this->curlInfo = $curlInfo; |
102 | 102 | } |
103 | 103 | |
104 | - public function isError () |
|
104 | + public function isError() |
|
105 | 105 | { |
106 | 106 | return isset($this->getResponseObject()->errors) && $this->getResponseObject()->errors; |
107 | 107 | } |
108 | 108 | |
109 | - public function getDescription () |
|
109 | + public function getDescription() |
|
110 | 110 | { |
111 | 111 | return $this->getResponseObject()->description; |
112 | 112 | } |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | return json_decode($this->body); |
127 | 127 | } |
128 | 128 | |
129 | - public function getResponseArray () |
|
129 | + public function getResponseArray() |
|
130 | 130 | { |
131 | 131 | return json_decode($this->body, true); |
132 | 132 | } |