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

codeigniter4 / CodeIgniter4 / 12271934981

11 Dec 2024 07:51AM UTC coverage: 84.405%. First build
12271934981

Pull #9311

github

web-flow
Merge 00b3b1bbd into 1b530cd8b
Pull Request #9311: refactor: enable code quality level 34 for rector

27 of 40 new or added lines in 19 files covered. (67.5%)

20604 of 24411 relevant lines covered (84.4%)

190.63 hits per line

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

88.89
/system/Filters/ForceHTTPS.php
1
<?php
2

3
declare(strict_types=1);
4

5
/**
6
 * This file is part of CodeIgniter 4 framework.
7
 *
8
 * (c) CodeIgniter Foundation <admin@codeigniter.com>
9
 *
10
 * For the full copyright and license information, please view
11
 * the LICENSE file that was distributed with this source code.
12
 */
13

14
namespace CodeIgniter\Filters;
15

16
use CodeIgniter\HTTP\Exceptions\RedirectException;
17
use CodeIgniter\HTTP\RequestInterface;
18
use CodeIgniter\HTTP\ResponseInterface;
19
use Config\App;
20

21
/**
22
 * Force HTTPS filter
23
 */
24
class ForceHTTPS implements FilterInterface
25
{
26
    /**
27
     * Force Secure Site Access? If the config value 'forceGlobalSecureRequests'
28
     * is true, will enforce that all requests to this site are made through
29
     * HTTPS. Will redirect the user to the current page with HTTPS, as well
30
     * as set the HTTP Strict Transport Security (HSTS) header for those browsers
31
     * that support it.
32
     *
33
     * @param array|null $arguments
34
     *
35
     * @return ResponseInterface|null
36
     */
37
    public function before(RequestInterface $request, $arguments = null)
38
    {
39
        $config = config(App::class);
91✔
40

41
        if ($config->forceGlobalSecureRequests !== true) {
91✔
42
            return null;
89✔
43
        }
44

45
        $response = service('response');
2✔
46

47
        try {
48
            force_https(YEAR, $request, $response);
2✔
49
        } catch (RedirectException $e) {
1✔
50
            return $e->getResponse();
1✔
51
        }
52

53
        return null;
1✔
54
    }
55

56
    /**
57
     * We don't have anything to do here.
58
     *
59
     * @param array|null $arguments
60
     */
61
    public function after(RequestInterface $request, ResponseInterface $response, $arguments = null)
62
    {
NEW
63
        return null;
×
64
    }
65
}
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