Skip to content

Commit bafaa67

Browse files
committed
updated ClientInterface: added getListener() and isListener() methods
1 parent 98b610c commit bafaa67

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

lib/Bitbucket/API/Http/Client.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,26 @@ public function addListener(ListenerInterface $listener)
7777
return $this;
7878
}
7979

80+
/**
81+
* {@inheritDoc}
82+
*/
83+
public function getListener($name)
84+
{
85+
if (!$this->isListener($name)) {
86+
throw new \InvalidArgumentException(sprintf('Unknown listener %s', $name));
87+
}
88+
89+
return $this->listeners[$name];
90+
}
91+
92+
/**
93+
* {@inheritDoc}
94+
*/
95+
public function isListener($name)
96+
{
97+
return isset($this->listeners[$name]);
98+
}
99+
80100
/**
81101
* {@inheritDoc}
82102
*/

lib/Bitbucket/API/Http/ClientInterface.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,4 +131,23 @@ public function getApiBaseUrl();
131131
* @return $this
132132
*/
133133
public function addListener(ListenerInterface $listener);
134+
135+
/**
136+
* Get listener interface
137+
*
138+
* @param string $name
139+
* @return ListenerInterface
140+
*
141+
* @throws \InvalidArgumentException
142+
*/
143+
public function getListener($name);
144+
145+
/**
146+
* Check if a listener exists
147+
*
148+
* @access public
149+
* @param string $name
150+
* @return bool
151+
*/
152+
public function isListener($name);
134153
}

0 commit comments

Comments
 (0)