• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

craue / CraueFormFlowBundle / 15440729708

04 Jun 2025 11:09AM UTC coverage: 99.474% (+0.2%) from 99.281%
15440729708

push

github

craue
dropped support for Symfony 4.4, 6.3, 7.0, 7.1

4 of 4 new or added lines in 3 files covered. (100.0%)

2 existing lines in 2 files now uncovered.

756 of 760 relevant lines covered (99.47%)

775.76 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

90.0
/Storage/SessionProviderTrait.php
1
<?php
2

3
namespace Craue\FormFlowBundle\Storage;
4

5
use Craue\FormFlowBundle\Exception\InvalidTypeException;
6
use Symfony\Component\HttpFoundation\RequestStack;
7
use Symfony\Component\HttpFoundation\Session\SessionInterface;
8

9
/**
10
 * @internal
11
 *
12
 * @author Christian Raue <christian.raue@gmail.com>
13
 * @copyright 2011-2024 Christian Raue
14
 * @license http://opensource.org/licenses/mit-license.php MIT License
15
 */
16
trait SessionProviderTrait {
17

18
        /**
19
         * @var RequestStack|null
20
         */
21
        private $requestStack;
22

23
        /**
24
         * @var SessionInterface|null
25
         */
26
        private $session;
27

28
        /**
29
         * @param RequestStack|SessionInterface $requestStackOrSession
30
         * @throws InvalidTypeException
31
         */
32
        private function setRequestStackOrSession($requestStackOrSession) : void {
33
                // TODO accept only RequestStack as soon as Symfony >= 6.0 is required
34

35
                if ($requestStackOrSession instanceof SessionInterface) {
1,869✔
36
                        $this->session = $requestStackOrSession;
252✔
37

38
                        return;
252✔
39
                }
40

41
                if ($requestStackOrSession instanceof RequestStack) {
1,617✔
42
                        $this->requestStack = $requestStackOrSession;
1,617✔
43

44
                        return;
1,617✔
45
                }
46

UNCOV
47
                throw new InvalidTypeException($requestStackOrSession, [RequestStack::class, SessionInterface::class]);
×
48
        }
49

50
        private function getSession() : SessionInterface {
51
                if ($this->requestStack !== null) {
1,608✔
52
                        return $this->requestStack->getSession();
1,527✔
53
                }
54

55
                return $this->session;
81✔
56
        }
57

58
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc