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

valkyrjaio / valkyrja / 16039388639

03 Jul 2025 01:23AM UTC coverage: 39.501% (+0.5%) from 38.991%
16039388639

push

github

MelechMizrachi
PHP CS Fixer: Fixing styling issues.

4052 of 10258 relevant lines covered (39.5%)

4.96 hits per line

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

0.0
/src/Valkyrja/Auth/Middleware/AuthUniqueCacheResponseMiddleware.php
1
<?php
2

3
declare(strict_types=1);
4

5
/*
6
 * This file is part of the Valkyrja Framework package.
7
 *
8
 * (c) Melech Mizrachi <melechmizrachi@gmail.com>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13

14
namespace Valkyrja\Auth\Middleware;
15

16
use Valkyrja\Auth\Contract\Auth;
17
use Valkyrja\Filesystem\Contract\Filesystem;
18
use Valkyrja\Filesystem\InMemoryFilesystem;
19
use Valkyrja\Http\Message\Request\Contract\ServerRequest;
20
use Valkyrja\Http\Middleware\Cache\CacheResponseMiddleware;
21

22
use function md5;
23

24
/**
25
 * Class AuthUniqueCacheResponseMiddleware.
26
 *
27
 * @author Melech Mizrachi
28
 */
29
class AuthUniqueCacheResponseMiddleware extends CacheResponseMiddleware
30
{
31
    public function __construct(
32
        protected Auth $auth,
33
        Filesystem $filesystem = new InMemoryFilesystem(),
34
        bool $debug = false
35
    ) {
36
        parent::__construct(
×
37
            filesystem: $filesystem,
×
38
            debug: $debug
×
39
        );
×
40
    }
41

42
    /**
43
     * @inheritDoc
44
     */
45
    protected function getHashedPath(ServerRequest $request): string
46
    {
47
        $auth     = $this->auth;
×
48
        $userPart = '';
×
49

50
        if ($auth->isAuthenticated()) {
×
51
            $userPart = md5($auth->getUser()->__toString());
×
52
        }
53

54
        return parent::getHashedPath($request) . $userPart;
×
55
    }
56
}
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

© 2026 Coveralls, Inc