Skip to content

Commit 54dbe34

Browse files
committed
moved run() out of AdapterInterface, minor fixes
1 parent bb59e20 commit 54dbe34

File tree

15 files changed

+43
-28
lines changed

15 files changed

+43
-28
lines changed

demo/index.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ function printCode($code, $asHtml = true)
207207
<h2>Http request info</h2>
208208

209209
<table>
210-
<?php foreach ($info->request->getRequestInfo() as $name => $value): ?>
210+
<?php foreach ($info->getRequest()->getRequestInfo() as $name => $value): ?>
211211
<tr>
212212
<th><?php echo $name; ?></th>
213213
<td><?php printAny($value); ?></td>
@@ -218,7 +218,7 @@ function printCode($code, $asHtml = true)
218218
<h2>Content</h2>
219219

220220
<pre>
221-
<?php printText($info->request->getContent()); ?>
221+
<?php printText($info->getRequest()->getContent()); ?>
222222
</pre>
223223
</div>
224224
</section>

src/Adapters/Adapter.php

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,12 @@ protected function init()
9797
}
9898

9999
/**
100-
* Get the request.
101-
*
102-
* @return Request
100+
* Run the adapter.
101+
*/
102+
abstract protected function run();
103+
104+
/**
105+
* {@inheritdoc}
103106
*/
104107
public function getRequest()
105108
{
@@ -123,21 +126,15 @@ protected function addProvider($name, ProviderInterface $provider)
123126
}
124127

125128
/**
126-
* Get a provider.
127-
*
128-
* @param string $name
129-
*
130-
* @return null|ProviderInterface
129+
* {@inheritdoc}
131130
*/
132131
public function getProvider($name)
133132
{
134133
return isset($this->providers[$name]) ? $this->providers[$name] : null;
135134
}
136135

137136
/**
138-
* Get all providers.
139-
*
140-
* @return array
137+
* {@inheritdoc}
141138
*/
142139
public function getAllProviders()
143140
{

src/Adapters/AdapterInterface.php

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,27 @@ public static function check(Request $request);
2828
public function __construct(Request $request, array $config = null);
2929

3030
/**
31-
* Run the provider.
31+
* Returns the request instance.
32+
*
33+
* @return Request
34+
*/
35+
public function getRequest();
36+
37+
/**
38+
* Returns a provider.
39+
*
40+
* @param string $name
41+
*
42+
* @return null|ProviderInterface
43+
*/
44+
public function getProvider($name);
45+
46+
/**
47+
* Get all providers.
48+
*
49+
* @return array
3250
*/
33-
public function run();
51+
public function getAllProviders();
3452

3553
/**
3654
* Gets all icon provider urls found

src/Adapters/Archive.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public static function check(Request $request)
2424
/**
2525
* {@inheritdoc}
2626
*/
27-
public function run()
27+
protected function run()
2828
{
2929
$this->addProvider('archive', new Api\Archive());
3030

src/Adapters/Facebook.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public static function check(Request $request)
2323
/**
2424
* {@inheritdoc}
2525
*/
26-
public function run()
26+
protected function run()
2727
{
2828
$this->addProvider('facebook', new Api\Facebook());
2929

src/Adapters/File.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public static function check(Request $request)
4747
/**
4848
* {@inheritdoc}
4949
*/
50-
public function run()
50+
protected function run()
5151
{
5252
$this->addProvider('oembed', new Providers\OEmbed());
5353
}

src/Adapters/Github.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public static function check(Request $request)
2424
/**
2525
* {@inheritdoc}
2626
*/
27-
public function run()
27+
protected function run()
2828
{
2929
if ($this->request->getHost() === 'gist.github.com') {
3030
$this->addProvider('gist', new Api\Gist());

src/Adapters/Google.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public static function check(Request $request)
2626
/**
2727
* {@inheritdoc}
2828
*/
29-
public function run()
29+
protected function run()
3030
{
3131
if ($this->request->match('*/maps/*')) {
3232
$this->addProvider('google', new Api\GoogleMaps());

src/Adapters/Imageshack.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public static function check(Request $request)
2323
/**
2424
* {@inheritdoc}
2525
*/
26-
public function run()
26+
protected function run()
2727
{
2828
$this->addProvider('imageshack', new Api\Imageshack());
2929

src/Adapters/N500px.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function getHeight()
5454
/**
5555
* {@inheritdoc}
5656
*/
57-
public function run()
57+
protected function run()
5858
{
5959
//order is important
6060
$this->addProvider('oembed', new Providers\OEmbed());

0 commit comments

Comments
 (0)