Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F438617
HeraldRepetitionPolicyConfig.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
HeraldRepetitionPolicyConfig.php
View Options
<?php
/*
* Copyright 2011 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
class
HeraldRepetitionPolicyConfig
{
const
FIRST
=
'first'
;
// only execute the first time (no repeating)
const
EVERY
=
'every'
;
// repeat every time
private
static
$policyIntMap
=
array
(
self
::
FIRST
=>
0
,
self
::
EVERY
=>
1
,
);
private
static
$policyMap
=
array
(
self
::
FIRST
=>
'only the first time'
,
self
::
EVERY
=>
'every time'
,
);
public
static
function
getMap
()
{
return
self
::
$policyMap
;
}
public
static
function
getMapForContentType
(
$type
)
{
switch
(
$type
)
{
case
HeraldContentTypeConfig
::
CONTENT_TYPE_DIFFERENTIAL
:
return
array_select_keys
(
self
::
$policyMap
,
array
(
self
::
EVERY
,
self
::
FIRST
,
));
case
HeraldContentTypeConfig
::
CONTENT_TYPE_COMMIT
:
case
HeraldContentTypeConfig
::
CONTENT_TYPE_MERGE
:
case
HeraldContentTypeConfig
::
CONTENT_TYPE_OWNERS
:
return
array
();
default
:
throw
new
Exception
(
"Unknown content type '{$type}'."
);
}
}
public
static
function
toInt
(
$str
)
{
return
idx
(
self
::
$policyIntMap
,
$str
,
self
::
$policyIntMap
[
self
::
EVERY
]);
}
public
static
function
toString
(
$int
)
{
return
idx
(
array_flip
(
self
::
$policyIntMap
),
$int
,
self
::
EVERY
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, May 4, 2:43 AM (1 d, 10 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
63265
Default Alt Text
HeraldRepetitionPolicyConfig.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment