当前位置: 首页>>代码示例>>PHP>>正文


PHP Parameter类代码示例

本文整理汇总了PHP中Parameter的典型用法代码示例。如果您正苦于以下问题:PHP Parameter类的具体用法?PHP Parameter怎么用?PHP Parameter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Parameter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: generate

 /**
  * Generates the actual interfaces
  */
 public function generate()
 {
     $interfacesData = json_decode($this->json, true);
     foreach ($interfacesData as $interface) {
         $filename = $interface['name'] . '.java';
         $interfaceObject = new JAVAInterfaceObject();
         $interfaceObject->setName($interface['name']);
         foreach ($interface['methods'] as $method) {
             $methodObject = new JAVAMethod();
             $methodObject->setName($method['name']);
             $methodObject->setReturnValue($method['returnType']);
             $methodObject->setScope($method['scope']);
             $methodObject->setComment($method['comment']);
             foreach ($method['parameters'] as $parameter) {
                 $parameterObject = new Parameter();
                 $parameterObject->setName($parameter['name']);
                 $parameterObject->setType($parameter['type']);
                 $methodObject->addParameter($parameterObject);
             }
             foreach ($method['annotations'] as $annotation) {
                 $annotationObject = new Annotation();
                 $annotationObject->setName($annotation['name']);
                 $annotationObject->setValue($annotation['value']);
                 $annotationObject->setInterpreter('@');
                 $methodObject->addAnnotation($annotationObject);
             }
             $interfaceObject->addMethod($methodObject);
         }
         file_put_contents($this->folder . DIRECTORY_SEPARATOR . $filename, $interfaceObject->toString());
     }
 }
开发者ID:herrwalter,项目名称:InterfaceGenerator,代码行数:34,代码来源:JAVAGenerator.php

示例2: addParameter

 /**
  * @param \hergot\databroker\DataAdapter\Parameter $parameter
  * @throws \InvalidArgumentException
  */
 public function addParameter(Parameter $parameter)
 {
     if (isset($this->parameters[$parameter->getName()])) {
         throw new \InvalidArgumentException('Parameter with name "' . $parameter->getName() . '" already defined');
     }
     $this->parameters[$parameter->getName()] = $parameter;
 }
开发者ID:hergot,项目名称:databroker,代码行数:11,代码来源:ParameterCollection.php

