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

ICanBoogie / bind-activerecord / 6132082268

09 Sep 2023 04:44PM UTC coverage: 33.929% (+1.2%) from 32.759%
6132082268

push

github

olvlvl
ActiveRecode update

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

38 of 112 relevant lines covered (33.93%)

0.37 hits per line

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

0.0
/lib/ConfigBuilder.php
1
<?php
2

3
/*
4
 * This file is part of the ICanBoogie package.
5
 *
6
 * (c) Olivier Laviale <olivier.laviale@gmail.com>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11

12
namespace ICanBoogie\Binding\ActiveRecord;
13

14
use Closure;
15
use ICanBoogie\ActiveRecord;
16
use ICanBoogie\ActiveRecord\Config;
17
use ICanBoogie\ActiveRecord\Config\ConnectionDefinition;
18
use ICanBoogie\ActiveRecord\Model;
19
use ICanBoogie\ActiveRecord\SchemaBuilder;
20
use ICanBoogie\Config\Builder;
21

22
/**
23
 * @implements Builder<Config>
24
 */
25
final class ConfigBuilder implements Builder
26
{
27
    public static function get_fragment_filename(): string
28
    {
29
        return 'activerecord';
×
30
    }
31

32
    private readonly ActiveRecord\ConfigBuilder $inner;
33

34
    public function __construct()
35
    {
36
        $this->inner = new ActiveRecord\ConfigBuilder();
×
37
    }
38

39
    public function build(): Config
40
    {
41
        return $this->inner->build();
×
42
    }
43

44
    /**
45
     * @return $this
46
     */
47
    public function add_connection(
48
        string $id,
49
        string $dsn,
50
        string|null $username = null,
51
        string|null $password = null,
52
        string|null $table_name_prefix = null,
53
        string $charset_and_collate = ConnectionDefinition::DEFAULT_CHARSET_AND_COLLATE,
54
        string $time_zone = ConnectionDefinition::DEFAULT_TIMEZONE,
55
    ): self {
56
        $this->inner->add_connection(
×
57
            id: $id,
×
58
            dsn: $dsn,
×
59
            username: $username,
×
60
            password: $password,
×
61
            table_name_prefix: $table_name_prefix,
×
62
            charset_and_collate: $charset_and_collate,
×
63
            time_zone: $time_zone
×
64
        );
×
65

66
        return $this;
×
67
    }
68

69
    /**
70
     * @param class-string<Model> $model_class
71
     * @param (Closure(SchemaBuilder $schema): SchemaBuilder)|null $schema_builder
72
     */
73
    public function add_model(
74
        string $model_class,
75
        string|null $table_name = null,
76
        string|null $alias = null,
77
        Closure $schema_builder = null,
78
        Closure $association_builder = null,
79
        string $connection = Config::DEFAULT_CONNECTION_ID,
80
    ): self {
81
        $this->inner->add_model(
×
82
            model_class: $model_class,
×
83
            table_name: $table_name,
×
84
            alias: $alias,
×
85
            schema_builder: $schema_builder,
×
86
            association_builder: $association_builder,
×
87
            connection: $connection,
×
88
        );
×
89

90
        return $this;
×
91
    }
92

93
    /**
94
     * @return $this
95
     */
96
    public function use_attributes(): self
97
    {
98
        $this->inner->use_attributes();
×
99

100
        return $this;
×
101
    }
102
}
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