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)
1919 $ key = $ adapter ->getConfig ('facebook[key] ' );
2020
2121 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+ }
2331 }
2432 }
2533
2634 /**
2735 * {@inheritdoc}
2836 */
29- protected function __construct (Response $ response , $ key = null )
37+ protected function __construct (Response $ response , $ url = null , $ key = null )
3038 {
3139 $ this ->response = $ response ;
3240 $ this ->key = $ key ;
41+
42+ if ($ url ) {
43+ $ this ->url = $ url ;
44+ }
3345 }
3446
3547 /**
Original file line number Diff line number Diff line change @@ -24,17 +24,29 @@ public static function create(Adapter $adapter)
2424 $ key = $ adapter ->getConfig ('facebook[key] ' );
2525
2626 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+ }
2836 }
2937 }
3038
3139 /**
3240 * {@inheritdoc}
3341 */
34- protected function __construct (Response $ response , $ key = null )
42+ protected function __construct (Response $ response , $ url = null , $ key = null )
3543 {
3644 $ this ->response = $ response ;
3745 $ this ->key = $ key ;
46+
47+ if ($ url ) {
48+ $ this ->url = $ url ;
49+ }
3850 }
3951
4052 /**
You can’t perform that action at this time.
0 commit comments