1 | <?php declare(strict_types = 1); |
||
2 | |||
3 | namespace ApacheSolrForTypo3\Solr\System\Session; |
||
4 | |||
5 | /*************************************************************** |
||
6 | * Copyright notice |
||
7 | * |
||
8 | * (c) 2010-2017 dkd Internet Service GmbH <[email protected]> |
||
9 | * |
||
10 | * All rights reserved |
||
11 | * |
||
12 | * This script is part of the TYPO3 project. The TYPO3 project is |
||
13 | * free software; you can redistribute it and/or modify |
||
14 | * it under the terms of the GNU General Public License as published by |
||
15 | * the Free Software Foundation; either version 3 of the License, or |
||
16 | * (at your option) any later version. |
||
17 | * |
||
18 | * The GNU General Public License can be found at |
||
19 | * http://www.gnu.org/copyleft/gpl.html. |
||
20 | * |
||
21 | * This script is distributed in the hope that it will be useful, |
||
22 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
23 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
24 | * GNU General Public License for more details. |
||
25 | * |
||
26 | * This copyright notice MUST APPEAR in all copies of the script! |
||
27 | ***************************************************************/ |
||
28 | |||
29 | use TYPO3\CMS\Frontend\Authentication\FrontendUserAuthentication; |
||
30 | |||
31 | /** |
||
32 | * Encapsulates the access to the session of the frontend user. |
||
33 | * |
||
34 | * @author Timo Hund <[email protected]> |
||
35 | */ |
||
36 | class FrontendUserSession |
||
37 | { |
||
38 | |||
39 | /** |
||
40 | * @var FrontendUserAuthentication |
||
41 | */ |
||
42 | protected $feUser; |
||
43 | |||
44 | /** |
||
45 | * FrontendUserSession constructor. |
||
46 | * @param FrontendUserAuthentication $feUser |
||
47 | */ |
||
48 | 43 | public function __construct(FrontendUserAuthentication $feUser = null) |
|
49 | { |
||
50 | 43 | $this->feUser = $feUser ?? $GLOBALS['TSFE']->fe_user; |
|
51 | 43 | } |
|
52 | |||
53 | /** |
||
54 | * @param int $requestedPerPage |
||
55 | */ |
||
56 | 5 | public function setPerPage(int $requestedPerPage) |
|
57 | { |
||
58 | 5 | $this->feUser->setKey('ses', 'tx_solr_resultsPerPage', intval($requestedPerPage)); |
|
59 | 5 | } |
|
60 | |||
61 | /** |
||
62 | * @return int |
||
63 | */ |
||
64 | 6 | public function getPerPage() : int |
|
65 | { |
||
66 | 6 | return (int)$this->feUser->getKey('ses', 'tx_solr_resultsPerPage'); |
|
67 | } |
||
68 | |||
69 | /** |
||
70 | * @return boolean |
||
71 | */ |
||
72 | 36 | public function getHasPerPage() |
|
73 | { |
||
74 | 36 | return $this->feUser->getKey('ses', 'tx_solr_resultsPerPage') !== null; |
|
75 | } |
||
76 | |||
77 | /** |
||
78 | * @return array |
||
79 | */ |
||
80 | 33 | public function getLastSearches() : array |
|
81 | { |
||
82 | 33 | $result = $this->feUser->getKey('ses', 'tx_solr_lastSearches'); |
|
83 | 33 | return is_array($result) ? $result : []; |
|
84 | } |
||
85 | |||
86 | /** |
||
87 | * @param array $lastSearches |
||
88 | */ |
||
89 | 24 | public function setLastSearches(array $lastSearches) |
|
90 | { |
||
91 | 24 | return $this->feUser->setKey('ses', 'tx_solr_lastSearches', $lastSearches); |
|
0 ignored issues
–
show
|
|||
92 | } |
||
93 | } |
This check looks for function or method calls that always return null and whose return value is used.
The method
getObject()
can return nothing but null, so it makes no sense to use the return value.The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.