本文整理汇总了PHP中Parameter::setValue方法的典型用法代码示例。如果您正苦于以下问题:PHP Parameter::setValue方法的具体用法?PHP Parameter::setValue怎么用?PHP Parameter::setValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Parameter
的用法示例。
在下文中一共展示了Parameter::setValue方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testModify
function testModify()
{
$cal = new Component\VCalendar();
$param = new Parameter($cal, 'name', null);
$param->addValue(1);
$this->assertEquals(array(1), $param->getParts());
$param->setParts(array(1, 2));
$this->assertEquals(array(1, 2), $param->getParts());
$param->addValue(3);
$this->assertEquals(array(1, 2, 3), $param->getParts());
$param->setValue(4);
$param->addValue(5);
$this->assertEquals(array(4, 5), $param->getParts());
}
示例2: manipulate
/**
* @see ParameterManipulation::manipulate
*
* @since 0.7
*/
public function manipulate(Parameter &$parameter, array &$parameters)
{
global $egMapsOLLayerGroups, $egMapsOLAvailableLayers;
$layerDefs = array();
$layerNames = array();
foreach ($parameter->getValue() as $layerOrGroup) {
$lcLayerOrGroup = strtolower($layerOrGroup);
// Layer groups. Loop over all items and add them when not present yet.
if (array_key_exists($lcLayerOrGroup, $egMapsOLLayerGroups)) {
foreach ($egMapsOLLayerGroups[$lcLayerOrGroup] as $layerName) {
if (!in_array($layerName, $layerNames)) {
if (is_array($egMapsOLAvailableLayers[$layerName])) {
$layerDefs[] = 'new ' . $egMapsOLAvailableLayers[$layerName][0];
} else {
$layerDefs[] = 'new ' . $egMapsOLAvailableLayers[$layerName];
}
$layerNames[] = $layerName;
}
}
} elseif (array_key_exists($lcLayerOrGroup, $egMapsOLAvailableLayers)) {
if (!in_array($lcLayerOrGroup, $layerNames)) {
if (is_array($egMapsOLAvailableLayers[$lcLayerOrGroup])) {
$layerDefs[] = 'new ' . $egMapsOLAvailableLayers[$lcLayerOrGroup][0];
} else {
$layerDefs[] = 'new ' . $egMapsOLAvailableLayers[$lcLayerOrGroup];
}
$layerNames[] = $lcLayerOrGroup;
}
} else {
$title = Title::newFromText($layerOrGroup, Maps_NS_LAYER);
if ($title->getNamespace() == Maps_NS_LAYER && $title->exists()) {
$layerPage = new MapsLayerPage($title);
if ($layerPage->hasValidDefinition('openlayers')) {
$layer = $layerPage->getLayer();
if (!in_array($layerOrGroup, $layerNames)) {
$layerDefs[] = $layer->getJavaScriptDefinition();
$layerNames[] = $layerOrGroup;
}
} else {
wfWarn("Invalid layer ({$layerOrGroup}) encountered after validation.");
}
} else {
wfWarn("Invalid layer ({$layerOrGroup}) encountered after validation.");
}
}
}
$parameter->setValue($layerDefs);
MapsMappingServices::getServiceInstance('openlayers')->addLayerDependencies($this->getDependencies($layerNames));
}
示例3: manipulate
/**
* @see ParameterManipulation::manipulate
*
* @since 0.4
*/
public function manipulate(Parameter &$parameter, array &$parameters)
{
$parameter->setValue($this->wrapper . implode($this->wrapper . $this->delimiter . $this->wrapper, $parameter->getValue()) . $this->wrapper);
}
示例4: testSetAndGetValue
/**
* @covers phpDocumentor\Transformer\Template\Parameter::getValue
* @covers phpDocumentor\Transformer\Template\Parameter::setValue
*/
public function testSetAndGetValue()
{
$this->assertSame(null, $this->fixture->getValue());
$this->fixture->setValue('value');
$this->assertSame('value', $this->fixture->getValue());
}
示例5: filterInitializationAlsoRespectsCaseInsensitivity
/**
*
* @test
*/
public function filterInitializationAlsoRespectsCaseInsensitivity()
{
$parameters = array();
$param = new Parameter();
$param->setName('typo3version');
$param->setValue('1.2.3');
array_push($parameters, $param);
$this->filter->setParameters($parameters);
$output = $this->filter->read();
$this->assertContains('HTTP.userAgent=TYPO3/1.2.3', $output);
}
示例6: manipulate
/**
* @see ParameterManipulation::manipulate
*
* @since 0.7
*/
public function manipulate(Parameter &$parameter, array &$parameters)
{
global $egMapsOLLayerGroups, $egMapsOLAvailableLayers;
$layerDefs = array();
$usedLayers = array();
foreach ($parameter->getValue() as $layerOrGroup) {
$lcLayerOrGroup = strtolower($layerOrGroup);
// Layer groups. Loop over all items and add them if not present yet.
if (array_key_exists($lcLayerOrGroup, $egMapsOLLayerGroups)) {
foreach ($egMapsOLLayerGroups[$lcLayerOrGroup] as $layerName) {
if (!in_array($layerName, $usedLayers)) {
if (is_array($egMapsOLAvailableLayers[$layerName])) {
$layerDefs[] = 'new ' . $egMapsOLAvailableLayers[$layerName][0];
} else {
$layerDefs[] = 'new ' . $egMapsOLAvailableLayers[$layerName];
}
$usedLayers[] = $layerName;
}
}
} elseif (array_key_exists($lcLayerOrGroup, $egMapsOLAvailableLayers)) {
if (!in_array($lcLayerOrGroup, $usedLayers)) {
if (is_array($egMapsOLAvailableLayers[$lcLayerOrGroup])) {
$layerDefs[] = 'new ' . $egMapsOLAvailableLayers[$lcLayerOrGroup][0];
} else {
$layerDefs[] = 'new ' . $egMapsOLAvailableLayers[$lcLayerOrGroup];
}
$usedLayers[] = $lcLayerOrGroup;
}
} else {
$layerParts = explode($this->groupNameSep, $layerOrGroup, 2);
$layerGroup = $layerParts[0];
$layerName = count($layerParts) > 1 ? $layerParts[1] : null;
$title = Title::newFromText($layerGroup, Maps_NS_LAYER);
if ($title !== null && $title->getNamespace() == Maps_NS_LAYER) {
/**
* TODO/FIXME: This shouldn't be here and using $wgParser, instead it should
* be somewhere around MapsBaseMap::renderMap. But since we do a lot more than
* 'parameter manipulation' in here, we already diminish the information needed
* for this which will never arrive there. Perhaps the whole
* MapsLayer::getJavaScriptDefinition() shouldn't be done here.
*/
global $wgParser;
// add dependency to the layer page so if the layer definition gets updated,
// the page where it is used will be updated as well:
$rev = Revision::newFromTitle($title);
$wgParser->getOutput()->addTemplate($title, $title->getArticleID(), $rev->getId());
// if the whole layer group is not yet loaded into the map and the group exists:
if (!in_array($layerGroup, $usedLayers) && $title->exists()) {
$layerPage = new MapsLayerPage($title);
if ($layerName !== null) {
// load specific layer with name:
$layer = MapsLayers::loadLayer($title, $layerName);
$layers = new MapsLayerGroup($layer);
$usedLayer = $layerOrGroup;
} else {
// load all layers from group:
$layers = MapsLayers::loadLayerGroup($title);
$usedLayer = $layerGroup;
}
foreach ($layers->getLayers() as $layer) {
if (($layer->getName() === null || !in_array($layerGroup . $this->groupNameSep . $layer->getName(), $usedLayers)) && $layer->isOk()) {
$layerDefs[] = $layer->getJavaScriptDefinition();
}
}
$usedLayers[] = $usedLayer;
// have to add this after loop of course!
}
} else {
wfWarn("Invalid layer ({$layerOrGroup}) encountered after validation.");
}
}
}
$parameter->setValue($layerDefs);
MapsMappingServices::getServiceInstance('openlayers')->addLayerDependencies($this->getDependencies($usedLayers));
}