Skip to content

Commit

Permalink
Merge pull request #117 from heiglandreas/fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
heiglandreas authored Feb 10, 2023
2 parents 9d7a71f + b42273b commit 15ab89b
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 23 deletions.
4 changes: 3 additions & 1 deletion src/Command/AbstractParseEvents.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ protected function configure()
, $this->getServiceUrl()));
}

protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
$header_style = new OutputFormatterStyle('white', 'green', array('bold'));
$style = new SymfonyStyle($input, $output);
Expand Down Expand Up @@ -161,6 +161,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
$style->writeln('There where issues with these conferences:');
$style->listing($items);
}

return 0;
}

abstract protected function getParser(ServiceContainer $serviceContainer) : ParserInterface;
Expand Down
24 changes: 14 additions & 10 deletions src/Parser/ConfsTech/ConferenceParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,23 @@ public function __construct(
public function __invoke(array $conference) : Cfp
{
$cfp = new Cfp();
$cfp->location = $conference['city'];
if (isset($conference['city'])) {
$cfp->location = $conference['city'];
}

$geolocation = $this->geolocation->getLocationForAddress(
$conference['country'] . ', ' . $cfp->location
);
if (isset($conference['country'])) {
$geolocation = $this->geolocation->getLocationForAddress(
$conference['country'] . ', ' . $cfp->location
);

$cfp->latitude = $geolocation->getLatitude();
$cfp->longitude = $geolocation->getLongitude();
$cfp->latitude = $geolocation->getLatitude();
$cfp->longitude = $geolocation->getLongitude();

$cfp->timezone = $this->timezone->getTimezoneForLocation(
$cfp->latitude,
$cfp->longitude
);
$cfp->timezone = $this->timezone->getTimezoneForLocation(
$cfp->latitude,
$cfp->longitude
);
}

$cfp->conferenceName = $conference['name'];
$cfp->eventStartDate = new DateTimeImmutable(
Expand Down
4 changes: 2 additions & 2 deletions src/Subcommands/Sessionize/Parser/ClosingDate.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ public function __construct(DateTimeZone $timezone)

public function parse(DOMDocument $dom, DOMXPath $xpath) : DateTimeImmutable
{
$closingDateHolder = $xpath->query('//div[./div/span[contains(text(), "CfS closes at")]]');
$closingDateHolder = $xpath->query('//div[./div/span[contains(text(), "Call closes at")]]');

if (! $closingDateHolder || $closingDateHolder->length == 0) {
throw new InvalidArgumentException('The CfP does not seem to have a closing date');
}

$closingDay = $closingDateHolder->item(0)->getElementsByTagName('h2')->item(0)->textContent;
$closingHour = $closingDateHolder->item(0)->getElementsByTagName('span')->item(0)->textContent;
$closingHour = str_replace('Call closes at ', '', $closingDateHolder->item(0)->getElementsByTagName('span')->item(0)->textContent);

$closingHour = $this->clearClosingHour($closingHour);

Expand Down
11 changes: 10 additions & 1 deletion src/Subcommands/Sessionize/Parser/EventStartDate.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ public function parse(DOMDocument $dom, DOMXPath $xpath) : DateTimeImmutable
//$startDate = $xpath->query('//div[contains(text()[2], "event date")]/following-sibling::h2');
$startDate = $xpath->query('//div[contains(., "event date")]');
}
if (! $startDate || $startDate->length == 0) {
// This expression does not work. It looks like the reason is the array-notation...
//$startDate = $xpath->query('//div[contains(text()[2], "event date")]/following-sibling::h2');
$startDate = $xpath->query('//div[contains(., "planned future dates")]');
}
if (! $startDate || $startDate->length == 0) {
throw new \InvalidArgumentException('The Event does not seem to have a start date-identifier');
}
Expand All @@ -46,6 +51,10 @@ public function parse(DOMDocument $dom, DOMXPath $xpath) : DateTimeImmutable

$startDate = $startDate->item(0)->textContent;

return new DateTimeImmutable($startDate, $this->timezone);
// Make sure that with multiple start-dates separated by a comma
// only the first one is used
$startDate = implode(', ', $startDate);

return new DateTimeImmutable($startDate[0], $this->timezone);
}
}
2 changes: 1 addition & 1 deletion src/Subcommands/Sessionize/Parser/Sessionize.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function parse(WriterInterface $writer)
$writer->write($cfp, 'Sessionize');
$cfpList->append($cfp);
} catch (\Exception $e) {
//error_log($e->getMEssage());
error_log($e->getMEssage() . ' ' . $loc->textContent);
}
}

Expand Down
15 changes: 7 additions & 8 deletions src/Writer/NullOutput.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class NullOutput implements OutputInterface
*
* @return bool true if verbosity is set to VERBOSITY_DEBUG, false otherwise
*/
public function isDebug()
public function isDebug(): bool
{
return false;
}
Expand All @@ -60,7 +60,7 @@ public function setFormatter(OutputFormatterInterface $formatter)
*
* @return bool true if verbosity is set to VERBOSITY_VERBOSE, false otherwise
*/
public function isVerbose()
public function isVerbose(): bool
{
return false;
}
Expand All @@ -70,7 +70,7 @@ public function isVerbose()
*
* @return bool true if verbosity is set to VERBOSITY_VERY_VERBOSE, false otherwise
*/
public function isVeryVerbose()
public function isVeryVerbose(): bool
{
return false;
}
Expand Down Expand Up @@ -125,7 +125,7 @@ public function setVerbosity($level)
* @return int The current level of verbosity (one of the VERBOSITY constants)
* @api
*/
public function getVerbosity()
public function getVerbosity(): int
{
return 0;
}
Expand All @@ -148,18 +148,17 @@ public function setDecorated($decorated)
* @return bool true if the output will decorate messages, false otherwise
* @api
*/
public function isDecorated()
public function isDecorated(): bool
{
return 0;
}

/**
* Returns current output formatter instance.
*
* @return OutputFormatterInterface
* @api
*/
public function getFormatter()
public function getFormatter(): OutputFormatterInterface
{
// TODO: Implement getFormatter() method.
}
Expand All @@ -169,7 +168,7 @@ public function getFormatter()
*
* @return bool true if verbosity is set to VERBOSITY_QUIET, false otherwise
*/
public function isQuiet()
public function isQuiet(): bool
{
// TODO: Implement isQuiet() method.
}
Expand Down

0 comments on commit 15ab89b

Please sign in to comment.