Passed
Pull Request — release-11.2.x (#3604)
by Markus
32:12 queued 27:55
created

SearchRequest::getAsArray()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 0
crap 1
1
<?php
2
3
namespace ApacheSolrForTypo3\Solr\Domain\Search;
4
5
/***************************************************************
6
 *  Copyright notice
7
 *
8
 *  (c) 2015-2016 Timo Schmidt <[email protected]>
9
 *  All rights reserved
10
 *
11
 *  This script is part of the TYPO3 project. The TYPO3 project is
12
 *  free software; you can redistribute it and/or modify
13
 *  it under the terms of the GNU General Public License as published by
14
 *  the Free Software Foundation; either version 3 of the License, or
15
 *  (at your option) any later version.
16
 *
17
 *  The GNU General Public License can be found at
18
 *  http://www.gnu.org/copyleft/gpl.html.
19
 *
20
 *  This script is distributed in the hope that it will be useful,
21
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
22
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23
 *  GNU General Public License for more details.
24
 *
25
 *  This copyright notice MUST APPEAR in all copies of the script!
26
 ***************************************************************/
27
28
use ApacheSolrForTypo3\Solr\Domain\Search\ResultSet\Facets\UrlFacetContainer;
29
use ApacheSolrForTypo3\Solr\System\Configuration\TypoScriptConfiguration;
30
use ApacheSolrForTypo3\Solr\System\Util\ArrayAccessor;
31
use TYPO3\CMS\Core\Utility\ArrayUtility;
32
33
/**
34
 * The searchRequest is used to act as an api to the arguments that have been passed
35
 * with GET and POST.
36
 *
37
 * @author Timo Schmidt <[email protected]>
38
 */
39
class SearchRequest
40
{
41
    /**
42
     * The default plugin namespace.
43
     *
44
     * @var string
45
     */
46
    const DEFAULT_PLUGIN_NAMESPACE = 'tx_solr';
47
48
    /**
49
     * @var string
50
     */
51
    protected $id;
52
53
    /**
54
     * Default namespace overwritten with the configured plugin namespace.
55
     *
56
     * @var string
57
     */
58
    protected $argumentNameSpace = self::DEFAULT_PLUGIN_NAMESPACE;
59
60
    /**
61
     * Arguments that should be kept for sub requests.
62
     *
63
     * Default values, overwritten in the constructor with the namespaced arguments
64
     *
65
     * @var array
66
     */
67
    protected $persistentArgumentsPaths = ['tx_solr:q', 'tx_solr:filter', 'tx_solr:sort'];
68
69
    /**
70
     * @var bool
71
     */
72
    protected $stateChanged = false;
73
74
    /**
75
     * @var ArrayAccessor
76
     */
77
    protected $argumentsAccessor;
78
79
    /**
80
     * The sys_language_uid that was used in the context where the request was build.
81
     * This could be different from the "L" parameter and and not relevant for urls,
82
     * because typolink itself will handle it.
83
     *
84
     * @var int
85
     */
86
    protected $contextSystemLanguageUid;
87
88
    /**
89
     * The page_uid that was used in the context where the request was build.
90
     *
91
     * The pageUid is not relevant for the typolink additionalArguments and therefore
92
     * a separate property.
93
     *
94
     * @var int
95
     */
96
    protected $contextPageUid;
97
98
    /**
99
     * @var TypoScriptConfiguration
100
     */
101
    protected $contextTypoScriptConfiguration;
102
103
    /**
104
     * Container for all active facets inside of the URL(TYPO3/FE)
105
     *
106
     * @var UrlFacetContainer
107
     */
108
    protected $activeFacetContainer;
109
110
    /**
111
     * @var array
112
     */
113
    protected $persistedArguments = [];
114
115
    /**
116
     * @param array $argumentsArray
117
     * @param int $pageUid
118
     * @param int $sysLanguageUid
119
     * @param TypoScriptConfiguration|null $typoScriptConfiguration
120
     */
121 70
    public function __construct(array $argumentsArray = [], int $pageUid = 0, int $sysLanguageUid = 0, TypoScriptConfiguration $typoScriptConfiguration = null)
122
    {
123 70
        $this->stateChanged = true;
124 70
        $this->persistedArguments = $argumentsArray;
125 70
        $this->contextPageUid = $pageUid;
126 70
        $this->contextSystemLanguageUid = $sysLanguageUid;
127 70
        $this->contextTypoScriptConfiguration = $typoScriptConfiguration;
128 70
        $this->id = spl_object_hash($this);
129
130
        // overwrite the plugin namespace and the persistentArgumentsPaths
131 70
        if (!is_null($typoScriptConfiguration)) {
132 18
            $this->argumentNameSpace = $typoScriptConfiguration->getSearchPluginNamespace() ?? self::DEFAULT_PLUGIN_NAMESPACE;
133
        }
134
135 70
        $this->persistentArgumentsPaths = [$this->argumentNameSpace . ':q', $this->argumentNameSpace . ':filter', $this->argumentNameSpace . ':sort', $this->argumentNameSpace . ':groupPage'];
136
137 70
        if (!is_null($typoScriptConfiguration)) {
138 18
            $additionalPersistentArgumentsNames = $typoScriptConfiguration->getSearchAdditionalPersistentArgumentNames();
139 18
            foreach ($additionalPersistentArgumentsNames ?? [] as $additionalPersistentArgumentsName) {
140
                $this->persistentArgumentsPaths[] = $this->argumentNameSpace . ':' . $additionalPersistentArgumentsName;
141
            }
142 18
            $this->persistentArgumentsPaths = array_unique($this->persistentArgumentsPaths);
143
        }
144
145 70
        $this->reset();
146 70
    }
147
148
    /**
149
     * @return string
150
     */
151 5
    public function getId()
152
    {
153 5
        return $this->id;
154
    }
155
156
    /**
157
     * Can be used do merge arguments into the request arguments
158
     *
159
     * @param array $argumentsToMerge
160
     * @return SearchRequest
161
     */
162 1
    public function mergeArguments(array $argumentsToMerge)
163
    {
164 1
        ArrayUtility::mergeRecursiveWithOverrule(
165 1
            $this->persistedArguments,
166 1
            $argumentsToMerge
167
        );
168
169 1
        $this->reset();
170
171 1
        return $this;
172
    }
173
174
    /**
175
     * Helper method to prefix an accessor with the arguments namespace.
176
     *
177
     * @param string $path
178
     * @return string
179
     */
180 42
    protected function prefixWithNamespace($path)
181
    {
182 42
        return $this->argumentNameSpace . ':' . $path;
183
    }
184
185
    /**
186
     * @return array
187
     */
188 1
    public function getActiveFacetNames()
189
    {
190 1
        return $this->activeFacetContainer->getActiveFacetNames();
191
    }
192
193
    /**
194
     * Returns all facet values for a certain facetName
195
     * @param string $facetName
196
     * @return array
197
     */
198 1
    public function getActiveFacetValuesByName(string $facetName)
199
    {
200 1
        return $this->activeFacetContainer->getActiveFacetValuesByName($facetName);
201
    }
202
203
    /**
204
     * @return array
205
     */
206
    public function getActiveFacets()
207
    {
208
        return $this->activeFacetContainer->getActiveFacets();
209
    }
210
211
    /**
212
     * Enable sorting of URL parameters
213
     */
214
    public function sortActiveFacets(): void
215
    {
216
        $this->activeFacetContainer->enableSort();
217
    }
218
219
    /**
220
     * @return bool
221
     */
222 6
    public function isActiveFacetsSorted(): bool
223
    {
224 6
        return $this->activeFacetContainer->isSorted();
225
    }
226
227
    /**
228
     * @return string
229
     */
230
    public function getActiveFacetsUrlParameterStyle(): string
231
    {
232
        return $this->activeFacetContainer->getParameterStyle();
233
    }
234
235
    /**
236
     * Returns the active count of facets
237
     *
238
     * @return int
239
     */
240 2
    public function getActiveFacetCount()
241
    {
242 2
        return $this->activeFacetContainer->count();
243
    }
244
245
    /**
246
     * @param array $activeFacets
247
     *
248
     * @return SearchRequest
249
     */
250
    protected function setActiveFacets($activeFacets = [])
251
    {
252
        $this->activeFacetContainer->setActiveFacets($activeFacets);
253
254
        return $this;
255
    }
256
257
    /**
258
     * Adds a facet value to the request.
259
     *
260
     * @param string $facetName
261
     * @param mixed $facetValue
262
     *
263
     * @return SearchRequest
264
     */
265 10
    public function addFacetValue(string $facetName, $facetValue)
266
    {
267 10
        $this->activeFacetContainer->addFacetValue($facetName, $facetValue);
268
269 10
        if ($this->activeFacetContainer->hasChanged()) {
270 10
            $this->stateChanged = true;
271 10
            $this->activeFacetContainer->acknowledgeChange();
272
        }
273
274 10
        return $this;
275
    }
276
277
    /**
278
     * Removes a facet value from the request.
279
     *
280
     * @param string $facetName
281
     * @param mixed $facetValue
282
     *
283
     * @return SearchRequest
284
     */
285 2
    public function removeFacetValue(string $facetName, $facetValue)
286
    {
287 2
        $this->activeFacetContainer->removeFacetValue($facetName, $facetValue);
288 2
        if ($this->activeFacetContainer->hasChanged()) {
289 2
            $this->stateChanged = true;
290 2
            $this->activeFacetContainer->acknowledgeChange();
291
        }
292
293 2
        return $this;
294
    }
295
296
    /**
297
     * Removes all facet values from the request by a certain facet name
298
     *
299
     * @param string $facetName
300
     *
301
     * @return SearchRequest
302
     */
303 2
    public function removeAllFacetValuesByName(string $facetName)
304
    {
305 2
        $this->activeFacetContainer->removeAllFacetValuesByName($facetName);
306 2
        if ($this->activeFacetContainer->hasChanged()) {
307 2
            $this->stateChanged = true;
308 2
            $this->activeFacetContainer->acknowledgeChange();
309
        }
310 2
        return $this;
311
    }
312
313
    /**
314
     * Removes all active facets from the request.
315
     *
316
     * @return SearchRequest
317
     */
318 2
    public function removeAllFacets()
319
    {
320 2
        $this->activeFacetContainer->removeAllFacets();
321 2
        if ($this->activeFacetContainer->hasChanged()) {
322 2
            $this->stateChanged = true;
323 2
            $this->activeFacetContainer->acknowledgeChange();
324
        }
325 2
        return $this;
326
    }
327
328
    /**
329
     * Check if an active facet has a given value
330
     *
331
     * @param string $facetName
332
     * @param mixed $facetValue
333
     * @return bool
334
     */
335 1
    public function getHasFacetValue(string $facetName, $facetValue): bool
336
    {
337 1
        return $this->activeFacetContainer->hasFacetValue($facetName, $facetValue);
338
    }
339
340
    /**
341
     * @return bool
342
     */
343 14
    public function getHasSorting()
344
    {
345 14
        $path = $this->prefixWithNamespace('sort');
346 14
        return $this->argumentsAccessor->has($path);
347
    }
348
349
    /**
350
     * Returns the sorting string in the url e.g. title asc.
351
     *
352
     * @return string
353
     */
354 13
    public function getSorting()
355
    {
356 13
        $path = $this->prefixWithNamespace('sort');
357 13
        return $this->argumentsAccessor->get($path, '');
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->argumentsAccessor->get($path, '') also could return the type array which is incompatible with the documented return type string.
Loading history...
358
    }
359
360
    /**
361
     * Helper function to get the sorting configuration name or direction.
362
     *
363
     * @param int $index
364
     * @return string
365
     */
366 13
    protected function getSortingPart($index)
367
    {
368 13
        $sorting = $this->getSorting();
369 13
        if ($sorting === '') {
370 11
            return null;
371
        }
372
373 2
        $parts = explode(' ', $sorting);
374 2
        return isset($parts[$index]) ? $parts[$index] : null;
375
    }
376
377
    /**
378
     * Returns the sorting configuration name that is currently used.
379
     *
380
     * @return string
381
     */
382 13
    public function getSortingName()
383
    {
384 13
        return $this->getSortingPart(0);
385
    }
386
387
    /**
388
     * Returns the sorting direction that is currently used.
389
     *
390
     * @return string
391
     */
392 12
    public function getSortingDirection()
393
    {
394 12
        return mb_strtolower($this->getSortingPart(1));
395
    }
396
397
    /**
398
     * @return SearchRequest
399
     */
400 1
    public function removeSorting()
401
    {
402 1
        $path = $this->prefixWithNamespace('sort');
403 1
        $this->argumentsAccessor->reset($path);
404 1
        $this->stateChanged = true;
405 1
        return $this;
406
    }
407
408
    /**
409
     * @param string $sortingName
410
     * @param string $direction (asc or desc)
411
     *
412
     * @return SearchRequest
413
     */
414 2
    public function setSorting($sortingName, $direction = 'asc')
415
    {
416 2
        $value = $sortingName . ' ' . $direction;
417 2
        $path = $this->prefixWithNamespace('sort');
418 2
        $this->argumentsAccessor->set($path, $value);
419 2
        $this->stateChanged = true;
420 2
        return $this;
421
    }
422
423
    /**
424
     * Method to set the paginated page of the search
425
     *
426
     * @param int $page
427
     * @return SearchRequest
428
     */
429 4
    public function setPage($page)
430
    {
431 4
        $this->stateChanged = true;
432 4
        $path = $this->prefixWithNamespace('page');
433 4
        $this->argumentsAccessor->set($path, $page);
434
        // use initial url by switching back to page 0
435 4
        if ($page === 0) {
436 3
            $this->argumentsAccessor->reset($path);
437
        }
438 4
        return $this;
439
    }
440
441
    /**
442
     * Returns the passed page.
443
     *
444
     * @return int|null
445
     */
446 16
    public function getPage()
447
    {
448 16
        $path = $this->prefixWithNamespace('page');
449 16
        return $this->argumentsAccessor->get($path);
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->argumentsAccessor->get($path) also could return the type array which is incompatible with the documented return type integer|null.
Loading history...
450
    }
451
452
    /**
453
     * Can be used to reset all groupPages.
454
     *
455
     * @return SearchRequest
456
     */
457 7
    public function removeAllGroupItemPages(): SearchRequest
458
    {
459 7
        $path = $this->prefixWithNamespace('groupPage');
460 7
        $this->argumentsAccessor->reset($path);
461
462 7
        return $this;
463
    }
464
465
    /**
466
     * Can be used to paginate within a groupItem.
467
     *
468
     * @param string $groupName e.g. type
469
     * @param string $groupItemValue e.g. pages
470
     * @param int $page
471
     * @return SearchRequest
472
     */
473 4
    public function setGroupItemPage(string $groupName, string $groupItemValue, int $page): SearchRequest
474
    {
475 4
        $this->stateChanged = true;
476 4
        $escapedValue = $this->getEscapedGroupItemValue($groupItemValue);
477 4
        $path = $this->prefixWithNamespace('groupPage:' . $groupName . ':' . $escapedValue);
478 4
        $this->argumentsAccessor->set($path, $page);
479 4
        return $this;
480
    }
481
482
    /**
483
     * Retrieves the current page for this group item.
484
     *
485
     * @param string $groupName
486
     * @param string $groupItemValue
487
     * @return int
488
     */
489 3
    public function getGroupItemPage(string $groupName, string $groupItemValue): int
490
    {
491 3
        $escapedValue = $this->getEscapedGroupItemValue($groupItemValue);
492 3
        $path = $this->prefixWithNamespace('groupPage:' . $groupName . ':' . $escapedValue);
493 3
        return max(1, (int)$this->argumentsAccessor->get($path));
494
    }
495
496
    /**
497
     * Removes all non alphanumeric values from the groupItem value to have a valid array key.
498
     *
499
     * @param string $groupItemValue
500
     * @return string
501
     */
502 5
    protected function getEscapedGroupItemValue(string $groupItemValue)
503
    {
504 5
        return preg_replace('/[^A-Za-z0-9]/', '', $groupItemValue);
505
    }
506
507
    /**
508
     * Retrieves the highest page of the groups.
509
     *
510
     * @return int
511
     */
512 1
    public function getHighestGroupPage()
513
    {
514 1
        $max = 1;
515 1
        $path = $this->prefixWithNamespace('groupPage');
516 1
        $groupPages = $this->argumentsAccessor->get($path, []);
517 1
        foreach ($groupPages as $groups) {
518
            if (!is_array($groups)) {
519
                continue;
520
            }
521
            foreach ($groups as $groupItemPage) {
522
                if ($groupItemPage > $max) {
523
                    $max = $groupItemPage;
524
                }
525
            }
526
        }
527
528 1
        return $max;
529
    }
530
531
    /**
532
     * Method to overwrite the query string.
533
     *
534
     * @param string $rawQueryString
535
     * @return SearchRequest
536
     */
537 12
    public function setRawQueryString($rawQueryString)
538
    {
539 12
        $this->stateChanged = true;
540 12
        $path = $this->prefixWithNamespace('q');
541 12
        $this->argumentsAccessor->set($path, $rawQueryString);
542 12
        return $this;
543
    }
544
545
    /**
546
     * Returns the passed rawQueryString.
547
     *
548
     * @return string|null
549
     */
550 12
    public function getRawUserQuery()
551
    {
552 12
        $path = $this->prefixWithNamespace('q');
553 12
        $query = $this->argumentsAccessor->get($path, null);
554 12
        return is_null($query) ? $query : (string)$query;
555
    }
556
557
    /**
558
     * Method to check if the query string is an empty string
559
     * (also empty string or whitespaces only are handled as empty).
560
     *
561
     * When no query string is set (null) the method returns false.
562
     * @return bool
563
     */
564 12
    public function getRawUserQueryIsEmptyString()
565
    {
566 12
        $path = $this->prefixWithNamespace('q');
567 12
        $query = $this->argumentsAccessor->get($path, null);
568
569 12
        if ($query === null) {
570
            return false;
571
        }
572
573 12
        if (trim($query) === '') {
0 ignored issues
show
Bug introduced by
It seems like $query can also be of type array; however, parameter $string of trim() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

573
        if (trim(/** @scrutinizer ignore-type */ $query) === '') {
Loading history...
574 1
            return true;
575
        }
576
577 11
        return false;
578
    }
579
580
    /**
581
     * This method returns true when no querystring is present at all.
582
     * Which means no search by the user was triggered
583
     *
584
     * @return bool
585
     */
586 13
    public function getRawUserQueryIsNull()
587
    {
588 13
        $path = $this->prefixWithNamespace('q');
589 13
        $query = $this->argumentsAccessor->get($path, null);
590 13
        return $query === null;
591
    }
592
593
    /**
594
     * Sets the results per page that are used during search.
595
     *
596
     * @param int $resultsPerPage
597
     * @return SearchRequest
598
     */
599 14
    public function setResultsPerPage($resultsPerPage)
600
    {
601 14
        $path = $this->prefixWithNamespace('resultsPerPage');
602 14
        $this->argumentsAccessor->set($path, $resultsPerPage);
603 14
        $this->stateChanged = true;
604
605 14
        return $this;
606
    }
607
608
    /**
609
     * @return bool
610
     */
611 1
    public function getStateChanged()
612
    {
613 1
        return $this->stateChanged;
614
    }
615
616
    /**
617
     * Returns the passed resultsPerPage value
618
     * @return int|null
619
     */
620 15
    public function getResultsPerPage()
621
    {
622 15
        $path = $this->prefixWithNamespace('resultsPerPage');
623 15
        return $this->argumentsAccessor->get($path);
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->argumentsAccessor->get($path) also could return the type array which is incompatible with the documented return type integer|null.
Loading history...
624
    }
625
626
    /**
627
     * Allows to set additional filters that are used on time and not transported during the request.
628
     *
629
     * @param array $additionalFilters
630
     * @return SearchRequest
631
     */
632
    public function setAdditionalFilters($additionalFilters)
633
    {
634
        $path = $this->prefixWithNamespace('additionalFilters');
635
        $this->argumentsAccessor->set($path, $additionalFilters);
636
        $this->stateChanged = true;
637
638
        return $this;
639
    }
640
641
    /**
642
     * Retrieves the addtional filters that have been set
643
     *
644
     * @return array
645
     */
646 11
    public function getAdditionalFilters()
647
    {
648 11
        $path = $this->prefixWithNamespace('additionalFilters');
649 11
        return $this->argumentsAccessor->get($path, []);
650
    }
651
652
    /**
653
     * @return int
654
     */
655 1
    public function getContextSystemLanguageUid()
656
    {
657 1
        return $this->contextSystemLanguageUid;
658
    }
659
660
    /**
661
     * @return int
662
     */
663 1
    public function getContextPageUid()
664
    {
665 1
        return $this->contextPageUid;
666
    }
667
668
    /**
669
     * Get contextTypoScriptConfiguration
670
     *
671
     * @return TypoScriptConfiguration
672
     */
673 22
    public function getContextTypoScriptConfiguration(): ?TypoScriptConfiguration
674
    {
675 22
        return $this->contextTypoScriptConfiguration;
676
    }
677
678
    /**
679
     * Assigns the last known persistedArguments and restores their state.
680
     *
681
     * @return SearchRequest
682
     */
683 68
    public function reset(): SearchRequest
684
    {
685 68
        $this->argumentsAccessor = new ArrayAccessor($this->persistedArguments);
686 68
        $this->stateChanged = false;
687 68
        $this->activeFacetContainer = new UrlFacetContainer(
688 68
            $this->argumentsAccessor,
689 68
            $this->argumentNameSpace ?? self::DEFAULT_PLUGIN_NAMESPACE,
690 68
            $this->contextTypoScriptConfiguration === null ?
691 51
                UrlFacetContainer::PARAMETER_STYLE_INDEX :
692 68
                $this->contextTypoScriptConfiguration->getSearchFacetingUrlParameterStyle()
693
        );
694
695
        // If the default of sorting parameter should be true, a modification of this condition is needed.
696
        // If instance of contextTypoScriptConfiguration is not TypoScriptConfiguration the sort should be enabled too
697 68
        if ($this->contextTypoScriptConfiguration instanceof TypoScriptConfiguration &&
698 68
                $this->contextTypoScriptConfiguration->getSearchFacetingUrlParameterSort(false)) {
699
            $this->activeFacetContainer->enableSort();
700
        }
701
702 68
        return $this;
703
    }
704
705
    /**
706
     * This can be used to start a new sub request, e.g. for a faceted search.
707
     *
708
     * @param bool $onlyPersistentArguments
709
     * @return SearchRequest
710
     */
711 12
    public function getCopyForSubRequest(bool $onlyPersistentArguments = true): SearchRequest
712
    {
713 12
        if (!$onlyPersistentArguments) {
714
            // create a new request with all data
715
            $argumentsArray = $this->argumentsAccessor->getData();
716
            return new SearchRequest(
717
                $argumentsArray,
718
                $this->contextPageUid,
719
                $this->contextSystemLanguageUid,
720
                $this->contextTypoScriptConfiguration
721
            );
722
        }
723
724 12
        $arguments = new ArrayAccessor();
725 12
        foreach ($this->persistentArgumentsPaths as $persistentArgumentPath) {
726 12
            if ($this->argumentsAccessor->has($persistentArgumentPath)) {
727 7
                $arguments->set($persistentArgumentPath, $this->argumentsAccessor->get($persistentArgumentPath));
728
            }
729
        }
730
731 12
        return new SearchRequest(
732 12
            $arguments->getData(),
733 12
            $this->contextPageUid,
734 12
            $this->contextSystemLanguageUid,
735 12
            $this->contextTypoScriptConfiguration
736
        );
737
    }
738
739
    /**
740
     * @return string
741
     */
742
    public function getArgumentNamespace(): string
743
    {
744
        return $this->argumentNameSpace;
745
    }
746
747
    /**
748
     * @return array
749
     */
750 19
    public function getAsArray(): array
751
    {
752 19
        return $this->argumentsAccessor->getData();
753
    }
754
755
    /**
756
     * Returns only the arguments as array.
757
     *
758
     * @return array
759
     */
760
    public function getArguments(): array
761
    {
762
        return $this->argumentsAccessor->get($this->argumentNameSpace) ?? [];
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->argumentsA...ntNameSpace) ?? array() could return the type null which is incompatible with the type-hinted return array. Consider adding an additional type-check to rule them out.
Loading history...
763
    }
764
}
765