Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
10.00% |
1 / 10 |
|
12.50% |
1 / 8 |
CRAP | |
0.00% |
0 / 1 |
| common_session_AnonymousSession | |
10.00% |
1 / 10 |
|
12.50% |
1 / 8 |
68.05 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getUserLabel | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getUserRoles | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getDataLanguage | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getInterfaceLanguage | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
6 | |||
| getTimeZone | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getUserPropertyValues | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| refresh | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU General Public License |
| 6 | * as published by the Free Software Foundation; under version 2 |
| 7 | * of the License (non-upgradable). |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write to the Free Software |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 17 | * |
| 18 | * Copyright (c) 2017 (original work) Open Assessment Technologies SA (under the project TAO-PRODUCT); |
| 19 | * |
| 20 | */ |
| 21 | |
| 22 | use oat\generis\model\GenerisRdf; |
| 23 | use oat\oatbox\user\AnonymousUser; |
| 24 | use oat\oatbox\user\UserLanguageServiceInterface; |
| 25 | use oat\oatbox\session\SessionContext; |
| 26 | |
| 27 | /** |
| 28 | * Represents a userless Session. |
| 29 | * |
| 30 | * @access private |
| 31 | * @author Joel Bout, <joel@taotesting.com> |
| 32 | * @package generis |
| 33 | |
| 34 | */ |
| 35 | class common_session_AnonymousSession extends common_session_BasicSession implements common_session_StatelessSession |
| 36 | { |
| 37 | /** |
| 38 | * @param SessionContext[] $contexts |
| 39 | */ |
| 40 | public function __construct($contexts = []) |
| 41 | { |
| 42 | parent::__construct(new AnonymousUser(), $contexts); |
| 43 | } |
| 44 | |
| 45 | /** |
| 46 | * (non-PHPdoc) |
| 47 | * @see common_session_Session::getDataLanguage() |
| 48 | */ |
| 49 | public function getUserLabel() |
| 50 | { |
| 51 | return __('guest'); |
| 52 | } |
| 53 | |
| 54 | /** |
| 55 | * (non-PHPdoc) |
| 56 | * @see common_session_Session::getUserRoles() |
| 57 | */ |
| 58 | public function getUserRoles() |
| 59 | { |
| 60 | return [GenerisRdf::INSTANCE_ROLE_ANONYMOUS]; |
| 61 | } |
| 62 | |
| 63 | /** |
| 64 | * (non-PHPdoc) |
| 65 | * @see common_session_Session::getDataLanguage() |
| 66 | */ |
| 67 | public function getDataLanguage() |
| 68 | { |
| 69 | return $this->getServiceLocator()->get(UserLanguageServiceInterface::SERVICE_ID)->getDefaultLanguage(); |
| 70 | } |
| 71 | |
| 72 | /** |
| 73 | * (non-PHPdoc) |
| 74 | * @see common_session_Session::getInterfaceLanguage() |
| 75 | */ |
| 76 | public function getInterfaceLanguage() |
| 77 | { |
| 78 | return defined('DEFAULT_ANONYMOUS_INTERFACE_LANG') |
| 79 | ? DEFAULT_ANONYMOUS_INTERFACE_LANG |
| 80 | : $this->getServiceLocator()->get(UserLanguageServiceInterface::SERVICE_ID)->getDefaultLanguage(); |
| 81 | ; |
| 82 | } |
| 83 | |
| 84 | /** |
| 85 | * (non-PHPdoc) |
| 86 | * @see common_session_Session::getTimeZone() |
| 87 | */ |
| 88 | public function getTimeZone() |
| 89 | { |
| 90 | return TIME_ZONE; |
| 91 | } |
| 92 | |
| 93 | /** |
| 94 | * (non-PHPdoc) |
| 95 | * @see common_session_Session::getUserPropertyValues() |
| 96 | */ |
| 97 | public function getUserPropertyValues($property) |
| 98 | { |
| 99 | return []; |
| 100 | } |
| 101 | |
| 102 | /** |
| 103 | * (non-PHPdoc) |
| 104 | * @see common_session_Session::refresh() |
| 105 | */ |
| 106 | public function refresh() |
| 107 | { |
| 108 | // nothing to do here |
| 109 | } |
| 110 | } |