Passed
Push — release-11.5.x ( 385fe8...cd49eb )
by Rafael
53:22 queued 14:05
created

SearchRequest::addFacetValue()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 10
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 2
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the TYPO3 CMS project.
7
 *
8
 * It is free software; you can redistribute it and/or modify it under
9
 * the terms of the GNU General Public License, either version 2
10
 * of the License, or any later version.
11
 *
12
 * For the full copyright and license information, please read the
13
 * LICENSE.txt file that was distributed with this source code.
14
 *
15
 * The TYPO3 project - inspiring people to share!
16
 */
17
18
namespace ApacheSolrForTypo3\Solr\Domain\Search;
19
20
use ApacheSolrForTypo3\Solr\Domain\Search\ResultSet\Facets\UrlFacetContainer;
21
use ApacheSolrForTypo3\Solr\System\Configuration\TypoScriptConfiguration;
22
use ApacheSolrForTypo3\Solr\System\Util\ArrayAccessor;
23
use TYPO3\CMS\Core\Utility\ArrayUtility;
24
25
/**
26
 * The searchRequest is used to act as an api to the arguments that have been passed
27
 * with GET and POST.
28
 *
29
 * @author Timo Schmidt <[email protected]>
30
 */
31
class SearchRequest
32
{
33
    /**
34
     * The default plugin namespace.
35
     *
36
     * @var string
37
     */
38
    const DEFAULT_PLUGIN_NAMESPACE = 'tx_solr';
39
40
    /**
41
     * @var string
42
     */
43
    protected string $id;
44
45
    /**
46
     * Default namespace overwritten with the configured plugin namespace.
47
     *
48
     * @var string
49
     */
50
    protected string $argumentNameSpace = self::DEFAULT_PLUGIN_NAMESPACE;
51
52
    /**
53
     * Arguments that should be kept for sub requests.
54
     *
55
     * Default values, overwritten in the constructor with the namespaced arguments
56
     *
57
     * @var array
58
     */
59
    protected array $persistentArgumentsPaths = [
60
        'tx_solr:q',
61
        'tx_solr:filter',
62
        'tx_solr:sort',
63
    ];
64
65
    /**
66
     * @var bool
67
     */
68
    protected bool $stateChanged = false;
69
70
    /**
71
     * @var ArrayAccessor|null
72
     */
73
    protected ?ArrayAccessor $argumentsAccessor = null;
74
75
    /**
76
     * The sys_language_uid that was used in the context where the request was build.
77
     * This could be different from the "L" parameter and not relevant for urls,
78
     * because typolink itself will handle it.
79
     *
80
     * @var int
81
     */
82
    protected int $contextSystemLanguageUid = 0;
83
84
    /**
85
     * The page_uid that was used in the context where the request was build.
86
     *
87
     * The pageUid is not relevant for the typolink additionalArguments and therefore
88
     * a separate property.
89
     *
90
     * @var int
91
     */
92
    protected int $contextPageUid;
93
94
    /**
95
     * @var TypoScriptConfiguration|null
96
     */
97
    protected ?TypoScriptConfiguration $contextTypoScriptConfiguration;
98
99
    /**
100
     * Container for all active facets inside the URL(TYPO3/FE)
101
     *
102
     * @var UrlFacetContainer|null
103
     */
104
    protected ?UrlFacetContainer $activeFacetContainer;
105
106
    /**
107
     * @var array
108
     */
109
    protected array $persistedArguments = [];
110
111
    /**
112
     * @param array $argumentsArray
113
     * @param int $pageUid
114
     * @param int $sysLanguageUid
115
     * @param TypoScriptConfiguration|null $typoScriptConfiguration
116
     */
117 104
    public function __construct(
118
        array $argumentsArray = [],
119
        int $pageUid = 0,
120
        int $sysLanguageUid = 0,
121
        TypoScriptConfiguration $typoScriptConfiguration = null
122
    ) {
123 104
        $this->stateChanged = true;
124 104
        $this->persistedArguments = $argumentsArray;
125 104
        $this->contextPageUid = $pageUid;
126 104
        $this->contextSystemLanguageUid = $sysLanguageUid;
127 104
        $this->contextTypoScriptConfiguration = $typoScriptConfiguration;
128 104
        $this->id = spl_object_hash($this);
129
130
        // overwrite the plugin namespace and the persistentArgumentsPaths
131 104
        if (!is_null($typoScriptConfiguration)) {
132 54
            $this->argumentNameSpace = $typoScriptConfiguration->getSearchPluginNamespace() ?? self::DEFAULT_PLUGIN_NAMESPACE;
133
        }
134
135 104
        $this->persistentArgumentsPaths = [$this->argumentNameSpace . ':q', $this->argumentNameSpace . ':filter', $this->argumentNameSpace . ':sort', $this->argumentNameSpace . ':groupPage'];
136
137 104
        if (!is_null($typoScriptConfiguration)) {
138 54
            $additionalPersistentArgumentsNames = $typoScriptConfiguration->getSearchAdditionalPersistentArgumentNames();
139 54
            foreach ($additionalPersistentArgumentsNames ?? [] as $additionalPersistentArgumentsName) {
140
                $this->persistentArgumentsPaths[] = $this->argumentNameSpace . ':' . $additionalPersistentArgumentsName;
141
            }
142 54
            $this->persistentArgumentsPaths = array_unique($this->persistentArgumentsPaths);
143
        }
144
145 104
        $this->reset();
146
    }
147
148
    /**
149
     * @return string
150
     */
151 21
    public function getId(): string
152
    {
153 21
        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): SearchRequest
163
    {
164 1
        ArrayUtility::mergeRecursiveWithOverrule(
165 1
            $this->persistedArguments,
166 1
            $argumentsToMerge
167 1
        );
168
169 1
        $this->reset();
170
171 1
        return $this;
172
    }
173
174
    /**
175
     * Helper method to prefix an accessor with the argument's namespace.
176
     *
177
     * @param string $path
178
     * @return string
179
     */
180 78
    protected function prefixWithNamespace(string $path): string
181
    {
182 78
        return $this->argumentNameSpace . ':' . $path;
183
    }
184
185
    /**
186
     * @return array
187
     */
188 2
    public function getActiveFacetNames(): array
189
    {
190 2
        return $this->activeFacetContainer->getActiveFacetNames();
0 ignored issues
show
Bug introduced by
The method getActiveFacetNames() does not exist on null. ( Ignorable by Annotation )

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

190
        return $this->activeFacetContainer->/** @scrutinizer ignore-call */ getActiveFacetNames();

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
191
    }
192
193
    /**
194
     * Returns all facet values for a certain facetName
195
     * @param string $facetName
196
     * @return array
197
     */
198 18
    public function getActiveFacetValuesByName(string $facetName): array
199
    {
200 18
        return $this->activeFacetContainer->getActiveFacetValuesByName($facetName);
201
    }
202
203
    /**
204
     * @return array
205
     */
206
    public function getActiveFacets(): array
207
    {
208
        return $this->activeFacetContainer->getActiveFacets();
209
    }
210
211
    /**
212
     * Enable sorting of URL parameters
213
     * @noinspection PhpUnused
214
     */
215
    public function sortActiveFacets(): void
216
    {
217
        $this->activeFacetContainer->enableSort();
218
    }
219
220
    /**
221
     * @return bool
222
     */
223 23
    public function isActiveFacetsSorted(): bool
224
    {
225 23
        return $this->activeFacetContainer->isSorted();
226
    }
227
228
    /**
229
     * @return string
230
     */
231
    public function getActiveFacetsUrlParameterStyle(): string
232
    {
233
        return $this->activeFacetContainer->getParameterStyle();
234
    }
235
236
    /**
237
     * Returns the active count of facets
238
     *
239
     * @return int
240
     */
241 2
    public function getActiveFacetCount(): int
242
    {
243 2
        return $this->activeFacetContainer->count();
244
    }
245
246
    /**
247
     * @param array $activeFacets
248
     *
249
     * @return SearchRequest
250
     * @noinspection PhpUnused
251
     */
252
    protected function setActiveFacets(array $activeFacets = []): SearchRequest
253
    {
254
        $this->activeFacetContainer->setActiveFacets($activeFacets);
255
256
        return $this;
257
    }
258
259
    /**
260
     * Adds a facet value to the request.
261
     *
262
     * @param string $facetName
263
     * @param mixed $facetValue
264
     *
265
     * @return SearchRequest
266
     */
267 25
    public function addFacetValue(string $facetName, $facetValue): SearchRequest
268
    {
269 25
        $this->activeFacetContainer->addFacetValue($facetName, $facetValue);
270
271 25
        if ($this->activeFacetContainer->hasChanged()) {
272 24
            $this->stateChanged = true;
273 24
            $this->activeFacetContainer->acknowledgeChange();
274
        }
275
276 25
        return $this;
277
    }
278
279
    /**
280
     * Removes a facet value from the request.
281
     *
282
     * @param string $facetName
283
     * @param mixed $facetValue
284
     *
285
     * @return SearchRequest
286
     */
287 6
    public function removeFacetValue(string $facetName, $facetValue): SearchRequest
288
    {
289 6
        $this->activeFacetContainer->removeFacetValue($facetName, $facetValue);
290 6
        if ($this->activeFacetContainer->hasChanged()) {
291 6
            $this->stateChanged = true;
292 6
            $this->activeFacetContainer->acknowledgeChange();
293
        }
294
295 6
        return $this;
296
    }
297
298
    /**
299
     * Removes all facet values from the request by a certain facet name
300
     *
301
     * @param string $facetName
302
     *
303
     * @return SearchRequest
304
     */
305 3
    public function removeAllFacetValuesByName(string $facetName): SearchRequest
306
    {
307 3
        $this->activeFacetContainer->removeAllFacetValuesByName($facetName);
308 3
        if ($this->activeFacetContainer->hasChanged()) {
309 3
            $this->stateChanged = true;
310 3
            $this->activeFacetContainer->acknowledgeChange();
311
        }
312 3
        return $this;
313
    }
314
315
    /**
316
     * Removes all active facets from the request.
317
     *
318
     * @return SearchRequest
319
     */
320 6
    public function removeAllFacets(): SearchRequest
321
    {
322 6
        $this->activeFacetContainer->removeAllFacets();
323 6
        if ($this->activeFacetContainer->hasChanged()) {
324 6
            $this->stateChanged = true;
325 6
            $this->activeFacetContainer->acknowledgeChange();
326
        }
327 6
        return $this;
328
    }
329
330
    /**
331
     * Check if an active facet has a given value
332
     *
333
     * @param string $facetName
334
     * @param mixed $facetValue
335
     * @return bool
336
     */
337 2
    public function getHasFacetValue(string $facetName, $facetValue): bool
338
    {
339 2
        return $this->activeFacetContainer->hasFacetValue($facetName, $facetValue);
340
    }
341
342
    /**
343
     * @return bool
344
     */
345 44
    public function getHasSorting(): bool
346
    {
347 44
        $path = $this->prefixWithNamespace('sort');
348 44
        return $this->argumentsAccessor->has($path);
0 ignored issues
show
Bug introduced by
The method has() does not exist on null. ( Ignorable by Annotation )

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

348
        return $this->argumentsAccessor->/** @scrutinizer ignore-call */ has($path);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
349
    }
350
351
    /**
352
     * Returns the sorting string in the url e.g. title asc.
353
     *
354
     * @return string
355
     */
356 43
    public function getSorting(): string
357
    {
358 43
        $path = $this->prefixWithNamespace('sort');
359 43
        return $this->argumentsAccessor->get($path, '');
360
    }
361
362
    /**
363
     * Helper function to get the sorting configuration name or direction.
364
     *
365
     * @param int $index
366
     * @return string
367
     */
368 43
    protected function getSortingPart(int $index): ?string
369
    {
370 43
        $sorting = $this->getSorting();
371 43
        if ($sorting === '') {
372 41
            return null;
373
        }
374
375 2
        $parts = explode(' ', $sorting);
376 2
        return $parts[$index] ?? null;
377
    }
378
379
    /**
380
     * Returns the sorting configuration name that is currently used.
381
     *
382
     * @return string
383
     */
384 43
    public function getSortingName(): ?string
385
    {
386 43
        return $this->getSortingPart(0);
387
    }
388
389
    /**
390
     * Returns the sorting direction that is currently used.
391
     *
392
     * @return string
393
     */
394 42
    public function getSortingDirection(): string
395
    {
396 42
        return mb_strtolower($this->getSortingPart(1) ?? '');
397
    }
398
399
    /**
400
     * @return SearchRequest
401
     */
402 1
    public function removeSorting(): SearchRequest
403
    {
404 1
        $path = $this->prefixWithNamespace('sort');
405 1
        $this->argumentsAccessor->reset($path);
406 1
        $this->stateChanged = true;
407 1
        return $this;
408
    }
409
410
    /**
411
     * @param string $sortingName
412
     * @param string $direction (asc or desc)
413
     *
414
     * @return SearchRequest
415
     */
416 2
    public function setSorting(string $sortingName, string $direction = 'asc'): SearchRequest
417
    {
418 2
        $value = $sortingName . ' ' . $direction;
419 2
        $path = $this->prefixWithNamespace('sort');
420 2
        $this->argumentsAccessor->set($path, $value);
421 2
        $this->stateChanged = true;
422 2
        return $this;
423
    }
424
425
    /**
426
     * Method to set the paginated page of the search
427
     *
428
     * @param int $page
429
     * @return SearchRequest
430
     */
431 6
    public function setPage(int $page): SearchRequest
432
    {
433 6
        $this->stateChanged = true;
434 6
        $path = $this->prefixWithNamespace('page');
435 6
        $this->argumentsAccessor->set($path, $page);
436
        // use initial url by switching back to page 0
437 6
        if ($page === 0) {
438 4
            $this->argumentsAccessor->reset($path);
439
        }
440 6
        return $this;
441
    }
442
443
    /**
444
     * Returns the passed page.
445
     *
446
     * @return int|null
447
     */
448 52
    public function getPage(): ?int
449
    {
450 52
        $path = $this->prefixWithNamespace('page');
451 52
        return $this->argumentsAccessor->get($path);
452
    }
453
454
    /**
455
     * Can be used to reset all groupPages.
456
     *
457
     * @return SearchRequest
458
     */
459 23
    public function removeAllGroupItemPages(): SearchRequest
460
    {
461 23
        $path = $this->prefixWithNamespace('groupPage');
462 23
        $this->argumentsAccessor->reset($path);
463
464 23
        return $this;
465
    }
466
467
    /**
468
     * Can be used to paginate within a groupItem.
469
     *
470
     * @param string $groupName e.g. type
471
     * @param string $groupItemValue e.g. pages
472
     * @param int $page
473
     * @return SearchRequest
474
     */
475 4
    public function setGroupItemPage(string $groupName, string $groupItemValue, int $page): SearchRequest
476
    {
477 4
        $this->stateChanged = true;
478 4
        $escapedValue = $this->getEscapedGroupItemValue($groupItemValue);
479 4
        $path = $this->prefixWithNamespace('groupPage:' . $groupName . ':' . $escapedValue);
480 4
        $this->argumentsAccessor->set($path, $page);
481 4
        return $this;
482
    }
483
484
    /**
485
     * Retrieves the current page for this group item.
486
     *
487
     * @param string $groupName
488
     * @param string $groupItemValue
489
     * @return int
490
     */
491 3
    public function getGroupItemPage(string $groupName, string $groupItemValue): int
492
    {
493 3
        $escapedValue = $this->getEscapedGroupItemValue($groupItemValue);
494 3
        $path = $this->prefixWithNamespace('groupPage:' . $groupName . ':' . $escapedValue);
495 3
        return max(1, (int)$this->argumentsAccessor->get($path));
496
    }
497
498
    /**
499
     * Removes all non-alphanumeric values from the groupItem value to have a valid array key.
500
     *
501
     * @param string $groupItemValue
502
     * @return string
503
     */
504 5
    protected function getEscapedGroupItemValue(string $groupItemValue): string
505
    {
506 5
        return preg_replace('/[^A-Za-z0-9]/', '', $groupItemValue);
507
    }
508
509
    /**
510
     * Retrieves the highest page of the groups.
511
     *
512
     * @return int
513
     */
514 1
    public function getHighestGroupPage(): int
515
    {
516 1
        $max = 1;
517 1
        $path = $this->prefixWithNamespace('groupPage');
518 1
        $groupPages = $this->argumentsAccessor->get($path, []);
519 1
        foreach ($groupPages as $groups) {
520
            if (!is_array($groups)) {
521
                continue;
522
            }
523
            foreach ($groups as $groupItemPage) {
524
                if ((int)$groupItemPage > $max) {
525
                    $max = (int)$groupItemPage;
526
                }
527
            }
528
        }
529
530 1
        return $max;
531
    }
532
533
    /**
534
     * Method to overwrite the query string.
535
     *
536
     * @param string $rawQueryString
537
     * @return SearchRequest
538
     */
539 17
    public function setRawQueryString(string $rawQueryString = ''): SearchRequest
540
    {
541 17
        $this->stateChanged = true;
542 17
        $path = $this->prefixWithNamespace('q');
543 17
        $this->argumentsAccessor->set($path, $rawQueryString);
544 17
        return $this;
545
    }
546
547
    /**
548
     * Returns the passed rawQueryString.
549
     *
550
     * @return string
551
     */
552 44
    public function getRawUserQuery(): string
553
    {
554 44
        $path = $this->prefixWithNamespace('q');
555 44
        $query = $this->argumentsAccessor->get($path);
556 44
        return (string)($query ?? '');
557
    }
558
559
    /**
560
     * Method to check if the query string is an empty string
561
     * (also empty string or whitespaces only are handled as empty).
562
     *
563
     * When no query string is set (null) the method returns false.
564
     * @return bool
565
     */
566 43
    public function getRawUserQueryIsEmptyString(): bool
567
    {
568 43
        $path = $this->prefixWithNamespace('q');
569 43
        $query = $this->argumentsAccessor->get($path);
570
571 43
        if ($query === null) {
572 3
            return false;
573
        }
574
575 40
        if (trim($query) === '') {
576 2
            return true;
577
        }
578
579 38
        return false;
580
    }
581
582
    /**
583
     * This method returns true when no querystring is present at all.
584
     * Which means no search by the user was triggered
585
     *
586
     * @return bool
587
     */
588 49
    public function getRawUserQueryIsNull(): bool
589
    {
590 49
        $path = $this->prefixWithNamespace('q');
591 49
        $query = $this->argumentsAccessor->get($path);
592 49
        return $query === null;
593
    }
594
595
    /**
596
     * Sets the results per page that are used during search.
597
     *
598
     * @param int $resultsPerPage
599
     * @return SearchRequest
600
     */
601 50
    public function setResultsPerPage(int $resultsPerPage): SearchRequest
602
    {
603 50
        $path = $this->prefixWithNamespace('resultsPerPage');
604 50
        $this->argumentsAccessor->set($path, $resultsPerPage);
605 50
        $this->stateChanged = true;
606
607 50
        return $this;
608
    }
609
610
    /**
611
     * @return bool
612
     */
613 1
    public function getStateChanged(): bool
614
    {
615 1
        return $this->stateChanged;
616
    }
617
618
    /**
619
     * Returns the passed resultsPerPage value
620
     * @return int
621
     */
622 51
    public function getResultsPerPage(): int
623
    {
624 51
        $path = $this->prefixWithNamespace('resultsPerPage');
625 51
        return (int)$this->argumentsAccessor->get($path);
626
    }
627
628
    /**
629
     * Allows setting additional filters that are used on time and not transported during the request.
630
     *
631
     * @param array $additionalFilters
632
     * @return SearchRequest
633
     */
634 3
    public function setAdditionalFilters(array $additionalFilters): SearchRequest
635
    {
636 3
        $path = $this->prefixWithNamespace('additionalFilters');
637 3
        $this->argumentsAccessor->set($path, $additionalFilters);
638 3
        $this->stateChanged = true;
639
640 3
        return $this;
641
    }
642
643
    /**
644
     * Retrieves the additional filters that have been set
645
     *
646
     * @return array
647
     */
648 41
    public function getAdditionalFilters(): array
649
    {
650 41
        $path = $this->prefixWithNamespace('additionalFilters');
651 41
        return $this->argumentsAccessor->get($path, []);
652
    }
653
654
    /**
655
     * @return int
656
     */
657 2
    public function getContextSystemLanguageUid(): int
658
    {
659 2
        return $this->contextSystemLanguageUid;
660
    }
661
662
    /**
663
     * @return int
664
     */
665 2
    public function getContextPageUid(): int
666
    {
667 2
        return $this->contextPageUid;
668
    }
669
670
    /**
671
     * Get contextTypoScriptConfiguration
672
     *
673
     * @return TypoScriptConfiguration
674
     */
675 54
    public function getContextTypoScriptConfiguration(): ?TypoScriptConfiguration
676
    {
677 54
        return $this->contextTypoScriptConfiguration;
678
    }
679
680
    /**
681
     * Assigns the last known persistedArguments and restores their state.
682
     *
683
     * @return SearchRequest
684
     */
685 104
    public function reset(): SearchRequest
686
    {
687 104
        $this->argumentsAccessor = new ArrayAccessor($this->persistedArguments);
688 104
        $this->stateChanged = false;
689 104
        $this->activeFacetContainer = new UrlFacetContainer(
690 104
            $this->argumentsAccessor,
691 104
            $this->argumentNameSpace ?? self::DEFAULT_PLUGIN_NAMESPACE,
692 104
            $this->contextTypoScriptConfiguration === null ?
693 51
                UrlFacetContainer::PARAMETER_STYLE_INDEX :
694 104
                $this->contextTypoScriptConfiguration->getSearchFacetingUrlParameterStyle()
695 104
        );
696
697
        // If the default of sorting parameter should be true, a modification of this condition is needed.
698
        // If instance of contextTypoScriptConfiguration is not TypoScriptConfiguration the sort should be enabled too
699 104
        if ($this->contextTypoScriptConfiguration instanceof TypoScriptConfiguration
700 104
            && $this->contextTypoScriptConfiguration->getSearchFacetingUrlParameterSort()
701
        ) {
702
            $this->activeFacetContainer->enableSort();
703
        }
704
705 104
        return $this;
706
    }
707
708
    /**
709
     * This can be used to start a new sub request, e.g. for a faceted search.
710
     *
711
     * @param bool $onlyPersistentArguments
712
     * @return SearchRequest
713
     */
714 39
    public function getCopyForSubRequest(bool $onlyPersistentArguments = true): SearchRequest
715
    {
716 39
        if (!$onlyPersistentArguments) {
717
            // create a new request with all data
718
            $argumentsArray = $this->argumentsAccessor->getData();
719
            return new SearchRequest(
720
                $argumentsArray,
721
                $this->contextPageUid,
722
                $this->contextSystemLanguageUid,
723
                $this->contextTypoScriptConfiguration
724
            );
725
        }
726
727 39
        $arguments = new ArrayAccessor();
728 39
        foreach ($this->persistentArgumentsPaths as $persistentArgumentPath) {
729 39
            if ($this->argumentsAccessor->has($persistentArgumentPath)) {
730 31
                $arguments->set($persistentArgumentPath, $this->argumentsAccessor->get($persistentArgumentPath));
731
            }
732
        }
733
734 39
        return new SearchRequest(
735 39
            $arguments->getData(),
736 39
            $this->contextPageUid,
737 39
            $this->contextSystemLanguageUid,
738 39
            $this->contextTypoScriptConfiguration
739 39
        );
740
    }
741
742
    /**
743
     * @return string
744
     * @noinspection PhpUnused
745
     */
746 22
    public function getArgumentNamespace(): string
747
    {
748 22
        return $this->argumentNameSpace;
749
    }
750
751
    /**
752
     * @return array
753
     */
754 43
    public function getAsArray(): array
755
    {
756 43
        return $this->argumentsAccessor->getData();
757
    }
758
759
    /**
760
     * Returns only the arguments as array.
761
     *
762
     * @return array
763
     */
764 17
    public function getArguments(): array
765
    {
766 17
        return $this->argumentsAccessor->get($this->argumentNameSpace) ?? [];
767
    }
768
}
769