File tree Expand file tree Collapse file tree 2 files changed +28
-4
lines changed Expand file tree Collapse file tree 2 files changed +28
-4
lines changed Original file line number Diff line number Diff line change @@ -19,17 +19,29 @@ public static function create(Adapter $adapter)
19
19
$ key = $ adapter ->getConfig ('facebook[key] ' );
20
20
21
21
if (!empty ($ key )) {
22
- return new static ($ adapter ->getResponse (), $ key );
22
+ $ response = $ adapter ->getResponse ();
23
+
24
+ if ($ response ->getUrl ()->match (static ::$ pattern )) {
25
+ return new static ($ response , null , $ key );
26
+ }
27
+
28
+ if ($ response ->getStartingUrl ()->match (static ::$ pattern )) {
29
+ return new static ($ response , $ response ->getStartingUrl (), $ key );
30
+ }
23
31
}
24
32
}
25
33
26
34
/**
27
35
* {@inheritdoc}
28
36
*/
29
- protected function __construct (Response $ response , $ key = null )
37
+ protected function __construct (Response $ response , $ url = null , $ key = null )
30
38
{
31
39
$ this ->response = $ response ;
32
40
$ this ->key = $ key ;
41
+
42
+ if ($ url ) {
43
+ $ this ->url = $ url ;
44
+ }
33
45
}
34
46
35
47
/**
Original file line number Diff line number Diff line change @@ -24,17 +24,29 @@ public static function create(Adapter $adapter)
24
24
$ key = $ adapter ->getConfig ('facebook[key] ' );
25
25
26
26
if (!empty ($ key )) {
27
- return new static ($ adapter ->getResponse (), $ key );
27
+ $ response = $ adapter ->getResponse ();
28
+
29
+ if ($ response ->getUrl ()->match (static ::$ pattern )) {
30
+ return new static ($ response , null , $ key );
31
+ }
32
+
33
+ if ($ response ->getStartingUrl ()->match (static ::$ pattern )) {
34
+ return new static ($ response , $ response ->getStartingUrl (), $ key );
35
+ }
28
36
}
29
37
}
30
38
31
39
/**
32
40
* {@inheritdoc}
33
41
*/
34
- protected function __construct (Response $ response , $ key = null )
42
+ protected function __construct (Response $ response , $ url = null , $ key = null )
35
43
{
36
44
$ this ->response = $ response ;
37
45
$ this ->key = $ key ;
46
+
47
+ if ($ url ) {
48
+ $ this ->url = $ url ;
49
+ }
38
50
}
39
51
40
52
/**
You can’t perform that action at this time.
0 commit comments