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

codeigniter4 / CodeIgniter4 / 26446585046

26 May 2026 10:21AM UTC coverage: 88.48%. First build
26446585046

Pull #10216

github

web-flow
Merge 7c7b1dd7d into aad4c9dcc
Pull Request #10216: feat: add source-specific typed request input

13 of 15 new or added lines in 2 files covered. (86.67%)

24216 of 27369 relevant lines covered (88.48%)

221.5 hits per line

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

94.54
/system/HTTP/IncomingRequest.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\HTTP;
15

16
use CodeIgniter\Exceptions\InvalidArgumentException;
17
use CodeIgniter\HTTP\Exceptions\HTTPException;
18
use CodeIgniter\HTTP\Files\FileCollection;
19
use CodeIgniter\HTTP\Files\UploadedFile;
20
use Config\App;
21
use Config\Services;
22
use Locale;
23
use stdClass;
24

25
/**
26
 * Class IncomingRequest
27
 *
28
 * Represents an incoming, server-side HTTP request.
29
 *
30
 * Per the HTTP specification, this interface includes properties for
31
 * each of the following:
32
 *
33
 * - Protocol version
34
 * - HTTP method
35
 * - URI
36
 * - Headers
37
 * - Message body
38
 *
39
 * Additionally, it encapsulates all data as it has arrived to the
40
 * application from the CGI and/or PHP environment, including:
41
 *
42
 * - The values represented in $_SERVER.
43
 * - Any cookies provided (generally via $_COOKIE)
44
 * - Query string arguments (generally via $_GET, or as parsed via parse_str())
45
 * - Upload files, if any (as represented by $_FILES)
46
 * - Deserialized body binds (generally from $_POST)
47
 *
48
 * @see \CodeIgniter\HTTP\IncomingRequestTest
49
 */
