當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。