src/Parser/Lanyrd/EventUri.php 1 location
|
@@ 32-45 (lines=14) @@
|
| 29 |
|
*/ |
| 30 |
|
namespace Callingallpapers\Parser\Lanyrd; |
| 31 |
|
|
| 32 |
|
class EventUri |
| 33 |
|
{ |
| 34 |
|
|
| 35 |
|
public function parse($dom, $xpath) |
| 36 |
|
{ |
| 37 |
|
$uriPath = $xpath->query("//a[contains(@title, 'visit their website')]"); |
| 38 |
|
|
| 39 |
|
if (! $uriPath || $uriPath->length == 0) { |
| 40 |
|
throw new \InvalidArgumentException('The CfP does not seem to have an EventUri'); |
| 41 |
|
} |
| 42 |
|
|
| 43 |
|
return $uriPath->item(0)->attributes->getNamedItem('href')->textContent; |
| 44 |
|
} |
| 45 |
|
} |
| 46 |
|
|
src/Parser/Lanyrd/Uri.php 1 location
|
@@ 32-46 (lines=15) @@
|
| 29 |
|
*/ |
| 30 |
|
namespace Callingallpapers\Parser\Lanyrd; |
| 31 |
|
|
| 32 |
|
class Uri |
| 33 |
|
{ |
| 34 |
|
|
| 35 |
|
public function parse($dom, $xpath) |
| 36 |
|
{ |
| 37 |
|
$uri = $xpath->query( |
| 38 |
|
"//strong[contains(@class, \"call-open\")]/following-sibling::a" |
| 39 |
|
); |
| 40 |
|
if (! $uri || $uri->length == 0) { |
| 41 |
|
throw new \InvalidArgumentException('The CfP does not seem to have a CfP-Uri'); |
| 42 |
|
} |
| 43 |
|
|
| 44 |
|
return $uri->item(0)->attributes->getNamedItem('href')->textContent; |
| 45 |
|
} |
| 46 |
|
} |
| 47 |
|
|
src/Subcommands/Sessionize/Parser/IconUri.php 1 location
|
@@ 15-34 (lines=20) @@
|
| 12 |
|
use DOMDocument; |
| 13 |
|
use DOMXPath; |
| 14 |
|
|
| 15 |
|
class IconUri |
| 16 |
|
{ |
| 17 |
|
private $baseUri; |
| 18 |
|
|
| 19 |
|
public function __construct(string $baseUri) |
| 20 |
|
{ |
| 21 |
|
$this->baseUri = $baseUri; |
| 22 |
|
} |
| 23 |
|
|
| 24 |
|
public function parse(DOMDocument $dom, DOMXPath $xpath) : string |
| 25 |
|
{ |
| 26 |
|
$uriPath = $xpath->query('//div[contains(@class, "ibox-content")]/img'); |
| 27 |
|
|
| 28 |
|
if (! $uriPath || $uriPath->length == 0) { |
| 29 |
|
throw new \InvalidArgumentException('The CfP does not seem to have an Icon'); |
| 30 |
|
} |
| 31 |
|
|
| 32 |
|
return $uriPath->item(0)->attributes->getNamedItem('src')->textContent; |
| 33 |
|
} |
| 34 |
|
} |
| 35 |
|
|