Test Failed
Push — master ( 0071b0...4282d1 )
by Stefan
05:33
created

DeploymentClassic::getFreshness()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 0
1
<?php
2
3
/*
4
 * *****************************************************************************
5
 * Contributions to this work were made on behalf of the GÉANT project, a 
6
 * project that has received funding from the European Union’s Framework 
7
 * Programme 7 under Grant Agreements No. 238875 (GN3) and No. 605243 (GN3plus),
8
 * Horizon 2020 research and innovation programme under Grant Agreements No. 
9
 * 691567 (GN4-1) and No. 731122 (GN4-2).
10
 * On behalf of the aforementioned projects, GEANT Association is the sole owner
11
 * of the copyright in all material which was developed by a member of the GÉANT
12
 * project. GÉANT Vereniging (Association) is registered with the Chamber of 
13
 * Commerce in Amsterdam with registration number 40535155 and operates in the 
14
 * UK as a branch of GÉANT Vereniging.
15
 * 
16
 * Registered office: Hoekenrode 3, 1102BR Amsterdam, The Netherlands. 
17
 * UK branch address: City House, 126-130 Hills Road, Cambridge CB2 1PQ, UK
18
 *
19
 * License: see the web/copyright.inc.php file in the file structure or
20
 *          <base_url>/copyright.php after deploying the software
21
 */
22
23
/**
24
 * This file contains the AbstractProfile class. It contains common methods for
25
 * both RADIUS/EAP profiles and SilverBullet profiles
26
 *
27
 * @author Stefan Winter <[email protected]>
28
 * @author Tomasz Wolniewicz <[email protected]>
29
 *
30
 * @package Developer
31
 *
32
 */
33
34
namespace core;
35
36
use \Exception;
37
38
/**
39
 * This class represents an EAP Profile.
40
 * Profiles can inherit attributes from their IdP, if the IdP has some. Otherwise,
41
 * one can set attribute in the Profile directly. If there is a conflict between
42
 * IdP-wide and Profile-wide attributes, the more specific ones (i.e. Profile) win.
43
 * 
44
 * @author Stefan Winter <[email protected]>
45
 * @author Tomasz Wolniewicz <[email protected]>
46
 *
47
 * @license see LICENSE file in root directory
48
 *
49
 * @package Developer
50
 */
51
class DeploymentClassic extends AbstractDeployment {
52
53
    /**
54
     * Class constructor for existing deployments (use 
55
     * IdP::newDeployment() to actually create one). Retrieves all 
56
     * attributes from the DB and stores them in the priv_ arrays.
57
     * 
58
     * @param IdP        $idpObject       optionally, the institution to which this Profile belongs. Saves the construction of the IdP instance. If omitted, an extra query and instantiation is executed to find out.
59
     * @param string|int $deploymentIdRaw identifier of the deployment in the DB, or 
60
     */
61
    public function __construct($idpObject, $deploymentIdRaw = NULL) {
62
        parent::__construct($idpObject, $deploymentIdRaw); // we now have access to our INST database handle and logging
63
        $this->type = AbstractDeployment::DEPLOYMENTTYPE_MANAGED;
64
        // we need to extract the SP's relevant information from the eduroam DB
65
        // TODO
0 ignored issues
show
Coding Style introduced by
Comment refers to a TODO task

This check looks TODO comments that have been left in the code.

``TODO``s show that something is left unfinished and should be attended to.

Loading history...
66
        $propertyQuery = "SELECT ... FROM ... WHERE ...";
67
        $queryExec = $this->databaseHandle->exec($propertyQuery);
68
        while ($iterator = mysqli_fetch_object(/** @scrutinizer ignore-type */ $queryExec)) {
69
            $this->status = $iterator->status;
70
        }
71
    }
72
73
    /**
74
     * update the last_changed timestamp for this deployment
75
     * 
76
     * @return void
77
     */
78
    public function updateFreshness() {
79
        // we are always fresh - data comes from eduroam DB
80
    }
81
82
    /**
83
     * gets the last-modified timestamp (useful for caching "dirty" check)
84
     * 
85
     * @return string the date in string form, as returned by SQL
86
     */
87
    public function getFreshness() {
88
        // we are always fresh - data comes from eduroam DB
89
        $execLastChange = $this->databaseHandle->exec("SELECT NOW() as last_change");
90
        // SELECT always returns a resource, never a boolean
91
        if ($freshnessQuery = mysqli_fetch_object(/** @scrutinizer ignore-type */ $execLastChange)) {
92
            return $freshnessQuery->last_change;
93
        }
94
    }
95
96
    /**
97
     * Deletes the deployment from database
98
     * 
99
     * @return void
100
     */
101
    public function destroy() {
102
        // we can't delete data from the eduroam DB
103
    }
104
105
    /**
106
     * activates a deployment, but that is not how classic works
107
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
108
    public function activate() {
109
        // nothing to be done, this is managed externally
110
    }
111
    
112
    /**
113
     * deactivates a deployment, but that is not how classic works
114
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
115
    public function deactivate() {
116
        // nothing to be done, this is managed externally
117
    }
118
}
119