aboutsummaryrefslogtreecommitdiff
path: root/private/model/creds.php
blob: 8ec06ad036410570bef223e1f46521d9b4883cae (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<?php

declare(strict_types = On);

/**
 * Holds the credentials for connecting to the database
 */
class Cred
{
    /** @var string $host The destination host that holds the database. */
    private $host;
    /** @var string $port The destination port for the database on the host. */
    private $port;
    /** @var string $dbname The name of the database of which to connect. */
    private $dbname;
    /** @var string $login The username for accessing the database.
     *
     * It is recommended to change the login to a more restrictive account once
     * the tables have been created (e.g. an account that can only insert,
     * select, and update on that specific database).
     */
    private $login;
    /** @var string $password The password to the account for access.  */
    private $password;

    /**
     * Sets the values of the credentials.
     *
     * @return Cred
     */
    public function __construct ()
    {
        $host     = 'localhost';
        $port     = '5432';
        $dbname   = 'ao';
        $login    = 'r_access';
        $password = 'secret';
    }

    /**
     * Destructor ensures clean wipe of credentials from existing.
     *
     * @return void
     */
    public function __destruct ()
    {
        $host     = '';
        $port     = '';
        $dbname   = '';
        $login    = '';
        $password = '';
    }

    /**
     * Returns the value of the host of the database.
     *
     * @return string $host
     */
    public function getHost ()
    {
        return $host;
    }
    /**
     * Returns the value of the port of the host of which to connect.
     *
     * @return string $port
     */
    public function getPort ()
    {
        return $port;
    }
    /**
     * Returns the value of the name of the database of which to connect.
     *
     * @return string $dbname
     */
    public function getDBName () 
    {
        return $dbname;
    }
    /**
     * Returns the value of the username of the account of the database.
     *
     * @return string $login
     */
    public function getLogin () 
    {
        return $login;
    }
    /**
     * Returns the value of the password of the account of the database.
     *
     * @return string password
     */
    public function getPassword ()
    {
        return $password;
    }
}

// destroy as quickly as possible
$cred = new Cred();