Config.php 1.66 KB
Newer Older
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
<?php
/**
 * Created by PhpStorm.
 * @author: crose
 * Date: 3/10/15
 * Time: 9:48 AM
 *
 * $Id: efb1ee01c8487b213d49f2576b914cc0ec0dbc66 $
 */

namespace qfq;

/**
 * Abstract class for retrieval of configuration options.
 *
 * @package qfq
 */
abstract class Config {

    /**
     * Get the PHP Session name
     *
     * @return string PHP Session name
     */
    abstract public function getSessionName();

    /**
     * Get the database user name
     *
     * @return string database user name
     */
    abstract public function getDatabaseUserName();

    /**
     * Get the database user password
     *
     * @return string database user password
     */
    abstract public function getDatabaseUserPassword();

    /**
     * Get the MySQL DSN string.
     *
     * @return string MySQL DSN string.
     */
    public function getMysqlDSNString() {
        return 'mysql:host=' . $this->getDatabaseHost() . ';dbname=' . $this->getDatabaseName();
    }

    /**
     * Get the database server host name
     *
     * @return string host name of the database server
     */
    abstract public function getDatabaseHost();

    /**
     * Get the database name
     *
     * @return string database name
     */
    abstract public function getDatabaseName();

    /**
     * Get the MySQL DSN string for the test database
     *
     * @return string MySQL DSN string.
     */
    public function getMysqlDSNStringTestDB() {
        return 'mysql:host=' . $this->getDatabaseHost() . ';dbname=' . $this->getTestDatabaseName();
    }

    /**
     * Get the test database name
     *
     * @return string test database name
     */
    abstract public function getTestDatabaseName();
}