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


PHP Parameter::getName方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: removeParameter

 public function removeParameter(Parameter $parameter)
 {
     if (array_key_exists($parameter->getName(), $this->parameters)) {
         unset($this->parameters[$parameter->getName()]);
     }
 }
开发者ID:herrwalter,项目名称:InterfaceGenerator,代码行数:6,代码来源:AMethod.php

示例5: addParameter

 private function addParameter(Parameter $parameter)
 {
     $validLocations = ['path', 'header', 'query', 'body'];
     if (!in_array($parameter->getLocation(), $validLocations)) {
         throw new \InvalidArgumentException($parameter->getLocation() . ' is not a valid parameter location');
     }
     $this->parameters[$parameter->getName()] = $parameter;
 }
开发者ID:eleven-labs,项目名称:api-validator,代码行数:8,代码来源:Parameters.php

示例6: getDescriptionRow

    /**
     * Returns the wikitext for a table row describing a single parameter.
     *
     * @since 1.0
     *
     * @param Parameter $parameter
     *
     * @return string
     */
    protected function getDescriptionRow(Parameter $parameter)
    {
        $description = $parameter->getMessage();
        if ($description === false) {
            $description = $parameter->getDescription();
            if ($description === false) {
                $description = '-';
            }
        } else {
            $description = $this->msg($description);
        }
        $type = $parameter->getTypeMessage();
        $default = $parameter->isRequired() ? "''" . $this->msg('validator-describe-required') . "''" : $parameter->getDefault();
        if (is_array($default)) {
            $default = implode(', ', $default);
        } elseif (is_bool($default)) {
            $default = $default ? 'yes' : 'no';
        }
        if ($default === '') {
            $default = "''" . $this->msg('validator-describe-empty') . "''";
        }
        return <<<EOT
| {$parameter->getName()}
| {$type}
| {$default}
| {$description}
EOT;
    }
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:37,代码来源:Maps_MapsDoc.php

示例7: parameterNameGetsRecognizedCorrectly

 /**
  * @test
  */
 public function parameterNameGetsRecognizedCorrectly()
 {
     $parameter = new Parameter(['value' => ['name' => 'myParam']]);
     self::assertSame('myParam', $parameter->getName());
 }
开发者ID:bitexpert,项目名称:disco,代码行数:8,代码来源:ParameterUnitTest.php

示例8: __construct

 /**
  * Constructor.
  * 
  * @since 0.4.6
  * 
  * @param Parameter $param
  * @param mixed $currentValue
  */
 public function __construct(Parameter $param, $currentValue = false)
 {
     $this->param = $param;
     $this->currentValue = $currentValue;
     $this->inputName = $param->getName();
 }
开发者ID:JeroenDeDauw,项目名称:phpapi,代码行数:14,代码来源:ParameterInput.php

示例9: validateValue

 /**
  * Run the value through the configured validator
  *
  * @param mixed $value
  * @param Parameter $definition
  * @access protected
  *
  * @throw Exception
  *
  * @return mixed
  */
 protected function validateValue($value, $definition)
 {
     try {
         return $definition->getValidator()->validate($value);
     } catch (\Exception $e) {
         throw new \Exception(sprintf('[%s] %s', $definition->getName(), $e->getMessage()));
     }
 }
开发者ID:aranw,项目名称:parameter-validator,代码行数:19,代码来源:Input.php

示例10: getDescriptionRow

    /**
     * Returns the wikitext for a table row describing a single parameter.
     *
     * @since 1.6
     *
     * @param Parameter $parameter
     * @param boolean $hasAliases
     *
     * @return string
     */
    protected function getDescriptionRow(Parameter $parameter, $hasAliases)
    {
        if ($hasAliases) {
            $aliases = $parameter->getAliases();
            $aliases = count($aliases) > 0 ? implode(', ', $aliases) : '-';
        }
        $description = $parameter->getMessage();
        if ($description === false) {
            $description = $parameter->getDescription();
            if ($description === false) {
                $description = '-';
            }
        } else {
            $description = $this->msg($description);
        }
        $type = $parameter->getTypeMessage();
        $default = $parameter->isRequired() ? "''" . $this->msg('validator-describe-required') . "''" : $parameter->getDefault();
        if (is_array($default)) {
            $default = implode(', ', $default);
        } elseif (is_bool($default)) {
            $default = $default ? 'yes' : 'no';
        }
        if ($default === '') {
            $default = "''" . $this->msg('validator-describe-empty') . "''";
        }
        return "| {$parameter->getName()}\n" . ($hasAliases ? '| ' . $aliases . "\n" : '') . <<<EOT
| {$type}
| {$default}
| {$description}
EOT;
    }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:41,代码来源:SMW_SMWDoc.php

