Skip to content

Commit 5aba731

Browse files
committed
Split ClientInterface -> ClientListenerInterface
- Everything that is related to listener has been moved from ClientInterface to ClientListenerInterface. This should make each interface more light. - Although theoretically not needed, ClientInterface extends ClientListenerInterface just for the sake of IDE autocomplete.
1 parent 0d476dd commit 5aba731

File tree

4 files changed

+75
-56
lines changed

4 files changed

+75
-56
lines changed

lib/Bitbucket/API/Http/Client.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
/**
2323
* @author Alexandru G. <alex@gentle.ro>
2424
*/
25-
class Client extends Listener implements ClientInterface
25+
class Client extends ClientListener implements ClientInterface
2626
{
2727
/**
2828
* @var array

lib/Bitbucket/API/Http/ClientInterface.php

Lines changed: 1 addition & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,11 @@
1212
namespace Bitbucket\API\Http;
1313

1414
use Buzz\Message\MessageInterface;
15-
use Bitbucket\API\Http\Listener\ListenerInterface;
1615

1716
/**
1817
* @author Alexandru G. <alex@gentle.ro>
1918
*/
20-
interface ClientInterface
19+
interface ClientInterface extends ClientListenerInterface
2120
{
2221
/**
2322
* Make an HTTP GET request to API
@@ -124,56 +123,4 @@ public function setApiVersion($version);
124123
* @return string
125124
*/
126125
public function getApiBaseUrl();
127-
128-
/**
129-
* @access public
130-
* @param ListenerInterface $listener
131-
* @return $this
132-
*/
133-
public function addListener(ListenerInterface $listener);
134-
135-
/**
136-
* @access public
137-
* @param ListenerInterface|string $name
138-
* @return $this
139-
*/
140-
public function delListener($name);
141-
142-
/**
143-
* Get listener interface
144-
*
145-
* @param string $name
146-
* @return ListenerInterface|bool False when listener does not exist
147-
*
148-
* @throws \InvalidArgumentException
149-
*/
150-
public function getListener($name);
151-
152-
/**
153-
* @access public
154-
* @return array
155-
*/
156-
public function getListeners();
157-
158-
/**
159-
* @access public
160-
* @return bool
161-
*/
162-
public function hasListeners();
163-
164-
/**
165-
* @access public
166-
* @param array $listeners
167-
* @return $this
168-
*/
169-
public function setListeners(array $listeners);
170-
171-
/**
172-
* Check if a listener exists
173-
*
174-
* @access public
175-
* @param string $name
176-
* @return bool
177-
*/
178-
public function isListener($name);
179126
}

lib/Bitbucket/API/Http/Listener.php renamed to lib/Bitbucket/API/Http/ClientListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
/**
1717
* @author Alexandru G. <alex@gentle.ro>
1818
*/
19-
abstract class Listener
19+
abstract class ClientListener implements ClientListenerInterface
2020
{
2121
/**
2222
* @var ListenerInterface[]
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
<?php
2+
3+
/**
4+
* This file is part of the bitbucket-api package.
5+
*
6+
* (c) Alexandru G. <alex@gentle.ro>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Bitbucket\API\Http;
13+
14+
use Bitbucket\API\Http\Listener\ListenerInterface;
15+
16+
/**
17+
* @author Alexandru G. <alex@gentle.ro>
18+
*/
19+
interface ClientListenerInterface
20+
{
21+
/**
22+
* @access public
23+
* @param ListenerInterface $listener
24+
* @return $this
25+
*/
26+
public function addListener(ListenerInterface $listener);
27+
28+
/**
29+
* @access public
30+
* @param ListenerInterface|string $name
31+
* @return $this
32+
*/
33+
public function delListener($name);
34+
35+
/**
36+
* Get listener interface
37+
*
38+
* @param string $name
39+
* @return ListenerInterface|bool False when listener does not exist
40+
*
41+
* @throws \InvalidArgumentException
42+
*/
43+
public function getListener($name);
44+
45+
/**
46+
* @access public
47+
* @return array
48+
*/
49+
public function getListeners();
50+
51+
/**
52+
* @access public
53+
* @return bool
54+
*/
55+
public function hasListeners();
56+
57+
/**
58+
* @access public
59+
* @param array $listeners
60+
* @return $this
61+
*/
62+
public function setListeners(array $listeners);
63+
64+
/**
65+
* Check if a listener exists
66+
*
67+
* @access public
68+
* @param string $name
69+
* @return bool
70+
*/
71+
public function isListener($name);
72+
}

0 commit comments

Comments
 (0)