File tree Expand file tree Collapse file tree 2 files changed +53
-0
lines changed Expand file tree Collapse file tree 2 files changed +53
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Embed \Adapters ;
4
+
5
+ use Embed \Request ;
6
+ use Embed \Utils ;
7
+
8
+ /**
9
+ * Adapter to generate embed code from ideone.com.
10
+ */
11
+ class Ideone extends Webpage implements AdapterInterface
12
+ {
13
+ /**
14
+ * {@inheritdoc}
15
+ */
16
+ public static function check (Request $ request )
17
+ {
18
+ return $ request ->isValid () && $ request ->match ([
19
+ 'https?://ideone.com/* ' ,
20
+ ]);
21
+ }
22
+
23
+ /**
24
+ * {@inheritdoc}
25
+ */
26
+ public function getCode ()
27
+ {
28
+ $ this ->width = null ;
29
+ $ this ->height = null ;
30
+
31
+ $ path = '/e.js ' .$ this ->request ->getPath ();
32
+
33
+ return Utils::script ($ this ->request ->createUrl ($ path )->getUrl ());
34
+ }
35
+ }
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ class IdeoneTest extends TestCaseBase
4
+ {
5
+ public function testOne ()
6
+ {
7
+ $ this ->assertEmbed (
8
+ 'http://ideone.com/Whjntg ' ,
9
+ [
10
+ 'title ' => 'Ideone.com ' ,
11
+ 'type ' => 'rich ' ,
12
+ 'providerName ' => 'Ideone.com ' ,
13
+ 'providerUrl ' => 'http://ideone.com ' ,
14
+ 'code ' => '<script src="http://ideone.com/e.js/Whjntg"></script> '
15
+ ]
16
+ );
17
+ }
18
+ }
You can’t perform that action at this time.
0 commit comments