| 1 | <?php |
||
| 12 | class GlobalContextFactory |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * @var LanguageProvider |
||
| 16 | */ |
||
| 17 | private $languageProvider; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * GlobalContextFactory constructor. |
||
| 21 | * |
||
| 22 | * @param LanguageProvider $languageProvider |
||
| 23 | */ |
||
| 24 | public function __construct(LanguageProvider $languageProvider) |
||
| 28 | |||
| 29 | /** |
||
| 30 | * Creates a global context from given request. |
||
| 31 | * |
||
| 32 | * @param Request $request |
||
| 33 | * |
||
| 34 | * @return GlobalContext |
||
| 35 | */ |
||
| 36 | public function createFromRequest(Request $request) |
||
| 43 | |||
| 44 | /** |
||
| 45 | * Creates a global context from request stack. |
||
| 46 | * |
||
| 47 | * @param RequestStack $requestStack |
||
| 48 | * |
||
| 49 | * @return GlobalContext |
||
| 50 | */ |
||
| 51 | public function createFromRequestStack(RequestStack $requestStack) |
||
| 57 | } |
||
| 58 |
Unless you are absolutely sure that the expression can never be null because of other conditions, we strongly recommend to add an additional type check to your code: