@@ -3,7 +3,6 @@ |
||
3 | 3 | namespace CultuurNet\UDB3\Role\Commands; |
4 | 4 | |
5 | 5 | use ValueObjects\Identity\UUID; |
6 | -use ValueObjects\String\String as stringLiteral; |
|
7 | 6 | |
8 | 7 | class RenameRole extends AbstractCommand |
9 | 8 | { |
@@ -22,7 +22,7 @@ |
||
22 | 22 | } |
23 | 23 | |
24 | 24 | /** |
25 | - * @return StringLiteral |
|
25 | + * @return stringLiteral |
|
26 | 26 | */ |
27 | 27 | public function getName() |
28 | 28 | { |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | $items = new OfferIdentifierCollection(); |
80 | 80 | $totalItems = $cdbId = $elementName = $offerType = $resultXmlString = null; |
81 | 81 | |
82 | - $resetCurrentResultValues = function () use (&$cdbId, &$elementName, &$offerType, &$resultXmlString) { |
|
82 | + $resetCurrentResultValues = function() use (&$cdbId, &$elementName, &$offerType, &$resultXmlString) { |
|
83 | 83 | $cdbId = null; |
84 | 84 | $elementName = self::CDBXML_TYPE_UNKNOWN; |
85 | 85 | $offerType = self::OFFER_TYPE_UNKNOWN; |
@@ -93,13 +93,13 @@ discard block |
||
93 | 93 | |
94 | 94 | while ($r->read()) { |
95 | 95 | if ($this->xmlNodeIsNumberOfRecordsTag($r)) { |
96 | - $totalItems = new Integer((int) $r->readString()); |
|
96 | + $totalItems = new Integer((int)$r->readString()); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | if ($this->xmlNodeIsResultOpeningTag($r)) { |
100 | 100 | $resultXmlString = $r->readOuterXml(); |
101 | 101 | $cdbId = $r->getAttribute('cdbid'); |
102 | - $elementName = 'cdbxml.' . $r->localName; |
|
102 | + $elementName = 'cdbxml.'.$r->localName; |
|
103 | 103 | |
104 | 104 | if ($elementName == self::CDBXML_TYPE_EVENT) { |
105 | 105 | $offerType = self::OFFER_TYPE_EVENT; |
@@ -3,7 +3,6 @@ |
||
3 | 3 | namespace CultuurNet\UDB3\Role\Commands; |
4 | 4 | |
5 | 5 | use ValueObjects\Identity\UUID; |
6 | -use ValueObjects\String\String as stringLiteral; |
|
7 | 6 | |
8 | 7 | class RenameRole extends AbstractCommand |
9 | 8 | { |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | /** |
16 | 16 | * AbstractPermissionEvent constructor. |
17 | 17 | * @param UUID $uuid |
18 | - * @param StringLiteral $query |
|
18 | + * @param stringLiteral $query |
|
19 | 19 | */ |
20 | 20 | public function __construct(UUID $uuid, StringLiteral $query) |
21 | 21 | { |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | } |
25 | 25 | |
26 | 26 | /** |
27 | - * @return StringLiteral |
|
27 | + * @return string|null |
|
28 | 28 | */ |
29 | 29 | public function getQuery() |
30 | 30 | { |
@@ -116,7 +116,7 @@ |
||
116 | 116 | } |
117 | 117 | |
118 | 118 | /** |
119 | - * @return string |
|
119 | + * @return UUID |
|
120 | 120 | */ |
121 | 121 | public function getFileId() |
122 | 122 | { |
@@ -142,7 +142,7 @@ |
||
142 | 142 | { |
143 | 143 | $uuid = null; |
144 | 144 | |
145 | - $name = new StringLiteral((string) $labelEvent->getLabel()); |
|
145 | + $name = new StringLiteral((string)$labelEvent->getLabel()); |
|
146 | 146 | |
147 | 147 | $entity = $this->readRepository->getByName($name); |
148 | 148 | if ($entity !== null) { |
@@ -124,6 +124,9 @@ discard block |
||
124 | 124 | return $expandedProperties; |
125 | 125 | } |
126 | 126 | |
127 | + /** |
|
128 | + * @param string[] $include |
|
129 | + */ |
|
127 | 130 | protected function includedOrDefaultProperties($include) |
128 | 131 | { |
129 | 132 | if ($include) { |
@@ -462,7 +465,7 @@ discard block |
||
462 | 465 | } |
463 | 466 | |
464 | 467 | /** |
465 | - * @param object $event |
|
468 | + * @param \stdClass $event |
|
466 | 469 | * @param string|null $type |
467 | 470 | * @return object |
468 | 471 | */ |
@@ -173,14 +173,14 @@ discard block |
||
173 | 173 | protected function columns() |
174 | 174 | { |
175 | 175 | $formatter = $this; |
176 | - $contactPoint = function (\stdClass $event) use ($formatter) { |
|
176 | + $contactPoint = function(\stdClass $event) use ($formatter) { |
|
177 | 177 | return $formatter->contactPoint($event); |
178 | 178 | }; |
179 | 179 | |
180 | 180 | return [ |
181 | 181 | 'id' => [ |
182 | 182 | 'name' => 'id', |
183 | - 'include' => function ($event) { |
|
183 | + 'include' => function($event) { |
|
184 | 184 | $eventUri = $event->{'@id'}; |
185 | 185 | $uriParts = explode('/', $eventUri); |
186 | 186 | $eventId = array_pop($uriParts); |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | ], |
192 | 192 | 'name' => [ |
193 | 193 | 'name' => 'titel', |
194 | - 'include' => function ($event) { |
|
194 | + 'include' => function($event) { |
|
195 | 195 | if ($event->name) { |
196 | 196 | return reset($event->name); |
197 | 197 | } |
@@ -200,14 +200,14 @@ discard block |
||
200 | 200 | ], |
201 | 201 | 'creator' => [ |
202 | 202 | 'name' => 'auteur', |
203 | - 'include' => function ($event) { |
|
203 | + 'include' => function($event) { |
|
204 | 204 | return $event->creator; |
205 | 205 | }, |
206 | 206 | 'property' => 'creator' |
207 | 207 | ], |
208 | 208 | 'bookingInfo.price' => [ |
209 | 209 | 'name' => 'prijs', |
210 | - 'include' => function ($event) { |
|
210 | + 'include' => function($event) { |
|
211 | 211 | if (property_exists($event, 'bookingInfo') && is_array($event->bookingInfo)) { |
212 | 212 | $first = reset($event->bookingInfo); |
213 | 213 | if (is_object($first) && property_exists($first, 'price')) { |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | ], |
220 | 220 | 'kansentarief' => [ |
221 | 221 | 'name' => 'kansentarief', |
222 | - 'include' => function ($event) { |
|
222 | + 'include' => function($event) { |
|
223 | 223 | $eventUri = $event->{'@id'}; |
224 | 224 | $uriParts = explode('/', $eventUri); |
225 | 225 | $eventId = array_pop($uriParts); |
@@ -228,18 +228,18 @@ discard block |
||
228 | 228 | if ($uitpasInfo) { |
229 | 229 | $uitpasInfo = $this->uitpasInfoFormatter->format($uitpasInfo); |
230 | 230 | |
231 | - $cardSystems = array_reduce($uitpasInfo['prices'], function ($cardSystems, $tariff) { |
|
231 | + $cardSystems = array_reduce($uitpasInfo['prices'], function($cardSystems, $tariff) { |
|
232 | 232 | $cardSystem = isset($cardSystems[$tariff['cardSystem']]) ? $cardSystems[$tariff['cardSystem']] : ''; |
233 | 233 | $cardSystem = empty($cardSystem) |
234 | - ? $tariff['cardSystem'] .': € ' . $tariff['price'] |
|
235 | - : $cardSystem . ' / € ' . $tariff['price']; |
|
234 | + ? $tariff['cardSystem'].': € '.$tariff['price'] |
|
235 | + : $cardSystem.' / € '.$tariff['price']; |
|
236 | 236 | |
237 | 237 | $cardSystems[$tariff['cardSystem']] = $cardSystem; |
238 | 238 | return $cardSystems; |
239 | 239 | }, []); |
240 | 240 | |
241 | - $formattedTariffs = array_reduce($cardSystems, function ($tariffs, $cardSystemPrices) { |
|
242 | - return $tariffs ? $tariffs . ' | ' . $cardSystemPrices : $cardSystemPrices; |
|
241 | + $formattedTariffs = array_reduce($cardSystems, function($tariffs, $cardSystemPrices) { |
|
242 | + return $tariffs ? $tariffs.' | '.$cardSystemPrices : $cardSystemPrices; |
|
243 | 243 | }); |
244 | 244 | |
245 | 245 | if (!empty($formattedTariffs)) { |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | ], |
252 | 252 | 'bookingInfo.url' => [ |
253 | 253 | 'name' => 'ticket link', |
254 | - 'include' => function ($event) { |
|
254 | + 'include' => function($event) { |
|
255 | 255 | if (property_exists($event, 'bookingInfo')) { |
256 | 256 | $first = reset($event->bookingInfo); |
257 | 257 | if (is_object($first) && property_exists($first, 'url')) { |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | ], |
264 | 264 | 'description' => [ |
265 | 265 | 'name' => 'omschrijving', |
266 | - 'include' => function ($event) { |
|
266 | + 'include' => function($event) { |
|
267 | 267 | if (property_exists($event, 'description')) { |
268 | 268 | $description = reset($event->description); |
269 | 269 | |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | ], |
284 | 284 | 'organizer' => [ |
285 | 285 | 'name' => 'organisatie', |
286 | - 'include' => function ($event) { |
|
286 | + 'include' => function($event) { |
|
287 | 287 | if (property_exists($event, 'organizer') && |
288 | 288 | isset($event->organizer->name) |
289 | 289 | ) { |
@@ -294,14 +294,14 @@ discard block |
||
294 | 294 | ], |
295 | 295 | 'calendarSummary' => [ |
296 | 296 | 'name' => 'tijdsinformatie', |
297 | - 'include' => function ($event) { |
|
297 | + 'include' => function($event) { |
|
298 | 298 | return $event->calendarSummary; |
299 | 299 | }, |
300 | 300 | 'property' => 'calendarSummary' |
301 | 301 | ], |
302 | 302 | 'labels' => [ |
303 | 303 | 'name' => 'labels', |
304 | - 'include' => function ($event) { |
|
304 | + 'include' => function($event) { |
|
305 | 305 | if (isset($event->labels)) { |
306 | 306 | return implode(';', $event->labels); |
307 | 307 | } |
@@ -310,14 +310,14 @@ discard block |
||
310 | 310 | ], |
311 | 311 | 'typicalAgeRange' => [ |
312 | 312 | 'name' => 'leeftijd', |
313 | - 'include' => function ($event) { |
|
313 | + 'include' => function($event) { |
|
314 | 314 | return $event->typicalAgeRange; |
315 | 315 | }, |
316 | 316 | 'property' => 'typicalAgeRange' |
317 | 317 | ], |
318 | 318 | 'performer' => [ |
319 | 319 | 'name' => 'uitvoerders', |
320 | - 'include' => function ($event) { |
|
320 | + 'include' => function($event) { |
|
321 | 321 | if (property_exists($event, 'performer')) { |
322 | 322 | $performerNames = []; |
323 | 323 | foreach ($event->performer as $performer) { |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | ], |
332 | 332 | 'language' => [ |
333 | 333 | 'name' => 'taal van het aanbod', |
334 | - 'include' => function ($event) { |
|
334 | + 'include' => function($event) { |
|
335 | 335 | if (property_exists($event, 'language')) { |
336 | 336 | return implode(';', $event->language); |
337 | 337 | } |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | ], |
341 | 341 | 'terms.theme' => [ |
342 | 342 | 'name' => 'thema', |
343 | - 'include' => function ($event) { |
|
343 | + 'include' => function($event) { |
|
344 | 344 | if (property_exists($event, 'terms')) { |
345 | 345 | foreach ($event->terms as $term) { |
346 | 346 | if ($term->domain && $term->label && $term->domain == 'theme') { |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | ], |
354 | 354 | 'terms.eventtype' => [ |
355 | 355 | 'name' => 'soort aanbod', |
356 | - 'include' => function ($event) { |
|
356 | + 'include' => function($event) { |
|
357 | 357 | if (property_exists($event, 'terms')) { |
358 | 358 | foreach ($event->terms as $term) { |
359 | 359 | if ($term->domain && $term->label && $term->domain == 'eventtype') { |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | ], |
367 | 367 | 'created' => [ |
368 | 368 | 'name' => 'datum aangemaakt', |
369 | - 'include' => function ($event) { |
|
369 | + 'include' => function($event) { |
|
370 | 370 | if (!empty($event->created)) { |
371 | 371 | return $this->formatDate($event->created); |
372 | 372 | } else { |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | ], |
378 | 378 | 'modified' => [ |
379 | 379 | 'name' => 'datum laatste aanpassing', |
380 | - 'include' => function ($event) { |
|
380 | + 'include' => function($event) { |
|
381 | 381 | if (!empty($event->modified)) { |
382 | 382 | return $this->formatDate($event->modified); |
383 | 383 | } else { |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | ], |
389 | 389 | 'available' => [ |
390 | 390 | 'name' => 'embargodatum', |
391 | - 'include' => function ($event) { |
|
391 | + 'include' => function($event) { |
|
392 | 392 | if (!empty($event->available)) { |
393 | 393 | return $this->formatDateWithoutTime($event->available); |
394 | 394 | } else { |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | ], |
400 | 400 | 'startDate' => [ |
401 | 401 | 'name' => 'startdatum', |
402 | - 'include' => function ($event) { |
|
402 | + 'include' => function($event) { |
|
403 | 403 | if (!empty($event->startDate)) { |
404 | 404 | return $this->formatDate($event->startDate); |
405 | 405 | } else { |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | ], |
411 | 411 | 'endDate' => [ |
412 | 412 | 'name' => 'einddatum', |
413 | - 'include' => function ($event) { |
|
413 | + 'include' => function($event) { |
|
414 | 414 | if (!empty($event->endDate)) { |
415 | 415 | return $this->formatDate($event->endDate); |
416 | 416 | } else { |
@@ -421,14 +421,14 @@ discard block |
||
421 | 421 | ], |
422 | 422 | 'calendarType' => [ |
423 | 423 | 'name' => 'tijd type', |
424 | - 'include' => function ($event) { |
|
424 | + 'include' => function($event) { |
|
425 | 425 | return $event->calendarType; |
426 | 426 | }, |
427 | 427 | 'property' => 'calendarType' |
428 | 428 | ], |
429 | 429 | 'location' => [ |
430 | 430 | 'name' => 'locatie naam', |
431 | - 'include' => function ($event) { |
|
431 | + 'include' => function($event) { |
|
432 | 432 | if (property_exists($event, 'location') && isset($event->location->name)) { |
433 | 433 | return reset($event->location->name); |
434 | 434 | } |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | ], |
438 | 438 | 'address.streetAddress' => [ |
439 | 439 | 'name' => 'straat', |
440 | - 'include' => function ($event) { |
|
440 | + 'include' => function($event) { |
|
441 | 441 | if (isset($event->location->address->streetAddress)) { |
442 | 442 | return $event->location->address->streetAddress; |
443 | 443 | } |
@@ -446,7 +446,7 @@ discard block |
||
446 | 446 | ], |
447 | 447 | 'address.postalCode' => [ |
448 | 448 | 'name' => 'postcode', |
449 | - 'include' => function ($event) { |
|
449 | + 'include' => function($event) { |
|
450 | 450 | if (isset($event->location->address->postalCode)) { |
451 | 451 | return $event->location->address->postalCode; |
452 | 452 | } |
@@ -455,7 +455,7 @@ discard block |
||
455 | 455 | ], |
456 | 456 | 'address.addressLocality' => [ |
457 | 457 | 'name' => 'gemeente', |
458 | - 'include' => function ($event) { |
|
458 | + 'include' => function($event) { |
|
459 | 459 | if (isset($event->location->address->addressLocality)) { |
460 | 460 | return $event->location->address->addressLocality; |
461 | 461 | } |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | ], |
465 | 465 | 'address.addressCountry' => [ |
466 | 466 | 'name' => 'land', |
467 | - 'include' => function ($event) { |
|
467 | + 'include' => function($event) { |
|
468 | 468 | if (isset($event->location->address->addressCountry)) { |
469 | 469 | return $event->location->address->addressCountry; |
470 | 470 | } |
@@ -473,14 +473,14 @@ discard block |
||
473 | 473 | ], |
474 | 474 | 'image' => [ |
475 | 475 | 'name' => 'afbeelding', |
476 | - 'include' => function ($event) { |
|
476 | + 'include' => function($event) { |
|
477 | 477 | return !empty($event->image) ? $event->image : ''; |
478 | 478 | }, |
479 | 479 | 'property' => 'image' |
480 | 480 | ], |
481 | 481 | 'sameAs' => [ |
482 | 482 | 'name' => 'externe ids', |
483 | - 'include' => function ($event) { |
|
483 | + 'include' => function($event) { |
|
484 | 484 | if (property_exists($event, 'sameAs')) { |
485 | 485 | $ids = array(); |
486 | 486 | |
@@ -495,7 +495,7 @@ discard block |
||
495 | 495 | ], |
496 | 496 | 'contactPoint.email' => [ |
497 | 497 | 'name' => 'e-mail', |
498 | - 'include' => function ($event) use ($contactPoint) { |
|
498 | + 'include' => function($event) use ($contactPoint) { |
|
499 | 499 | return $this->listJsonldProperty( |
500 | 500 | $contactPoint($event), |
501 | 501 | 'email' |
@@ -505,7 +505,7 @@ discard block |
||
505 | 505 | ], |
506 | 506 | 'contactPoint.telephone' => [ |
507 | 507 | 'name' => 'telefoon', |
508 | - 'include' => function ($event) use ($contactPoint) { |
|
508 | + 'include' => function($event) use ($contactPoint) { |
|
509 | 509 | return $this->listJsonldProperty( |
510 | 510 | $contactPoint($event), |
511 | 511 | 'telephone' |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | ], |
516 | 516 | 'contactPoint.url' => [ |
517 | 517 | 'name' => 'url', |
518 | - 'include' => function ($event) use ($contactPoint) { |
|
518 | + 'include' => function($event) use ($contactPoint) { |
|
519 | 519 | $contactUrls = $this->listJsonldProperty( |
520 | 520 | $contactPoint($event), |
521 | 521 | 'url' |
@@ -526,7 +526,7 @@ discard block |
||
526 | 526 | ], |
527 | 527 | 'contactPoint.reservations.email' => [ |
528 | 528 | 'name' => 'e-mail reservaties', |
529 | - 'include' => function ($event) use ($contactPoint) { |
|
529 | + 'include' => function($event) use ($contactPoint) { |
|
530 | 530 | return $this->listJsonldProperty( |
531 | 531 | $contactPoint($event, 'Reservations'), |
532 | 532 | 'email' |
@@ -536,7 +536,7 @@ discard block |
||
536 | 536 | ], |
537 | 537 | 'contactPoint.reservations.telephone' => [ |
538 | 538 | 'name' => 'telefoon reservaties', |
539 | - 'include' => function ($event) use ($contactPoint) { |
|
539 | + 'include' => function($event) use ($contactPoint) { |
|
540 | 540 | return $this->listJsonldProperty( |
541 | 541 | $contactPoint($event, 'Reservations'), |
542 | 542 | 'telephone' |
@@ -546,7 +546,7 @@ discard block |
||
546 | 546 | ], |
547 | 547 | 'contactPoint.reservations.url' => [ |
548 | 548 | 'name' => 'online reservaties', |
549 | - 'include' => function ($event) use ($contactPoint) { |
|
549 | + 'include' => function($event) use ($contactPoint) { |
|
550 | 550 | return $this->listJsonldProperty( |
551 | 551 | $contactPoint($event, 'Reservations'), |
552 | 552 | 'url' |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | |
82 | 82 | if (!empty($query)) { |
83 | 83 | $q->where($expr->like('name', ':role_name')); |
84 | - $q->setParameter('role_name', '%' . $query . '%'); |
|
84 | + $q->setParameter('role_name', '%'.$query.'%'); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | $results = $q->execute()->fetchAll(\PDO::FETCH_ASSOC); |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | |
97 | 97 | if (!empty($query)) { |
98 | 98 | $q->where($expr->like('name', ':role_name')); |
99 | - $q->setParameter('role_name', '%' . $query . '%'); |
|
99 | + $q->setParameter('role_name', '%'.$query.'%'); |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | $total = $q->execute()->fetchColumn(); |
@@ -12,9 +12,9 @@ |
||
12 | 12 | */ |
13 | 13 | public function format(Address $address) |
14 | 14 | { |
15 | - return $address->getStreetAddress() . ', ' . |
|
16 | - $address->getPostalCode() . ' ' . |
|
17 | - $address->getLocality() . ', ' . |
|
15 | + return $address->getStreetAddress().', '. |
|
16 | + $address->getPostalCode().' '. |
|
17 | + $address->getLocality().', '. |
|
18 | 18 | $address->getCountry(); |
19 | 19 | } |
20 | 20 | } |
@@ -11,7 +11,7 @@ |
||
11 | 11 | public function filter($string) |
12 | 12 | { |
13 | 13 | if (!is_string($string)) { |
14 | - throw new \InvalidArgumentException('Argument should be string, got ' . gettype($string) . ' instead.'); |
|
14 | + throw new \InvalidArgumentException('Argument should be string, got '.gettype($string).' instead.'); |
|
15 | 15 | } |
16 | 16 | |
17 | 17 | return preg_replace("/(\\n)+/", " ", $string); |