示例11: newFromParameter

 /**
  * @deprecated Compatibility helper, will be removed in 0.7.
  * @since 0.5
  *
  * @param Parameter $parameter
  *
  * @return IParamDefinition
  */
 public static function newFromParameter(Parameter $parameter)
 {
     $def = self::newFromType($parameter->getType(), $parameter->getName(), $parameter->getDefault(), $parameter->getMessage() === false ? 'validator-message-nodesc' : $parameter->getMessage(), $parameter->isList());
     $def->addAliases($parameter->getAliases());
     $def->addCriteria($parameter->getCriteria());
     $def->addManipulations($parameter->getManipulations());
     $def->addDependencies($parameter->getDependencies());
     $def->setDoManipulationOfDefault($parameter->applyManipulationsToDefault);
     if ($parameter->isList()) {
         $def->setDelimiter($parameter->getDelimiter());
     }
     $def->trimValue = $parameter->trimValue;
     return $def;
 }
开发者ID:yusufchang,项目名称:app,代码行数:22,代码来源:ParamDefinition.php

示例12: __construct

 public function __construct(Parameter $parameter)
 {
     parent::__construct($parameter->getName(), $parameter->isRequired());
     $this->parameter = $parameter;
 }
开发者ID:projectstorm,项目名称:php-actions,代码行数:5,代码来源:ArrayParameter.php

示例13: showFormatOption

 /**
  * Get the HTML for a single parameter input.
  *
  * @param Parameter $parameter
  * @param mixed $currentValue
  *
  * @return string
  */
 protected function showFormatOption(Parameter $parameter, $currentValue)
 {
     $input = new ParameterInput($parameter);
     $input->setInputName('p[' . $parameter->getName() . ']');
     if ($currentValue !== false) {
         $input->setCurrentValue($currentValue);
     }
     return $input->getHtml();
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:17,代码来源:SMW_QueryUI.php

示例14: prepare

 /**
  * Configures wrapped formatter class with any attributes on this element.
  */
 public function prepare()
 {
     if (!$this->formatter) {
         throw new BuildException("No formatter specified (use type or classname attribute)", $this->getLocation());
     }
     $out = $this->getOutputWriter();
     print "Setting output writer to: " . get_class($out) . "\n";
     $this->formatter->setOutput($out);
     if ($this->formatter instanceof PlainPDOResultFormatter) {
         // set any options that apply to the plain formatter
         $this->formatter->setShowheaders($this->showheaders);
         $this->formatter->setRowdelim($this->rowdelimiter);
         $this->formatter->setColdelim($this->coldelimiter);
     } elseif ($this->formatter instanceof XMLPDOResultFormatter) {
         // set any options that apply to the xml formatter
         $this->formatter->setEncoding($this->encoding);
         $this->formatter->setFormatOutput($this->formatoutput);
     }
     foreach ($this->formatterParams as $param) {
         $param = new Parameter();
         $method = 'set' . $param->getName();
         if (!method_exists($this->formatter, $param->getName())) {
             throw new BuildException("Formatter " . get_class($this->formatter) . " does not have a {$method} method.", $this->getLocation());
         }
         call_user_func(array($this->formatter, $method), $param->getValue());
     }
 }
开发者ID:hunde,项目名称:bsc,代码行数:30,代码来源:PDOSQLExecFormatterElement.php

示例15: attemptToSetUserValue

 /**
  * Tries to find a matching user provided value and, when found, assigns it
  * to the parameter, and removes it from the raw values. Returns a boolean
  * indicating if there was any user value set or not.
  * 
  * @since 0.4
  * 
  * @return boolean
  */
 protected function attemptToSetUserValue(Parameter $parameter)
 {
     if (array_key_exists($parameter->getName(), $this->rawParameters)) {
         $parameter->setUserValue($parameter->getName(), $this->rawParameters[$parameter->getName()]);
         unset($this->rawParameters[$parameter->getName()]);
         return true;
     } else {
         foreach ($parameter->getAliases() as $alias) {
             if (array_key_exists($alias, $this->rawParameters)) {
                 $parameter->setUserValue($alias, $this->rawParameters[$alias]);
                 unset($this->rawParameters[$alias]);
                 return true;
             }
         }
     }
     return false;
 }
开发者ID:JeroenDeDauw,项目名称:phpapi,代码行数:26,代码来源:Validator.php


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