50
class IncomingRequest extends Request
51
{
52
    /**
53
     * The URI for this request.
54
     *
55
     * Note: This WILL NOT match the actual URL in the browser since for
56
     * everything this cares about (and the router, etc) is the portion
57
     * AFTER the baseURL. So, if hosted in a sub-folder this will
58
     * appear different than actual URI path. If you need that use getPath().
59
     *
60
     * @var URI
61
     */
62
    protected $uri;
63

64
    /**
65
     * The detected URI path (relative to the baseURL).
66
     *
67
     * Note: current_url() uses this to build its URI,
68
     * so this becomes the source for the "current URL"
69
     * when working with the share request instance.
70
     *
71
     * @var string|null
72
     */
73
    protected $path;
74

75
    /**
76
     * File collection
77
     *
78
     * @var FileCollection|null
79
     */
80
    protected $files;
81

82
    /**
83
     * Negotiator
84
     *
85
     * @var Negotiate|null
86
     */
87
    protected $negotiator;
88

89
    /**
90
     * The default Locale this request
91
     * should operate under.
92
     *
93
     * @var string
94
     */
95
    protected $defaultLocale;
96

97
    /**
98
     * The current locale of the application.
99
     * Default value is set in app/Config/App.php
100
     *
101
     * @var string
102
     */
103
    protected $locale;
104

105
    /**
106
     * Stores the valid locale codes.
107
     *
108
     * @var array
109
     */
110
    protected $validLocales = [];
111

112
    /**
113
     * Holds the old data from a redirect.
114
     *
115
     * @var array
116
     */
117
    protected $oldInput = [];
118

119
    /**
120
     * The user agent this request is from.
121
     *
122
     * @var UserAgent
123
     */
124
    protected $userAgent;
125

126
    /**
127
     * Constructor
128
     *
129
     * @param App         $config
130
     * @param string|null $body
131
     */
132
    public function __construct($config, ?URI $uri = null, $body = 'php://input', ?UserAgent $userAgent = null)
133
    {
134
        if (! $uri instanceof URI || ! $userAgent instanceof UserAgent) {
3,421✔
135
            throw new InvalidArgumentException('You must supply the parameters: uri, userAgent.');
×
136
        }
137

138
        $this->populateHeaders();
3,421✔
139

140
        if (
141
            $body === 'php://input'
3,421✔
142
            // php://input is not available with enctype="multipart/form-data".
143
            // See https://www.php.net/manual/en/wrappers.php.php#wrappers.php.input
144
            && ! str_contains($this->getHeaderLine('Content-Type'), 'multipart/form-data')
3,421✔
145
            && (int) $this->getHeaderLine('Content-Length') <= $this->getPostMaxSize()
3,421✔
146
        ) {
147
            // Get our body from php://input
148
            $body = file_get_contents('php://input');
3,053✔
149
        }
150

151
        // If file_get_contents() returns false or empty string, set null.
152
        if ($body === false || $body === '') {
3,421✔
153
            $body = null;
3,056✔
154
        }
155

156
        $this->uri          = $uri;
3,421✔
157
        $this->body         = $body;
3,421✔
158
        $this->userAgent    = $userAgent;
3,421✔
159
        $this->validLocales = $config->supportedLocales;
3,421✔
160

161
        parent::__construct($config);
3,421✔
162

163
        if ($uri instanceof SiteURI) {
3,421✔
164
            $this->setPath($uri->getRoutePath());
3,421✔
165
        } else {
166
            $this->setPath($uri->getPath());
×
167
        }
168

169
        $this->detectLocale($config);
3,421✔
170
    }
171

172
    private function getPostMaxSize(): int
173
    {
174
        $postMaxSize = ini_get('post_max_size');
3,053✔
175

176
        return match (strtoupper(substr($postMaxSize, -1))) {
3,053✔
NEW
177
            'G'     => (int) str_replace('G', '', $postMaxSize) * 1024 ** 3,
×
178
            'M'     => (int) str_replace('M', '', $postMaxSize) * 1024 ** 2,
3,053✔
NEW
179
            'K'     => (int) str_replace('K', '', $postMaxSize) * 1024,
×
180
            default => (int) $postMaxSize,
3,053✔
181
        };
3,053✔
182
    }
183

184
    /**
185
     * Handles setting up the locale, perhaps auto-detecting through
186
     * content negotiation.
187
     *
188
     * @param App $config
189
     *
190
     * @return void
191
     */
192
    public function detectLocale($config)
193
    {
194
        $this->locale = $this->defaultLocale = $config->defaultLocale;
3,421✔
195

196
        if (! $config->negotiateLocale) {
3,421✔
197
            return;
3,421✔
198
        }
199

200
        $this->setLocale($this->negotiate('language', $config->supportedLocales));
2✔
201
    }
202

203
    /**
204
     * Provides a convenient way to work with the Negotiate class
205
     * for content negotiation.
206
     */
207
    public function negotiate(string $type, array $supported, bool $strictMatch = false): string
208
    {
209
        if ($this->negotiator === null) {
8✔
210
            $this->negotiator = Services::negotiator($this, true);
8✔
211
        }
212

213
        return match (strtolower($type)) {
8✔
214
            'media'    => $this->negotiator->media($supported, $strictMatch),
2✔
215
            'charset'  => $this->negotiator->charset($supported),
1✔
216
            'encoding' => $this->negotiator->encoding($supported),
1✔
217
            'language' => $this->negotiator->language($supported),
3✔
218
            default    => throw HTTPException::forInvalidNegotiationType($type),
8✔
219
        };
8✔
220
    }
221

222
    /**
223
     * Checks this request type.
224
     */
225
    public function is(string $type): bool
226
    {
227
        $valueUpper = strtoupper($type);
55✔
228

229
        $httpMethods = Method::all();
55✔
230

231
        if (in_array($valueUpper, $httpMethods, true)) {
55✔
232
            return $this->getMethod() === $valueUpper;
44✔
233
        }
234

235
        if ($valueUpper === 'JSON') {
11✔
236
            return str_contains($this->getHeaderLine('Content-Type'), 'application/json');
9✔
237
        }
238

239
        if ($valueUpper === 'AJAX') {
2✔
240
            return $this->isAJAX();
1✔
241
        }
242

243
        throw new InvalidArgumentException('Unknown type: ' . $type);
1✔
244
    }
245

246
    /**
247
     * Determines if this request was made from the command line (CLI).
248
     */
249
    public function isCLI(): bool
250
    {
251
        return false;
1✔
252
    }
253

254
    /**
255
     * Test to see if a request contains the HTTP_X_REQUESTED_WITH header.
256
     */
257
    public function isAJAX(): bool
258
    {
259
        return $this->hasHeader('X-Requested-With')
93✔
260
            && strtolower($this->header('X-Requested-With')->getValue()) === 'xmlhttprequest';
93✔
261
    }
262

263
    /**
264
     * Attempts to detect if the current connection is secure through
265
     * a few different methods.
266
     */
267
    public function isSecure(): bool
268
    {
269
        $https = service('superglobals')->server('HTTPS');
6✔
270

271
        if ($https !== null && strtolower($https) !== 'off') {
6✔
272
            return true;
1✔
273
        }
274

275
        if ($this->hasHeader('X-Forwarded-Proto') && $this->header('X-Forwarded-Proto')->getValue() === 'https') {
5✔
276
            return true;
1✔
277
        }
278

279
        return $this->hasHeader('Front-End-Https') && ! empty($this->header('Front-End-Https')->getValue()) && strtolower($this->header('Front-End-Https')->getValue()) !== 'off';
4✔
280
    }
281

282
    /**
283
     * Sets the URI path relative to baseURL.
284
     *
285
     * Note: Since current_url() accesses the shared request
286
     * instance, this can be used to change the "current URL"
287
     * for testing.
288
     *
289
     * @param string $path URI path relative to baseURL
290
     *
291
     * @return $this
292
     */
293
    private function setPath(string $path)
294
    {
295
        $this->path = $path;
3,421✔
296

297
        return $this;
3,421✔
298
    }
299

300
    /**
301
     * Returns the URI path relative to baseURL,
302
     * running detection as necessary.
303
     */
304
    public function getPath(): string
305
    {
306
        return $this->path;
110✔
307
    }
308

309
    /**
310
     * Sets the locale string for this request.
311
     *
312
     * @return IncomingRequest
313
     */
314
    public function setLocale(string $locale)
315
    {
316
        // If it's not a valid locale, set it
317
        // to the default locale for the site.
318
        if (! in_array($locale, $this->validLocales, true)) {
5✔
319
            $locale = $this->defaultLocale;
1✔
320
        }
321

322
        $this->locale = $locale;
5✔
323
        Locale::setDefault($locale);
5✔
324

325
        return $this;
5✔
326
    }
327

328
    /**
329
     * Set the valid locales.
330
     *
331
     * @return $this
332
     */
333
    public function setValidLocales(array $locales)
334
    {
335
        $this->validLocales = $locales;
1✔
336

337
        return $this;
1✔
338
    }
339

340
    /**
341
     * Gets the current locale, with a fallback to the default
342
     * locale if none is set.
343
     */
344
    public function getLocale(): string
345
    {
346
        return $this->locale;
561✔
347
    }
348

349
    /**
350
     * Returns the default locale as set in app/Config/App.php
351
     */
352
    public function getDefaultLocale(): string
353
    {
354
        return $this->defaultLocale;
3✔
355
    }
356

357
    /**
358
     * Fetch an item from JSON input stream with fallback to $_REQUEST object. This is the simplest way
359
     * to grab data from the request object and can be used in lieu of the
360
     * other get* methods in most cases.
361
     *
362
     * @param array|string|null $index
363
     * @param int|null          $filter Filter constant
364
     * @param array|int|null    $flags
365
     *
366
     * @return array|bool|float|int|stdClass|string|null
367
     */
368
    public function getVar($index = null, $filter = null, $flags = null)
369
    {
370
        if (
371
            str_contains($this->getHeaderLine('Content-Type'), 'application/json')
18✔
372
            && $this->body !== null
18✔
373
        ) {
374
            return $this->getJsonVar($index, false, $filter, $flags);
1✔
375
        }
376

377
        return $this->fetchGlobal('request', $index, $filter, $flags);
17✔
378
    }
379

380
    /**
381
     * A convenience method that grabs the raw input stream and decodes
382
     * the JSON into an array.
383
     *
384
     * If $assoc == true, then all objects in the response will be converted
385
     * to associative arrays.
386
     *
387
     * @param bool $assoc   Whether to return objects as associative arrays
388
     * @param int  $depth   How many levels deep to decode
389
     * @param int  $options Bitmask of options
390
     *
391
     * @see http://php.net/manual/en/function.json-decode.php
392
     *
393
     * @return array|bool|float|int|stdClass|null
394
     *
395
     * @throws HTTPException When the body is invalid as JSON.
396
     */
397
    public function getJSON(bool $assoc = false, int $depth = 512, int $options = 0)
398
    {
399
        if ($this->body === null) {
29✔
400
            return null;
4✔
401
        }
402

403
        $result = json_decode($this->body, $assoc, $depth, $options);
25✔
404

405
        if (json_last_error() !== JSON_ERROR_NONE) {
24✔
406
            throw HTTPException::forInvalidJSON(json_last_error_msg());
4✔
407
        }
408

409
        return $result;
20✔
410
    }
411

412
    /**
413
     * Get a specific variable from a JSON input stream
414
     *
415
     * @param array|string|null $index  The variable that you want which can use dot syntax for getting specific values.
416
     * @param bool              $assoc  If true, return the result as an associative array.
417
     * @param int|null          $filter Filter Constant
418
     * @param array|int|null    $flags  Option
419
     *
420
     * @return array|bool|float|int|stdClass|string|null
421
     */
422
    public function getJsonVar($index = null, bool $assoc = false, ?int $filter = null, $flags = null)
423
    {
424
        helper('array');
6✔
425

426
        $data = $this->getJSON(true);
6✔
427
        if (! is_array($data)) {
6✔
428
            return null;
1✔
429
        }
430

431
        if (is_string($index)) {
5✔
432
            $data = dot_array_search($index, $data);
5✔
433
        } elseif (is_array($index)) {
2✔
434
            $result = [];
2✔
435

436
            foreach ($index as $key) {
2✔
437
                $result[$key] = dot_array_search($key, $data);
2✔
438
            }
439

440
            [$data, $result] = [$result, null];
2✔
441
        }
442

443
        if ($data === null) {
5✔
444
            return null;
2✔
445
        }
446

447
        $filter ??= FILTER_UNSAFE_RAW;
5✔
448
        $flags = is_array($flags) ? $flags : (is_numeric($flags) ? (int) $flags : 0);
5✔
449

450
        if ($filter !== FILTER_UNSAFE_RAW
5✔
451
            || (
452
                (is_numeric($flags) && $flags !== 0)
5✔
453
                || is_array($flags) && $flags !== []
5✔
454
            )
455
        ) {
456
            if (is_array($data)) {
2✔
457
                // Iterate over array and append filter and flags
458
                array_walk_recursive($data, static function (&$val) use ($filter, $flags): void {
1✔
459
                    $valType = gettype($val);
1✔
460
                    $val     = filter_var($val, $filter, $flags);
1✔
461

462
                    if (in_array($valType, ['int', 'integer', 'float', 'double', 'bool', 'boolean'], true) && $val !== false) {
1✔
463
                        settype($val, $valType);
1✔
464
                    }
465
                });
1✔
466
            } else {
467
                $dataType = gettype($data);
1✔
468
                $data     = filter_var($data, $filter, $flags);
1✔
469

470
                if (in_array($dataType, ['int', 'integer', 'float', 'double', 'bool', 'boolean'], true) && $data !== false) {
1✔
471
                    settype($data, $dataType);
×
472
                }
473
            }
474
        }
475

476
        if (! $assoc) {
5✔
477
            if (is_array($index)) {
4✔
478
                foreach ($data as &$val) {
2✔
479
                    $val = is_array($val) ? json_decode(json_encode($val)) : $val;
2✔
480
                }
481

482
                return $data;
2✔
483
            }
484

485
            return json_decode(json_encode($data));
3✔
486
        }
487

488
        return $data;
2✔
489
    }
490

491
    /**
492
     * A convenience method that grabs the raw input stream(send method in PUT, PATCH, DELETE) and decodes
493
     * the String into an array.
494
     *
495
     * @return array
496
     */
497
    public function getRawInput()
498
    {
499
        parse_str($this->body ?? '', $output);
14✔
500

501
        return $output;
14✔
502
    }
503

504
    /**
505
     * Gets a specific variable from raw input stream (send method in PUT, PATCH, DELETE).
506
     *
507
     * @param array|string|null $index  The variable that you want which can use dot syntax for getting specific values.
508
     * @param int|null          $filter Filter Constant
509
     * @param array|int|null    $flags  Option
510
     *
511
     * @return array|bool|float|int|object|string|null
512
     */
513
    public function getRawInputVar($index = null, ?int $filter = null, $flags = null)
514
    {
515
        helper('array');
10✔
516

517
        parse_str($this->body ?? '', $output);
10✔
518

519
        if (is_string($index)) {
10✔
520
            $output = dot_array_search($index, $output);
6✔
521
        } elseif (is_array($index)) {
4✔
522
            $data = [];
2✔
523

524
            foreach ($index as $key) {
2✔
525
                $data[$key] = dot_array_search($key, $output);
2✔
526
            }
527

528
            [$output, $data] = [$data, null];
2✔
529
        }
530

531
        $filter ??= FILTER_UNSAFE_RAW;
10✔
532
        $flags = is_array($flags) ? $flags : (is_numeric($flags) ? (int) $flags : 0);
10✔
533

534
        if (is_array($output)
10✔
535
            && (
536
                $filter !== FILTER_UNSAFE_RAW
10✔
537
                || (
10✔
538
                    (is_numeric($flags) && $flags !== 0)
10✔
539
                    || is_array($flags) && $flags !== []
10✔
540
                )
10✔
541
            )
542
        ) {
543
            // Iterate over array and append filter and flags
544
            array_walk_recursive($output, static function (&$val) use ($filter, $flags): void {
×
545
                $val = filter_var($val, $filter, $flags);
×
546
            });
×
547

548
            return $output;
×
549
        }
550

551
        if (is_string($output)) {
10✔
552
            return filter_var($output, $filter, $flags);
5✔
553
        }
554

555
        return $output;
5✔
556
    }
557

558
    /**
559
     * Fetch an item from GET data.
560
     *
561
     * @param array|string|null $index  Index for item to fetch from $_GET.
562
     * @param int|null          $filter A filter name to apply.
563
     * @param array|int|null    $flags
564
     *
565
     * @return array|bool|float|int|object|string|null
566
     */
567
    public function getGet($index = null, $filter = null, $flags = null)
568
    {
569
        return $this->fetchGlobal('get', $index, $filter, $flags);
70✔
570
    }
571

572
    /**
573
     * Returns a typed input data selector.
574
     */
575
    public function input(): RequestInput
576
    {
577
        return new RequestInput($this, service('inputdatafactory'));
8✔
578
    }
579

580
    /**
581
     * Fetch an item from POST.
582
     *
583
     * @param array|string|null $index  Index for item to fetch from $_POST.
584
     * @param int|null          $filter A filter name to apply
585
     * @param array|int|null    $flags
586
     *
587
     * @return array|bool|float|int|object|string|null
588
     */
589
    public function getPost($index = null, $filter = null, $flags = null)
590
    {
591
        return $this->fetchGlobal('post', $index, $filter, $flags);
123✔
592
    }
593

594
    /**
595
     * Fetch an item from POST data with fallback to GET.
596
     *
597
     * @param array|string|null $index  Index for item to fetch from $_POST or $_GET
598
     * @param int|null          $filter A filter name to apply
599
     * @param array|int|null    $flags
600
     *
601
     * @return array|bool|float|int|object|string|null
602
     */
603
    public function getPostGet($index = null, $filter = null, $flags = null)
604
    {
605
        if ($index === null) {
5✔
606
            return array_merge($this->getGet($index, $filter, $flags), $this->getPost($index, $filter, $flags));
3✔
607
        }
608

609
        // Use $_POST directly here, since filter_has_var only
610
        // checks the initial POST data, not anything that might
611
        // have been added since.
612
        return service('superglobals')->post($index) !== null
2✔
613
            ? $this->getPost($index, $filter, $flags)
1✔
614
            : (service('superglobals')->get($index) !== null ? $this->getGet($index, $filter, $flags) : $this->getPost($index, $filter, $flags));
2✔
615
    }
616

617
    /**
618
     * Fetch an item from GET data with fallback to POST.
619
     *
620
     * @param array|string|null $index  Index for item to be fetched from $_GET or $_POST
621
     * @param int|null          $filter A filter name to apply
622
     * @param array|int|null    $flags
623
     *
624
     * @return array|bool|float|int|object|string|null
625
     */
626
    public function getGetPost($index = null, $filter = null, $flags = null)
627
    {
628
        if ($index === null) {
5✔
629
            return array_merge($this->getPost($index, $filter, $flags), $this->getGet($index, $filter, $flags));
3✔
630
        }
631

632
        // Use $_GET directly here, since filter_has_var only
633
        // checks the initial GET data, not anything that might
634
        // have been added since.
635
        return service('superglobals')->get($index) !== null
2✔
636
            ? $this->getGet($index, $filter, $flags)
1✔
637
            : (service('superglobals')->post($index) !== null ? $this->getPost($index, $filter, $flags) : $this->getGet($index, $filter, $flags));
2✔
638
    }
639

640
    /**
641
     * Fetch an item from the COOKIE array.
642
     *
643
     * @param array|string|null $index  Index for item to be fetched from $_COOKIE
644
     * @param int|null          $filter A filter name to be applied
645
     * @param array|int|null    $flags
646
     *
647
     * @return array|bool|float|int|object|string|null
648
     */
649
    public function getCookie($index = null, $filter = null, $flags = null)
650
    {
651
        return $this->fetchGlobal('cookie', $index, $filter, $flags);
135✔
652
    }
653

654
    /**
655
     * Fetch the user agent string
656
     *
657
     * @return UserAgent
658
     */
659
    public function getUserAgent()
660
    {
661
        return $this->userAgent;
1✔
662
    }
663

664
    /**
665
     * Attempts to get old Input data that has been flashed to the session
666
     * with redirect_with_input(). It first checks for the data in the old
667
     * POST data, then the old GET data and finally check for dot arrays
668
     *
669
     * @return array|string|null
670
     */
671
    public function getOldInput(string $key)
672
    {
673
        // If the session hasn't been started, we're done.
674
        if (! isset($_SESSION)) {
20✔
675
            return null;
×
676
        }
677

678
        // Get previously saved in session
679
        $old = session('_ci_old_input');
20✔
680

681
        // If no data was previously saved, we're done.
682
        if ($old === null) {
20✔
683
            return null;
6✔
684
        }
685

686
        // Check for the value in the POST array first.
687
        if (isset($old['post'][$key])) {
16✔
688
            return $old['post'][$key];
13✔
689
        }
690

691
        // Next check in the GET array.
692
        if (isset($old['get'][$key])) {
8✔
693
            return $old['get'][$key];
3✔
694
        }
695

696
        helper('array');
6✔
697

698
        // Check for an array value in POST.
699
        if (isset($old['post'])) {
6✔
700
            $value = dot_array_search($key, $old['post']);
6✔
701
            if ($value !== null) {
6✔
702
                return $value;
1✔
703
            }
704
        }
705

706
        // Check for an array value in GET.
707
        if (isset($old['get'])) {
6✔
708
            $value = dot_array_search($key, $old['get']);
3✔
709
            if ($value !== null) {
3✔
710
                return $value;
1✔
711
            }
712
        }
713

714
        // requested session key not found
715
        return null;
5✔
716
    }
717

718
    /**
719
     * Returns an array of all files that have been uploaded with this
720
     * request. Each file is represented by an UploadedFile instance.
721
     */
722
    public function getFiles(): array
723
    {
724
        if ($this->files === null) {
1✔
725
            $this->files = new FileCollection();
1✔
726
        }
727

728
        return $this->files->all(); // return all files
1✔
729
    }
730

731
    /**
732
     * Verify if a file exist, by the name of the input field used to upload it, in the collection
733
     * of uploaded files and if is have been uploaded with multiple option.
734
     *
735
     * @return array|null
736
     */
737
    public function getFileMultiple(string $fileID)
738
    {
739
        if ($this->files === null) {
61✔
740
            $this->files = new FileCollection();
61✔
741
        }
742

743
        return $this->files->getFileMultiple($fileID);
61✔
744
    }
745

746
    /**
747
     * Retrieves a single file by the name of the input field used
748
     * to upload it.
749
     *
750
     * @return UploadedFile|null
751
     */
752
    public function getFile(string $fileID)
753
    {
754
        if ($this->files === null) {
57✔
755
            $this->files = new FileCollection();
1✔
756
        }
757

758
        return $this->files->getFile($fileID);
57✔
759
    }
760
}
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