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

daycry / auth / 21003933517

14 Jan 2026 05:39PM UTC coverage: 66.786% (+0.2%) from 66.555%
21003933517

push

github

web-flow
Merge pull request #28 from daycry/development

Add OAuth 2.0 support and improve authentication extensibility

201 of 278 new or added lines in 24 files covered. (72.3%)

7 existing lines in 4 files now uncovered.

2246 of 3363 relevant lines covered (66.79%)

33.3 hits per line

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

0.0
/src/Traits/Validation.php
1
<?php
2

3
declare(strict_types=1);
4

5
/**
6
 * This file is part of Daycry Auth.
7
 *
8
 * (c) Daycry <daycry9@proton.me>
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 Daycry\Auth\Traits;
15

16
use CodeIgniter\Validation\ValidationInterface;
17
use Config\Services;
18
use Config\Validation as ValidationConfig;
19
use Daycry\Auth\Exceptions\ValidationException;
20

21
trait Validation
22
{
23
    /**
24
     * Once validation has been run, will hold the Validation instance.
25
     *
26
     * @var ValidationInterface|null
27
     */
28
    protected $validator;
29

30
    protected function dataValidation(array|string $rules, array|object $data, ?ValidationConfig $config = null, bool $getShared = true, ?string $dbGroup = null): array
31
    {
32
        $config ??= config('Validation');
×
33

34
        $this->validator = Services::validation($config, $getShared);
×
35

36
        return $this->runValidate($rules, $data, $dbGroup);
×
37
    }
38

39
    protected function requestValidation(array|string $rules, ?ValidationConfig $config = null, bool $getShared = true, ?string $dbGroup = null): array
40
    {
41
        $config ??= config('Validation');
×
42

43
        $this->validator = Services::validation($config, $getShared)->withRequest(Services::request());
×
44

45
        return $this->runValidate($rules, null, $dbGroup);
×
46
    }
47

48
    private function runValidate(array|string $rules, array|object|null $data = null, ?string $dbGroup = null)
49
    {
NEW
50
        if ($data !== null && is_object($data)) {
×
NEW
51
            $data = get_object_vars($data);
×
52
        }
53

54
        if (is_string($rules)) {
×
55
            $this->validator->setRuleGroup($rules);
×
56
        } else {
57
            $this->validator->setRules($rules);
×
58
        }
59

60
        if (! $this->validator->run($data, null, $dbGroup)) {
×
61
            throw ValidationException::validationData();
×
62
        }
63

64
        return $this->validator->getValidated();
×
65
    }
66
}
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