Indentation fixes
This commit is contained in:
parent
aaf09e61c1
commit
cdf588bc47
|
@ -54,10 +54,10 @@ class FormatTalksExtension extends Twig_Extension
|
||||||
public function getUpcoming($talks, array $eventData = [])
|
public function getUpcoming($talks, array $eventData = [])
|
||||||
{
|
{
|
||||||
return $this->format($talks, $eventData)
|
return $this->format($talks, $eventData)
|
||||||
->filter(function ($talk) {
|
->filter(function ($talk) {
|
||||||
return $talk['event']['date'] >= $this->today;
|
return $talk['event']['date'] >= $this->today;
|
||||||
})
|
})
|
||||||
->sortBy('event.date');
|
->sortBy('event.date');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -72,10 +72,10 @@ class FormatTalksExtension extends Twig_Extension
|
||||||
public function getPast($talks, array $eventData = [])
|
public function getPast($talks, array $eventData = [])
|
||||||
{
|
{
|
||||||
return $this->format($talks, $eventData)
|
return $this->format($talks, $eventData)
|
||||||
->filter(function ($talk) {
|
->filter(function ($talk) {
|
||||||
return $talk['event']['date'] < $this->today;
|
return $talk['event']['date'] < $this->today;
|
||||||
})
|
})
|
||||||
->sortByDesc('event.date');
|
->sortByDesc('event.date');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -93,12 +93,13 @@ class FormatTalksExtension extends Twig_Extension
|
||||||
// Build an associative array with the talk, as well as the
|
// Build an associative array with the talk, as well as the
|
||||||
// specified event data (e.g. date and time) as well as the shared
|
// specified event data (e.g. date and time) as well as the shared
|
||||||
// event data (e.g. event name and website).
|
// event data (e.g. event name and website).
|
||||||
return collect($talk['events'])->map(function ($event) use ($talk, $event_data) {
|
return collect($talk['events'])
|
||||||
$event = collect($event);
|
->map(function ($event) use ($talk, $event_data) {
|
||||||
$event = $event->merge($event_data->get($event->get('event')))->all();
|
$event = collect($event);
|
||||||
|
$event = $event->merge($event_data->get($event->get('event')))->all();
|
||||||
|
|
||||||
return compact('event', 'talk');
|
return compact('event', 'talk');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,32 +28,32 @@ class FormatTalksTest extends TestCase
|
||||||
public function testFormat()
|
public function testFormat()
|
||||||
{
|
{
|
||||||
$event_data = [
|
$event_data = [
|
||||||
'event-a' => [
|
'event-a' => [
|
||||||
'name' => 'Event A',
|
'name' => 'Event A',
|
||||||
'location' => 'Somewhere',
|
'location' => 'Somewhere',
|
||||||
'website' => 'http://event-a.com',
|
'website' => 'http://event-a.com',
|
||||||
],
|
],
|
||||||
'event-b' => [
|
'event-b' => [
|
||||||
'name' => 'Event B',
|
'name' => 'Event B',
|
||||||
'location' => 'Somewhere else',
|
'location' => 'Somewhere else',
|
||||||
'website' => 'http://event-b.com',
|
'website' => 'http://event-b.com',
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
$talks = [
|
$talks = [
|
||||||
[
|
[
|
||||||
'title' => 'Talk A',
|
'title' => 'Talk A',
|
||||||
'events' => [
|
'events' => [
|
||||||
['event' => 'event-a', 'date' => '2018-01-01', 'time' => '09:00'],
|
['event' => 'event-a', 'date' => '2018-01-01', 'time' => '09:00'],
|
||||||
['event' => 'event-b', 'date' => '2018-01-30', 'time' => '12:00'],
|
['event' => 'event-b', 'date' => '2018-01-30', 'time' => '12:00'],
|
||||||
],
|
|
||||||
],
|
],
|
||||||
[
|
],
|
||||||
'title' => 'Talk B',
|
[
|
||||||
'events' => [
|
'title' => 'Talk B',
|
||||||
['event' => 'event-b', 'date' => '2018-01-31', 'time' => '17:00'],
|
'events' => [
|
||||||
],
|
['event' => 'event-b', 'date' => '2018-01-31', 'time' => '17:00'],
|
||||||
],
|
],
|
||||||
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
$results = $this->extension->format($talks, $event_data)->all();
|
$results = $this->extension->format($talks, $event_data)->all();
|
||||||
|
|
Loading…
Reference in a new issue