示例3: doManipulation

 /**
  * @see ItemParameterManipulation::doManipulation
  * 
  * @since 0.7.5
  */
 public function doManipulation(&$value, Parameter $parameter, array &$parameters)
 {
     global $egMapsDefaultGeoService;
     static $validatedDefault = false;
     if (!MapsGeocoders::canGeocode()) {
         throw new MWException('There are no geocoders registered, so no geocoding can happen.');
     }
     // Get rid of any aliases.
     $value = $this->getMainIndentifier($value);
     // Override the defaulting.
     if ($parameter->wasSetToDefault() && is_string($this->mappingServiceParam) && array_key_exists($this->mappingServiceParam, $parameters)) {
         $value = self::resolveOverrides($value, $parameters[$this->mappingServiceParam]->getValue());
     }
     if ($value === '' || !array_key_exists($value, MapsGeocoders::$registeredGeocoders)) {
         if (!$validatedDefault) {
             if (!array_key_exists($egMapsDefaultGeoService, MapsGeocoders::$registeredGeocoders)) {
                 $geoServices = array_keys(MapsGeocoders::$registeredGeocoders);
                 $egMapsDefaultGeoService = array_shift($geoServices);
                 if (is_null($egMapsDefaultGeoService)) {
                     throw new MWException('Tried to geocode while there are no geocoders available at ' . __METHOD__);
                 }
             }
         }
         if (array_key_exists($egMapsDefaultGeoService, MapsGeocoders::$registeredGeocoders)) {
             $value = $egMapsDefaultGeoService;
         } else {
             throw new MWException('Attempt to use the default geocoder while it does not exist.');
         }
     }
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:35,代码来源:Maps_ParamGeoService.php

示例4: doManipulation

 /**
  * @see ItemParameterManipulation::doManipulation
  * 
  * @since 0.4
  */
 public function doManipulation(&$value, Parameter $parameter, array &$parameters)
 {
     // When the value defaulted to a boolean, there is no need for this manipulation.
     if (!is_bool($value) || !$parameter->wasSetToDefault()) {
         $value = in_array($value, array('yes', 'on'));
     }
 }
开发者ID:JeroenDeDauw,项目名称:phpapi,代码行数:12,代码来源:ParamManipulationBoolean.php

示例5: addParameter

 /**
  *
  * @param Parameter $parameter
  * @return void
  * @throws \InvalidArgumentException
  */
 private function addParameter(Parameter $parameter)
 {
     $name = $parameter->getDefinition()->getName();
     if (array_key_exists($name, $this->parameters)) {
         throw new \InvalidArgumentException("Parameter '{$name}' provided multiple times.");
     }
     $this->parameters[$name] = $parameter;
 }
开发者ID:jmfeurprier,项目名称:perf-task,代码行数:14,代码来源:ParameterCollection.php

示例6: addParameter

 public function addParameter(Parameter $parameter, $in = true)
 {
     if ($in) {
         $this->inputParameters[$parameter->getName()] = $parameter;
     } else {
         $this->outputParameters[$parameter->getName()] = $parameter;
     }
 }
开发者ID:projectstorm,项目名称:php-actions,代码行数:8,代码来源:Intent.php

示例7: testWithersReturnNewModifiedInstance

 public function testWithersReturnNewModifiedInstance()
 {
     $parameter = new Parameter('foo', 'bar');
     $newParam = $parameter->withValue('rab');
     $this->assertNotSame($newParam, $parameter);
     $this->assertEquals('bar', $parameter->getValue());
     $this->assertEquals('rab', $newParam->getValue());
 }
开发者ID:nelmio,项目名称:alice,代码行数:8,代码来源:ParameterTest.php

示例8: doManipulation

 /**
  * @see ItemParameterManipulation::doManipulation
  * 
  * @since 0.7
  */
 public function doManipulation(&$value, Parameter $parameter, array &$parameters)
 {
     // If there are multiple points and the value was not provided or incorrect (=defaulted),
     // set it to false, so the mapping service can figure out the optimal value.
     if ($parameter->wasSetToDefault() && count($parameters['coordinates']->getValue()) > 1) {
         $value = false;
     }
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:13,代码来源:Maps_ParamZoom.php

示例9: getItemErrorMessage

 /**
  * @see ItemParameterCriterion::getItemErrorMessage
  */
 protected function getItemErrorMessage(Parameter $parameter)
 {
     global $wgLang;
     if ($this->lowerBound == $this->upperBound) {
         return wfMsgExt('validator-error-invalid-length', 'parsemag', $parameter->getOriginalName(), $wgLang->formatNum($this->lowerBound));
     } else {
         return wfMsgExt('validator-error-invalid-length-range', 'parsemag', $parameter->getOriginalName(), $wgLang->formatNum($this->lowerBound), $wgLang->formatNum($this->upperBound));
     }
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:12,代码来源:CriterionHasLength.php

示例10: manipulate

 /**
  * Validate a parameter against the criterion.
  * 
  * @param Parameter $parameter
  * @param array $parameters
  * 
  * @since 0.4
  */
 public function manipulate(Parameter &$parameter, array &$parameters)
 {
     if (is_array($parameter->getValue())) {
         $value =& $parameter->getValue();
         foreach ($value as &$item) {
             $this->doManipulation($item, $parameter, $parameters);
         }
     } else {
         $this->doManipulation($parameter->getValue(), $parameter, $parameters);
     }
 }
开发者ID:JeroenDeDauw,项目名称:phpapi,代码行数:19,代码来源:ItemParameterManipulation.php

示例11: addParameter

 /**
  * Adds a parameter to the widget
  * 
  * @param Parameter $new_parameter
  * @return void
  */
 public function addParameter($new_parameter)
 {
     if (!$new_parameter instanceof Parameter) {
         throw new \MWException('Method addParameter() of widget ' . static::GetName() . ' requires an argument of type "Parameter".');
     }
     $new_parameter_name = $new_parameter->getName();
     if (array_key_exists($new_parameter_name, $this->parameters)) {
         throw new \MWException('Cannot add parameter "' . $new_parameter_name . '". Each parameter needs a disctinct name.');
     }
     $this->parameters[$new_parameter_name] = $new_parameter;
 }
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:17,代码来源:ParserFunction.php

示例12: defineParameter

 public function defineParameter($key, $type, $label, $default = null)
 {
     if (isset($this->parameter[$key])) {
         throw new \InvalidArgumentException('Parameter already define in bag: ' . $key);
     }
     $parameter = new Parameter();
     $parameter->setKey($key);
     $parameter->setType($type);
     $parameter->setLabel($label);
     $parameter->setDefault($default);
     $this->parameter[$key] = $parameter;
 }
开发者ID:tangler,项目名称:core,代码行数:12,代码来源:ParameterBag.php

示例13: testRequirementParameterSuccess

 public function testRequirementParameterSuccess()
 {
     $parameter = new Parameter();
     $parameter->name = "NEEDLE_LENGTH";
     $parameter->type = "float";
     $parameter->widget = null;
     $parameter->value = null;
     $parameter->priority = 2;
     $parameter->paramable_id = '-1';
     $parameter->paramable_type = '';
     $this->assertTrue($parameter->save());
 }
开发者ID:philtweir,项目名称:glossia-scratch-test-site,代码行数:12,代码来源:ParameterTest.php

示例14: manipulate

 /**
  * @see ParameterManipulation::manipulate
  * 
  * @since 1.0.1
  */
 public function manipulate(Parameter &$parameter, array &$parameters)
 {
     if (!in_array($parameters['type']->getValue(), $parameter->getValue())) {
         if ($parameters['type']->wasSetToDefault()) {
             if (count($parameter->getValue()) > 0) {
                 $types = $parameter->getValue();
                 $parameters['type']->setValue($types[0]);
             }
         } else {
             array_unshift($parameter->getValue(), $parameters['type']->getValue());
         }
     }
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:18,代码来源:Maps_ParamGMap3Types.php

示例15: setParameter

 private function setParameter(Parameter $param)
 {
     $set_param_head = 'SET_PARAM ' . $param->getKey();
     try {
         if ($param->isRawValue()) {
             $raw_value = self::BEGIN_RAW . "\n" . base64_encode($param->getValue()) . "\n" . self::END_RAW;
             return $this->socket_client->request($set_param_head . ' ' . self::RAW_VALUE_ANNOUNCMENT . "\n" . $raw_value);
         } else {
             return $this->socket_client->request($set_param_head . ' ' . $param->getValue());
         }
     } catch (\Exception $e) {
         throw $e;
     }
 }
开发者ID:laubosslink,项目名称:lab,代码行数:14,代码来源:runner.php


注:本文中的Parameter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。