Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F951106
SlowvotePollVotingMethod.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
SlowvotePollVotingMethod.php
View Options
<?php
final
class
SlowvotePollVotingMethod
extends
Phobject
{
const
METHOD_PLURALITY
=
'plurality'
;
const
METHOD_APPROVAL
=
'approval'
;
private
$key
;
public
static
function
newVotingMethodObject
(
$key
)
{
$object
=
new
self
();
$object
->
key
=
$key
;
return
$object
;
}
public
function
getKey
()
{
return
$this
->
key
;
}
public
static
function
getAll
()
{
$map
=
self
::
getMap
();
$result
=
array
();
foreach
(
$map
as
$key
=>
$spec
)
{
$result
[
$key
]
=
self
::
newVotingMethodObject
(
$key
);
}
return
$result
;
}
public
function
getName
()
{
$name
=
$this
->
getProperty
(
'name'
);
if
(
$name
===
null
)
{
$name
=
pht
(
'Unknown ("%s")'
,
$this
->
getKey
());
}
return
$name
;
}
public
function
getNameForEdit
()
{
$name
=
$this
->
getProperty
(
'name.edit'
);
if
(
$name
===
null
)
{
$name
=
pht
(
'Unknown ("%s")'
,
$this
->
getKey
());
}
return
$name
;
}
private
function
getProperty
(
$key
,
$default
=
null
)
{
$spec
=
idx
(
self
::
getMap
(),
$this
->
getKey
(),
array
());
return
idx
(
$spec
,
$key
,
$default
);
}
private
static
function
getMap
()
{
return
array
(
self
::
METHOD_PLURALITY
=>
array
(
'name'
=>
pht
(
'Plurality'
),
'name.edit'
=>
pht
(
'Plurality (Single Choice)'
),
),
self
::
METHOD_APPROVAL
=>
array
(
'name'
=>
pht
(
'Approval'
),
'name.edit'
=>
pht
(
'Approval (Multiple Choice)'
),
),
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, Jun 17, 2:39 PM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
224639
Default Alt Text
SlowvotePollVotingMethod.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment