Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
9 / 9 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| HomeUrl | |
100.00% |
9 / 9 |
|
100.00% |
1 / 1 |
4 | |
100.00% |
1 / 1 |
| create | |
100.00% |
9 / 9 |
|
100.00% |
1 / 1 |
4 | |||
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * |
| 5 | * @package Zmsticketprinter |
| 6 | * @copyright BerlinOnline Stadtportal GmbH & Co. KG |
| 7 | * |
| 8 | */ |
| 9 | |
| 10 | namespace BO\Zmsticketprinter\Helper; |
| 11 | |
| 12 | use BO\Mellon\Validator; |
| 13 | |
| 14 | class HomeUrl |
| 15 | { |
| 16 | /** |
| 17 | * check if new home url is requested, if not check if url exists in cookie, |
| 18 | * otherwise set current uri from request as new home url |
| 19 | * |
| 20 | **/ |
| 21 | |
| 22 | public static function create($request) |
| 23 | { |
| 24 | $homeUrl = null; |
| 25 | $validator = $request->getAttribute('validator'); |
| 26 | $ticketprinter = $validator->getParameter('ticketprinter')->isArray()->getValue(); |
| 27 | if ($ticketprinter && array_key_exists('home', $ticketprinter)) { |
| 28 | $homeUrl = Validator::value($ticketprinter['home'])->isUrl()->getValue(); |
| 29 | } elseif (!$homeUrl) { |
| 30 | $homeUrl = $request->getRequestTarget(); |
| 31 | } |
| 32 | //\App::$log->debug("HOMEURL", [$homeUrl, $request->getRequestTarget()]); |
| 33 | \BO\Zmsclient\Ticketprinter::setHomeUrl($homeUrl, $request); |
| 34 | return $homeUrl; |
| 35 | } |
| 36 | } |