| Total Complexity | 100 |
| Total Lines | 832 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
Complex classes like Bookwhen often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use Bookwhen, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 21 | final class Bookwhen implements BookwhenInterface |
||
| 22 | { |
||
| 23 | private null | Client $client; |
||
| 24 | |||
| 25 | /** |
||
| 26 | * |
||
| 27 | * @var unknown |
||
|
|
|||
| 28 | */ |
||
| 29 | public Attachment $attachment; |
||
| 30 | |||
| 31 | /** |
||
| 32 | * |
||
| 33 | * @var unknown |
||
| 34 | */ |
||
| 35 | public array $attachments = []; |
||
| 36 | |||
| 37 | /** |
||
| 38 | * |
||
| 39 | * @var unknown |
||
| 40 | */ |
||
| 41 | public ClassPass $classPass; |
||
| 42 | |||
| 43 | /** |
||
| 44 | * |
||
| 45 | * @var unknown |
||
| 46 | */ |
||
| 47 | public array $classPasses = []; |
||
| 48 | |||
| 49 | /** |
||
| 50 | * |
||
| 51 | * @var unknown |
||
| 52 | */ |
||
| 53 | public Event $event; |
||
| 54 | |||
| 55 | /** |
||
| 56 | * |
||
| 57 | * @var unknown |
||
| 58 | */ |
||
| 59 | public array $events = []; |
||
| 60 | |||
| 61 | /** |
||
| 62 | * |
||
| 63 | * @var unknown |
||
| 64 | */ |
||
| 65 | private array $filters = []; |
||
| 66 | |||
| 67 | /** |
||
| 68 | * |
||
| 69 | */ |
||
| 70 | public readonly Location $location; |
||
| 71 | |||
| 72 | /** |
||
| 73 | * |
||
| 74 | * @var unknown |
||
| 75 | */ |
||
| 76 | private array $includes = []; |
||
| 77 | /** |
||
| 78 | |||
| 79 | */ |
||
| 80 | public Ticket $ticket; |
||
| 81 | |||
| 82 | /** |
||
| 83 | |||
| 84 | */ |
||
| 85 | public array $tickets = []; |
||
| 86 | |||
| 87 | /** |
||
| 88 | * |
||
| 89 | */ |
||
| 90 | public $locations = []; |
||
| 91 | |||
| 92 | |||
| 93 | /** @var string The path to the log file */ |
||
| 94 | private $logFile; |
||
| 95 | |||
| 96 | /** @var object loging object. */ |
||
| 97 | private $logger; |
||
| 98 | |||
| 99 | /** @var string the logging level. */ |
||
| 100 | private string $logLevel; |
||
| 101 | |||
| 102 | |||
| 103 | |||
| 104 | /** |
||
| 105 | * Creates a new Bookwhen Client with the given API token. |
||
| 106 | * @todo logging |
||
| 107 | */ |
||
| 108 | public function __construct( |
||
| 116 | } |
||
| 117 | |||
| 118 | /** |
||
| 119 | * |
||
| 120 | * {@inheritDoc} |
||
| 121 | * @see \InShore\Bookwhen\Interfaces\ClientInterface::attachment() |
||
| 122 | * @todo all attachment properties |
||
| 123 | */ |
||
| 124 | public function attachment(string $attachmentId): Attachment |
||
| 125 | { |
||
| 126 | if (!$this->validator->validId($attachmentId, 'attachment')) { |
||
| 127 | throw new ValidationException('attachmentId', $attachmentId); |
||
| 128 | } |
||
| 129 | |||
| 130 | $attachment = $this->client->attachments()->retrieve($attachmentId); |
||
| 131 | |||
| 132 | return $this->attachment = new Attachment( |
||
| 133 | $attachment->contentType, |
||
| 134 | $attachment->fileUrl, |
||
| 135 | $attachment->fileSizeBytes, |
||
| 136 | $attachment->fileSizeText, |
||
| 137 | $attachment->fileName, |
||
| 138 | $attachment->fileType, |
||
| 139 | $attachment->id, |
||
| 140 | $attachment->title, |
||
| 141 | ); |
||
| 142 | } |
||
| 143 | |||
| 144 | /** |
||
| 145 | * |
||
| 146 | * {@inheritDoc} |
||
| 147 | * @see \InShore\Bookwhen\Interfaces\BookwhenInterface::attachment() |
||
| 148 | * @todo |
||
| 149 | */ |
||
| 150 | public function attachments( |
||
| 151 | string $title = null, |
||
| 152 | string $fileName = null, |
||
| 153 | string $fileType = null |
||
| 154 | ): array { |
||
| 155 | //$this->logger->debug(__METHOD__ . '(' . var_export(func_get_args(), true) . ')'); |
||
| 156 | |||
| 157 | if (!is_null($title) && !$this->validator->validTitle($title)) { |
||
| 158 | throw new ValidationException('title', $title); |
||
| 159 | } else { |
||
| 160 | $this->filters['filter[title]'] = $title; |
||
| 161 | } |
||
| 162 | |||
| 163 | if (!is_null($fileName) && !$this->validator->validFileName($fileName)) { |
||
| 164 | throw new ValidationException('file name', $fileName); |
||
| 165 | } else { |
||
| 166 | $this->filters['filter[file_name]'] = $fileName; |
||
| 167 | } |
||
| 168 | |||
| 169 | if (!is_null($fileType) && !$this->validator->validFileType($fileType)) { |
||
| 170 | throw new ValidationException('file type', $fileType); |
||
| 171 | } else { |
||
| 172 | $this->filters['filter[file_type]'] = $fileType; |
||
| 173 | } |
||
| 174 | |||
| 175 | $attachments = $this->client->attachments()->list($this->filters); |
||
| 176 | |||
| 177 | foreach ($attachments->data as $attachment) { |
||
| 178 | array_push($this->attachments, new Attachment( |
||
| 179 | $attachment->contentType, |
||
| 180 | $attachment->fileUrl, |
||
| 181 | $attachment->fileSizeBytes, |
||
| 182 | $attachment->fileSizeText, |
||
| 183 | $attachment->fileName, |
||
| 184 | $attachment->fileType, |
||
| 185 | $attachment->id, |
||
| 186 | $attachment->title |
||
| 187 | )); |
||
| 188 | } |
||
| 189 | |||
| 190 | return $this->attachments; |
||
| 191 | } |
||
| 192 | |||
| 193 | /** |
||
| 194 | * |
||
| 195 | * {@inheritDoc} |
||
| 196 | * @see \InShore\Bookwhen\Interfaces\ClientInterface::getClassPass() |
||
| 197 | * @todo |
||
| 198 | */ |
||
| 199 | public function classPass(string $classPassId): ClassPass |
||
| 200 | { |
||
| 201 | // $this->logger->debug(__METHOD__ . '(' . var_export(func_get_args(), true) . ')'); |
||
| 202 | |||
| 203 | // if (!$this->validator->validId($classPassId, 'classPass')) { |
||
| 204 | // throw new ValidationException('classPassId', $classPassId); |
||
| 205 | // } |
||
| 206 | |||
| 207 | $classPass = $this->client->classPasses()->retrieve($classPassId); |
||
| 208 | |||
| 209 | return new ClassPass( |
||
| 210 | $classPass->details, |
||
| 211 | $classPass->id, |
||
| 212 | $classPass->number_available, |
||
| 213 | $classPass->title, |
||
| 214 | $classPass->usage_allowance, |
||
| 215 | $classPass->usage_type, |
||
| 216 | $classPass->use_restricted_for_days |
||
| 217 | ); |
||
| 218 | } |
||
| 219 | |||
| 220 | /** |
||
| 221 | * |
||
| 222 | * {@inheritDoc} |
||
| 223 | * @see \InShore\Bookwhen\Interfaces\ClientInterface::getClassPasses() |
||
| 224 | * @todo break params on to multiplper lines.. |
||
| 225 | */ |
||
| 226 | public function classPasses( |
||
| 227 | $title = null, |
||
| 228 | $detail = null, |
||
| 229 | $usageType = null, |
||
| 230 | $cost = null, |
||
| 231 | $usageAllowance = null, |
||
| 232 | $useRestrictedForDays = null |
||
| 233 | ): array { |
||
| 234 | |||
| 235 | //$this->logger->debug(__METHOD__ . '(' . var_export(func_get_args(), true) . ')'); |
||
| 236 | |||
| 237 | if (!is_null($title) && !$this->validator->validTitle($title)) { |
||
| 238 | throw new ValidationException('title', $title); |
||
| 239 | } |
||
| 240 | |||
| 241 | // @todo remaingin validation |
||
| 242 | |||
| 243 | $classPasses = $this->client->classPasses()->list([]); |
||
| 244 | |||
| 245 | foreach ($classPasses->data as $classPass) { |
||
| 246 | array_push($this->classPasses, new classPasses( |
||
| 247 | $ticket->details, |
||
| 248 | $ticket->id, |
||
| 249 | $ticket->title |
||
| 250 | )); |
||
| 251 | } |
||
| 252 | return $this->classPasses; |
||
| 253 | } |
||
| 254 | |||
| 255 | /** |
||
| 256 | * |
||
| 257 | * {@inheritDoc} |
||
| 258 | * @see \InShore\Bookwhen\Interfaces\BookwhenInterface::event() |
||
| 259 | * @todo filters. |
||
| 260 | */ |
||
| 261 | public function event( |
||
| 262 | string $eventId, |
||
| 263 | bool $includeAttachments = false, |
||
| 264 | bool $includeLocation = false, |
||
| 265 | bool $includeTickets = false, |
||
| 266 | bool $includeTicketsClassPasses = false, |
||
| 267 | bool $includeTicketsEvents = false |
||
| 268 | ): Event { |
||
| 269 | //$this->logger->debug(__METHOD__ . '(' . var_export(func_get_args(), true) . ')'); |
||
| 270 | |||
| 271 | if (!$this->validator->validId($eventId, 'event')) { |
||
| 272 | throw new ValidationException('eventId', $eventId); |
||
| 273 | } |
||
| 274 | |||
| 275 | // Validate $includeAttachments; |
||
| 276 | if (!$this->validator->validInclude($includeAttachments)) { |
||
| 277 | throw new ValidationException('includeAttachments', $includeAttachments); |
||
| 278 | } else { |
||
| 279 | if($includeAttachments) { |
||
| 280 | array_push($this->includes, 'attachments'); |
||
| 281 | } |
||
| 282 | } |
||
| 283 | |||
| 284 | // Validate $includeTickets; |
||
| 285 | if (!$this->validator->validInclude($includeLocation)) { |
||
| 286 | throw new ValidationException('includeLocation', $includeLocation); |
||
| 287 | } else { |
||
| 288 | if($includeLocation) { |
||
| 289 | array_push($this->includes, 'location'); |
||
| 290 | } |
||
| 291 | } |
||
| 292 | |||
| 293 | // Validate $includeTickets; |
||
| 294 | if (!$this->validator->validInclude($includeTickets)) { |
||
| 295 | throw new ValidationException('includeTickets', $includeTickets); |
||
| 296 | } else { |
||
| 297 | if($includeTickets) { |
||
| 298 | array_push($this->includes, 'tickets'); |
||
| 299 | } |
||
| 300 | } |
||
| 301 | |||
| 302 | // Validate $includeTicketsEvents; |
||
| 303 | if (!$this->validator->validInclude($includeTicketsEvents)) { |
||
| 304 | throw new ValidationException('includeTicketsEvents', $includeTicketsEvents); |
||
| 305 | } else { |
||
| 306 | if($includeTicketsEvents) { |
||
| 307 | array_push($this->includes, 'tickets.events'); |
||
| 308 | } |
||
| 309 | } |
||
| 310 | |||
| 311 | // Validate $includeTicketsClassPasses; |
||
| 312 | if (!$this->validator->validInclude($includeTicketsClassPasses)) { |
||
| 313 | throw new ValidationException('includeTicketsClassPasses', $includeTicketsClassPasses); |
||
| 314 | } else { |
||
| 315 | if($includeTicketsClassPasses) { |
||
| 316 | array_push($this->includes, 'tickets.class_passes'); |
||
| 317 | } |
||
| 318 | } |
||
| 319 | |||
| 320 | $event = $this->client->events()->retrieve($eventId, ['include' => implode(',', $this->includes)]); |
||
| 321 | |||
| 322 | // attachments |
||
| 323 | $eventAttachments = []; |
||
| 324 | |||
| 325 | foreach ($event->attachments as $eventAttachment) { |
||
| 326 | $attachment = $this->client->attachments()->retrieve($eventAttachment['id']); |
||
| 327 | array_push($eventAttachments, new Attachment( |
||
| 328 | $attachment->contentType, |
||
| 329 | $attachment->fileUrl, |
||
| 330 | $attachment->fileSizeBytes, |
||
| 331 | $attachment->fileSizeText, |
||
| 332 | $attachment->fileName, |
||
| 333 | $attachment->fileType, |
||
| 334 | $attachment->id, |
||
| 335 | $attachment->title |
||
| 336 | )); |
||
| 337 | } |
||
| 338 | |||
| 339 | // eventTickets |
||
| 340 | $eventTickets = []; |
||
| 341 | foreach($event->tickets as $ticket) { |
||
| 342 | array_push($eventTickets, new Ticket( |
||
| 343 | $ticket->available, |
||
| 344 | $ticket->availableFrom, |
||
| 345 | $ticket->availableTo, |
||
| 346 | $ticket->builtBasketUrl, |
||
| 347 | $ticket->builtBasketIframeUrl, |
||
| 348 | $ticket->courseTicket, |
||
| 349 | $ticket->details, |
||
| 350 | $ticket->groupTicket, |
||
| 351 | $ticket->groupMin, |
||
| 352 | $ticket->groupMax, |
||
| 353 | $ticket->id, |
||
| 354 | $ticket->numberIssued, |
||
| 355 | $ticket->numberTaken, |
||
| 356 | $ticket->title |
||
| 357 | )); |
||
| 358 | } |
||
| 359 | |||
| 360 | // ticketsClassPasses |
||
| 361 | // @todo |
||
| 362 | |||
| 363 | // ticketsEvents |
||
| 364 | // @todo |
||
| 365 | |||
| 366 | return $this->event = new Event( |
||
| 367 | $event->allDay, |
||
| 368 | $eventAttachments, |
||
| 369 | $event->attendeeCount, |
||
| 370 | $event->attendeeLimit, |
||
| 371 | $event->details, |
||
| 372 | $event->endAt, |
||
| 373 | $event->id, |
||
| 374 | new Location( |
||
| 375 | $event->location->addressText, |
||
| 376 | $event->location->additionalInfo, |
||
| 377 | $event->location->id, |
||
| 378 | $event->location->latitude, |
||
| 379 | $event->location->longitude, |
||
| 380 | $event->location->mapUrl, |
||
| 381 | $event->location->zoom |
||
| 382 | ), |
||
| 383 | $event->maxTicketsPerBooking, |
||
| 384 | $event->startAt, |
||
| 385 | $eventTickets, |
||
| 386 | $event->title, |
||
| 387 | $event->waitingList |
||
| 388 | ); |
||
| 389 | } |
||
| 390 | |||
| 391 | /** |
||
| 392 | * |
||
| 393 | * {@inheritDoc} |
||
| 394 | * @see \InShore\Bookwhen\Interfaces\ClientInterface::getEvents() |
||
| 395 | */ |
||
| 396 | public function events( |
||
| 397 | $calendar = false, |
||
| 398 | $entry = false, |
||
| 399 | $location = [], |
||
| 400 | $tags = [], |
||
| 401 | $title = [], |
||
| 402 | $detail = [], |
||
| 403 | $from = null, |
||
| 404 | $to = null, |
||
| 405 | bool $includeAttachments = false, |
||
| 406 | bool $includeLocation = false, |
||
| 407 | bool $includeTickets = false, |
||
| 408 | bool $includeTicketsClassPasses = false, |
||
| 409 | bool $includeTicketsEvents = false |
||
| 410 | ): array { |
||
| 411 | |||
| 412 | //$this->logger->debug(__METHOD__ . '(' . var_export(func_get_args(), true) . ')'); |
||
| 413 | |||
| 414 | // Validate $calendar |
||
| 415 | // @todo details required |
||
| 416 | |||
| 417 | // Validate $detail |
||
| 418 | if (!empty($detail)) { |
||
| 419 | if (!is_array($detail)) { |
||
| 420 | throw new ValidationException('detail', implode(' ', $detail)); |
||
| 421 | } else { |
||
| 422 | $detail = array_unique($detail); |
||
| 423 | foreach($detail as $item) { |
||
| 424 | if (!$this->validator->validLocation($item)) { |
||
| 425 | throw new ValidationException('detail', $item); |
||
| 426 | } |
||
| 427 | } |
||
| 428 | $this->filters['filter[detail]'] = implode(',', $detail); |
||
| 429 | } |
||
| 430 | } |
||
| 431 | |||
| 432 | // Validate $entry |
||
| 433 | // @todo details required |
||
| 434 | |||
| 435 | // Validate $from; |
||
| 436 | if (!empty($from)) { |
||
| 437 | if (!$this->validator->validFrom($from, $to)) { |
||
| 438 | throw new ValidationException('from', $from . '-' . $to); |
||
| 439 | } else { |
||
| 440 | $this->filters['filter[from]'] = $from; |
||
| 441 | } |
||
| 442 | } |
||
| 443 | |||
| 444 | // Validate $location |
||
| 445 | if (!empty($location)) { |
||
| 446 | if (!is_array($location)) { |
||
| 447 | throw new ValidationException('location', implode(' ', $title)); |
||
| 448 | } else { |
||
| 449 | $location = array_unique($location); |
||
| 450 | foreach($location as $item) { |
||
| 451 | if (!$this->validator->validLocation($item)) { |
||
| 452 | throw new ValidationException('location', $item); |
||
| 453 | } |
||
| 454 | } |
||
| 455 | $this->filters['filter[location]'] = implode(',', $location); |
||
| 456 | } |
||
| 457 | } |
||
| 458 | |||
| 459 | // Validate $tags. |
||
| 460 | if (!empty($tags)) { |
||
| 461 | if (!is_array($tags)) { |
||
| 462 | throw new ValidationException('tags', implode(' ', $tags)); |
||
| 463 | } else { |
||
| 464 | $tags = array_unique($tags); |
||
| 465 | foreach ($tags as $tag) { |
||
| 466 | if (!empty($tag) && !$this->validator->validTag($tag)) { |
||
| 467 | throw new ValidationException('tag', $tag); |
||
| 468 | } |
||
| 469 | } |
||
| 470 | } |
||
| 471 | $this->filters['filter[tag]'] = implode(',', $tags); |
||
| 472 | } |
||
| 473 | |||
| 474 | // Validate $title; |
||
| 475 | if (!empty($title)) { |
||
| 476 | if (!is_array($title)) { |
||
| 477 | throw new ValidationException('title', implode(' ', $title)); |
||
| 478 | } else { |
||
| 479 | $title = array_unique($title); |
||
| 480 | foreach($title as $item) { |
||
| 481 | if (!$this->validator->validTitle($item)) { |
||
| 482 | throw new ValidationException('title', $item); |
||
| 483 | } |
||
| 484 | } |
||
| 485 | $this->filters['filter[title]'] = implode(',', $title); |
||
| 486 | } |
||
| 487 | } |
||
| 488 | |||
| 489 | // Validate $to; |
||
| 490 | if (!empty($to)) { |
||
| 491 | if (!$this->validator->validTo($to, $from)) { |
||
| 492 | throw new ValidationException('to', $to . '-' . $from); |
||
| 493 | } else { |
||
| 494 | $this->filters['filter[to]'] = $to; |
||
| 495 | } |
||
| 496 | } |
||
| 497 | |||
| 498 | // Validate $includeAttachments; |
||
| 499 | if (!$this->validator->validInclude($includeAttachments)) { |
||
| 500 | throw new ValidationException('includeAttachments', $includeAttachments); |
||
| 501 | } else { |
||
| 502 | if($includeAttachments) { |
||
| 503 | array_push($this->includes, 'attachments'); |
||
| 504 | } |
||
| 505 | } |
||
| 506 | |||
| 507 | // Validate $includeTickets; |
||
| 508 | if (!$this->validator->validInclude($includeLocation)) { |
||
| 509 | throw new ValidationException('includeLocation', $includeLocation); |
||
| 510 | } else { |
||
| 511 | if($includeLocation) { |
||
| 512 | array_push($this->includes, 'location'); |
||
| 513 | } |
||
| 514 | } |
||
| 515 | |||
| 516 | // Validate $includeTickets; |
||
| 517 | if (!$this->validator->validInclude($includeTickets)) { |
||
| 518 | throw new ValidationException('includeTickets', $includeTickets); |
||
| 519 | } else { |
||
| 520 | if($includeTickets) { |
||
| 521 | array_push($this->includes, 'tickets'); |
||
| 522 | } |
||
| 523 | } |
||
| 524 | |||
| 525 | // Validate $includeTicketsEvents; |
||
| 526 | if (!$this->validator->validInclude($includeTicketsEvents)) { |
||
| 527 | throw new ValidationException('includeTicketsEvents', $includeTicketsEvents); |
||
| 528 | } else { |
||
| 529 | if($includeTicketsEvents) { |
||
| 530 | array_push($this->includes, 'tickets.events'); |
||
| 531 | } |
||
| 532 | } |
||
| 533 | |||
| 534 | // Validate $includeTicketsClassPasses; |
||
| 535 | if (!$this->validator->validInclude($includeTicketsClassPasses)) { |
||
| 536 | throw new ValidationException('includeTicketsClassPasses', $includeTicketsClassPasses); |
||
| 537 | } else { |
||
| 538 | if($includeTicketsClassPasses) { |
||
| 539 | array_push($this->includes, 'tickets.class_passes'); |
||
| 540 | } |
||
| 541 | } |
||
| 542 | |||
| 543 | $events = $this->client->events()->list(array_merge($this->filters, ['include' => implode(',', $this->includes)])); |
||
| 544 | |||
| 545 | foreach ($events->data as $event) { |
||
| 546 | |||
| 547 | $eventTickets = []; |
||
| 548 | foreach($event->tickets as $ticket) { |
||
| 549 | array_push($eventTickets, new Ticket( |
||
| 550 | $ticket->available, |
||
| 551 | $ticket->availableFrom, |
||
| 552 | $ticket->availableTo, |
||
| 553 | $ticket->builtBasketUrl, |
||
| 554 | $ticket->builtBasketIframeUrl, |
||
| 555 | $ticket->courseTicket, |
||
| 556 | $ticket->details, |
||
| 557 | $ticket->groupTicket, |
||
| 558 | $ticket->groupMin, |
||
| 559 | $ticket->groupMax, |
||
| 560 | $ticket->id, |
||
| 561 | $ticket->numberIssued, |
||
| 562 | $ticket->numberTaken, |
||
| 563 | $ticket->title |
||
| 564 | )); |
||
| 565 | } |
||
| 566 | |||
| 567 | array_push($this->events, new Event( |
||
| 568 | $event->allDay, |
||
| 569 | $event->attachments, |
||
| 570 | $event->attendeeCount, |
||
| 571 | $event->attendeeLimit, |
||
| 572 | $event->details, |
||
| 573 | $event->endAt, |
||
| 574 | $event->id, |
||
| 575 | new Location( |
||
| 576 | $event->location->addressText, |
||
| 577 | $event->location->additionalInfo, |
||
| 578 | $event->location->id, |
||
| 579 | $event->location->latitude, |
||
| 580 | $event->location->longitude, |
||
| 581 | $event->location->mapUrl, |
||
| 582 | $event->location->zoom |
||
| 583 | ), |
||
| 584 | $event->maxTicketsPerBooking, |
||
| 585 | $event->startAt, |
||
| 586 | $eventTickets, |
||
| 587 | $event->title, |
||
| 588 | $event->waitingList |
||
| 589 | )); |
||
| 590 | } |
||
| 591 | |||
| 592 | return $this->events; |
||
| 593 | } |
||
| 594 | |||
| 595 | /* |
||
| 596 | * |
||
| 597 | * {@inheritDoc} |
||
| 598 | * @see \InShore\Bookwhen\Interfaces\ClientInterface::getLocation() |
||
| 599 | */ |
||
| 600 | public function location(string $locationId): Location |
||
| 601 | { |
||
| 602 | |||
| 603 | if (!$this->validator->validId($locationId, 'location')) { |
||
| 604 | throw new ValidationException('locationId', $locationId); |
||
| 605 | } |
||
| 606 | |||
| 607 | $location = $this->client->locations()->retrieve($locationId); |
||
| 608 | |||
| 609 | return $this->location = new Location( |
||
| 610 | $location->additionalInfo, |
||
| 611 | $location->addressText, |
||
| 612 | $location->id, |
||
| 613 | $location->latitude, |
||
| 614 | $location->longitude, |
||
| 615 | $location->mapUrl, |
||
| 616 | $location->zoom |
||
| 617 | ); |
||
| 618 | } |
||
| 619 | |||
| 620 | /** |
||
| 621 | * |
||
| 622 | */ |
||
| 623 | public function locations( |
||
| 659 | |||
| 660 | } |
||
| 661 | |||
| 662 | /** |
||
| 663 | * Set Debug. |
||
| 664 | * @deprecated |
||
| 665 | */ |
||
| 666 | public function setLogging($level) |
||
| 667 | { |
||
| 668 | $this->logging = $level; |
||
| 669 | } |
||
| 670 | |||
| 671 | /** |
||
| 672 | * Sets the token for all future new instances |
||
| 673 | * @deprecated |
||
| 674 | * @param $token string The API access token, as obtained on diffbot.com/dev. |
||
| 675 | */ |
||
| 676 | public static function setToken($token) |
||
| 677 | { |
||
| 678 | $validator = new Validator(); |
||
| 679 | if (!$validator->validToken($token)) { |
||
| 680 | throw new \InvalidArgumentException('Invalid Token.'); |
||
| 681 | } |
||
| 682 | self::$token = $token; |
||
| 683 | } |
||
| 684 | |||
| 685 | /** |
||
| 686 | * {@inheritDoc} |
||
| 687 | * @see \InShore\Bookwhen\Interfaces\BookWhenInterface::ticket() |
||
| 688 | * class_passes |
||
| 689 | */ |
||
| 690 | public function ticket( |
||
| 691 | string $ticketId, |
||
| 692 | bool $includeClassPasses = false, |
||
| 693 | bool $includeEvents = false, |
||
| 694 | bool $includeEventsAttachments = false, |
||
| 695 | bool $includeEventsLocation = false, |
||
| 696 | bool $includeEventsTickets = false |
||
| 697 | ): Ticket { |
||
| 698 | if (!$this->validator->validId($ticketId, 'ticket')) { |
||
| 699 | throw new ValidationException('ticketId', $ticketId); |
||
| 700 | } |
||
| 701 | |||
| 702 | // Validate $includeClassPasses; |
||
| 703 | if (!$this->validator->validInclude($includeClassPasses)) { |
||
| 704 | throw new ValidationException('includeClassPasses', $includeClassPasses); |
||
| 705 | } else { |
||
| 706 | if($includeClassPasses) { |
||
| 707 | array_push($this->includes, 'class_passes'); |
||
| 708 | } |
||
| 709 | } |
||
| 710 | |||
| 711 | // Validate $includeEvents; |
||
| 712 | if (!$this->validator->validInclude($includeEvents)) { |
||
| 713 | throw new ValidationException('includeEvents', $includeEvents); |
||
| 714 | } else { |
||
| 715 | if($includeEvents) { |
||
| 716 | array_push($this->includes, 'events'); |
||
| 717 | } |
||
| 718 | } |
||
| 719 | |||
| 720 | // Validate $includeAttachments; |
||
| 721 | if (!$this->validator->validInclude($includeEventsAttachments)) { |
||
| 722 | throw new ValidationException('includeEventssAttachments', $includeEventsAttachments); |
||
| 723 | } else { |
||
| 724 | if($includeEventsAttachments) { |
||
| 725 | array_push($this->includes, 'events.attachments'); |
||
| 726 | } |
||
| 727 | } |
||
| 728 | |||
| 729 | // Validate $includeEventsLocation; |
||
| 730 | if (!$this->validator->validInclude($includeEventsLocation)) { |
||
| 731 | throw new ValidationException('includeEventsLocation', $includeEventsLocation); |
||
| 732 | } else { |
||
| 733 | if($includeEventsLocation) { |
||
| 734 | array_push($this->includes, 'events.location'); |
||
| 735 | } |
||
| 736 | } |
||
| 737 | |||
| 738 | // Validate $includeEventsTickets; |
||
| 739 | if (!$this->validator->validInclude($includeEventsTickets)) { |
||
| 740 | throw new ValidationException('includeEventsTickets', $includeEventsTickets); |
||
| 741 | } else { |
||
| 742 | if($includeEventsTickets) { |
||
| 743 | array_push($this->includes, 'events.tickets'); |
||
| 744 | } |
||
| 745 | } |
||
| 746 | |||
| 747 | $ticket = $this->client->tickets()->retrieve($ticketId); |
||
| 748 | |||
| 749 | return $this->ticket = new Ticket( |
||
| 750 | $ticket->available, |
||
| 751 | $ticket->availableFrom, |
||
| 752 | $ticket->availableTo, |
||
| 753 | $ticket->builtBasketUrl, |
||
| 754 | $ticket->builtBasketIframeUrl, |
||
| 755 | $ticket->courseTicket, |
||
| 756 | $ticket->details, |
||
| 757 | $ticket->groupTicket, |
||
| 758 | $ticket->groupMin, |
||
| 759 | $ticket->groupMax, |
||
| 760 | $ticket->id, |
||
| 761 | $ticket->numberIssued, |
||
| 762 | $ticket->numberTaken, |
||
| 763 | $ticket->title |
||
| 764 | ); |
||
| 765 | } |
||
| 766 | |||
| 767 | /** |
||
| 768 | * {@inheritDoc} |
||
| 769 | * @see \InShore\Bookwhen\Interfaces\BookWhenInterface::tickets() |
||
| 770 | * @todo includes |
||
| 771 | */ |
||
| 772 | public function tickets( |
||
| 853 | |||
| 854 | } |
||
| 855 | } |
||
| 856 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths