-
-
Notifications
You must be signed in to change notification settings - Fork 171
/
Copy pathScopes.cfc
39 lines (35 loc) · 913 Bytes
/
Scopes.cfc
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
/**
* Copyright Since 2005 ColdBox Framework by Luis Majano and Ortus Solutions, Corp
* www.ortussolutions.com
* ---
* A scope enum CFC that gives you the scopes that WireBox uses by default
**/
component {
// DECLARED SCOPES
this.NOSCOPE = "NoScope";
this.PROTOTYPE = "NoScope";
this.SINGLETON = "singleton";
this.SESSION = "session";
this.APPLICATION = "application";
this.REQUEST = "request";
this.SERVER = "server";
this.CACHEBOX = "cachebox";
/**
* Verify if an incoming scope is valid
*
* @scope The scope to check
*/
boolean function isValidScope( required scope ){
return structKeyArray( this ).findNoCase( arguments.scope ) ? true : false;
}
/**
* Get all valid scopes as an array
*/
array function getValidScopes(){
return this
.filter( function( key, value ){
return isSimpleValue( arguments.value );
} )
.keyArray();
}
}