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


PHP Code::value方法代码示例

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


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

示例1: escapeFor

 public function escapeFor($type)
 {
     \Psc\Code\Code::value($type, self::WINDOWS, self::UNIX);
     if ($this->escapeFor != NULL && $type != $this->escapeFor && count($this->args) > 0) {
         throw new \RuntimeException('You switched to another escapeFor Mode, but you have already added arguments (through constructor?). Use escapeFor as last Argument from create/construct or as first chain-command');
     }
     $this->escapeFor = $type;
     return $this;
 }
开发者ID:pscheit,项目名称:psc-cms,代码行数:9,代码来源:ProcessBuilder.php

示例2: createHTTPRequest

 /**
  * @return Psc\Net\HTTP\Request
  */
 public function createHTTPRequest($methodString, $resource, $GET = array(), $POST = array(), $COOKIE = array(), $accept = NULL)
 {
     \Psc\Code\Code::value($methodString, 'GET', 'POST');
     $project = \Psc\PSC::getProject();
     $baseUrl = $project->getHostUrl('base');
     $SERVER = array('HTTP_HOST' => $baseUrl->getHost(), 'HTTP_USER_AGENT' => 'Mozilla/5.0 (Windows NT 6.0; rv:7.0.1) Gecko/20100101 Firefox/7.0.1', 'HTTP_ACCEPT' => $accept ?: 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'HTTP_ACCEPT_LANGUAGE' => 'en-us,en;q=0.5', 'HTTP_ACCEPT_ENCODING' => 'gzip, deflate', 'HTTP_ACCEPT_CHARSET' => 'ISO-8859-1,utf-8;q=0.7,*;q=0.7', 'HTTP_CONNECTION' => 'keep-alive', 'SERVER_NAME' => $baseUrl->getHost(), 'DOCUMENT_ROOT' => (string) $project->dir('www'), 'REDIRECT_QUERY_STRING' => 'request=' . $resource, 'REDIRECT_URL' => $resource, 'GATEWAY_INTERFACE' => 'CGI/1.1', 'SERVER_PROTOCOL' => 'HTTP/1.1', 'REQUEST_METHOD' => $methodString, 'QUERY_STRING' => 'request=' . $resource, 'REQUEST_URI' => $resource, 'SCRIPT_NAME' => '/api.php', 'PHP_SELF' => '/api.php', 'REQUEST_TIME' => time());
     //$request = create($uri, $method = 'GET', $parameters = array(), $cookies = array(), $files = array(), $server = array(), $content = null)
     $request = SfRequest::create((string) $baseUrl . '/' . ltrim($resource, '/'), $methodString, $methodString === 'POST' ? $POST : $GET, $COOKIE, array(), $SERVER);
     $request = Request::infer($request);
     return $request;
 }
开发者ID:pscheit,项目名称:psc-cms,代码行数:14,代码来源:DoublesManager.php

示例3: convertTo

 public function convertTo($type, $precision = NULL)
 {
     Code::value($type, self::NET, self::GROSS, self::TAX);
     if ($type === self::GROSS && $this->tax !== -1) {
         $price = $this->net * (1 + $this->tax);
     } elseif ($type === self::TAX) {
         if ($this->tax === -1) {
             return 0;
         }
         $price = $this->net * $this->tax;
     } else {
         $price = $this->net;
     }
     return round($price, $precision ?: $this->precision);
 }
开发者ID:pscheit,项目名称:psc-cms,代码行数:15,代码来源:Price.php

示例4: assertHasRelationAnnotation

 /**
  * @return Psc\Doctrine\Annotation
  */
 protected function assertHasRelationAnnotation($expectedName, $expectedProperties, DocBlock $actualDocBlock)
 {
     Code::value($expectedName, 'OneToMany', 'ManyToOne', 'OneToOne', 'ManyToMany');
     $this->assertEquals(Annotation::createDC($expectedName, $expectedProperties), $annotation = $this->assertHasDCAnnotation($actualDocBlock, $expectedName));
     return $annotation;
 }
开发者ID:pscheit,项目名称:psc-cms,代码行数:9,代码来源:EntityRelationBaseTest.php

示例5: setMethod

 public function setMethod($method)
 {
     Code::value($method, self::GET, self::POST, self::PUT, self::DELETE, self::PATCH);
     $this->method = $method;
 }
开发者ID:pscheit,项目名称:psc-cms,代码行数:5,代码来源:Request.php

示例6: createRelation

 /**
  * Legacy Interface für den ModelCompiler (für den ersten Wurf)
  * 
  * erstellt eine Relation und ruft direkt buildRelation auf
  * @return EntityRelation
  */
 public function createRelation($relationType, EntityRelationMeta $source, EntityRelationMeta $target, $side = NULL, $updateOtherSide = true)
 {
     Code::value($relationType, self::RELATION_MANY_TO_MANY, self::RELATION_MANY_TO_ONE, self::RELATION_ONE_TO_MANY, self::RELATION_ONE_TO_ONE);
     Code::value($side, self::SIDE_OWNING, self::SIDE_INVERSE, NULL);
     // Parameter übersetzen in constructor parameter von relation
     if ($side !== NULL) {
         $direction = EntityRelation::BIDIRECTIONAL;
         $whoIsOwningSide = $side === self::SIDE_OWNING ? EntityRelation::SOURCE : EntityRelation::TARGET;
     } else {
         $direction = EntityRelation::UNIDIRECTIONAL;
         $whoIsOwningSide = NULL;
     }
     $relation = new EntityRelation($source, $target, $relationType, $direction, $whoIsOwningSide);
     $this->buildRelation($relation);
     return $relation;
 }
开发者ID:pscheit,项目名称:psc-cms,代码行数:22,代码来源:EntityBuilder.php

示例7: setMethod

 /**
  * @param const $method
  * @chainable
  */
 protected function setMethod($method)
 {
     Code::value($method, self::GET, self::POST, self::PUT, self::DELETE);
     $this->method = $method;
     return $this;
 }
开发者ID:pscheit,项目名称:psc-cms,代码行数:10,代码来源:AjaxMeta.php

示例8: sortComponentsBy

 public function sortComponentsBy($property)
 {
     Code::value($property, 'formName', 'formValue', 'formLabel', 'componentName');
     $getter = Code::castGetter($property);
     $sorting = function ($c1, $c2) use($getter) {
         return strcmp($getter($c1), $getter($c2));
     };
     $this->sortComponents($sorting);
     return $this;
 }
开发者ID:pscheit,项目名称:psc-cms,代码行数:10,代码来源:ComponentsForm.php

示例9: attachLabel

 public static function attachLabel($element, $label, $type = self::LABEL_TOP)
 {
     Code::value($type, self::LABEL_TOP, self::LABEL_CHECKBOX);
     if ($label != NULL) {
         $element->templateContent->label = fHTML::label($label, $element)->addClass('\\Psc\\label');
         if ($type == self::LABEL_TOP) {
             $element->templatePrepend('%label%');
             // nicht überschreiben sondern prependen
         }
         if ($type == self::LABEL_CHECKBOX) {
             $element->template = '%self% %label%';
             $element->templateContent->label->addClass('checkbox-label');
         }
     }
     return $element;
 }
开发者ID:pscheit,项目名称:psc-cms,代码行数:16,代码来源:Form.php

示例10: setValueType

 /**
  * @param string $valueType
  */
 public function setValueType($valueType)
 {
     Code::value($valueType, self::COLLECTION_VALUED, self::SINGLE_VALUED);
     $this->valueType = $valueType;
     return $this;
 }
开发者ID:pscheit,项目名称:psc-cms,代码行数:9,代码来源:EntityRelationMeta.php

示例11: setMode

 /**
  * @param string $mode
  * @chainable
  */
 public function setMode($mode)
 {
     Code::value($mode, self::MODE_LOCAL_MAIL, self::MODE_NULL, self::MODE_SMTP);
     $this->mode = $mode;
     return $this;
 }
开发者ID:pscheit,项目名称:psc-cms,代码行数:10,代码来源:ContactFormMailer.php

示例12: setType

 /**
  * @chainable
  */
 protected function setType($type)
 {
     Code::value($type, self::SPECIFIC, self::GENERAL);
     $this->type = $type;
     return $this;
 }
开发者ID:pscheit,项目名称:psc-cms,代码行数:9,代码来源:ActionMeta.php

示例13: setStatus

 /**
  * @param const $status Service::OK|Service::ERROR usw
  * @chainable
  */
 public function setStatus($status)
 {
     Code::value($status, Service::OK, Service::ERROR);
     $this->status = $status;
     return $this;
 }
开发者ID:pscheit,项目名称:psc-cms,代码行数:10,代码来源:ServiceResponse.php

示例14: getSynchronizerFor

 /**
  * @param $type normal|hydration
  * @return Psc\Doctrine\EntityCollectionSynchronizer
  */
 protected function getSynchronizerFor($collectionPropertyName, $type = 'normal')
 {
     Code::value($type, 'normal', 'hydration');
     if ($type === 'hydration') {
         $c = 'Psc\\Doctrine\\PersistentCollectionSynchronizer';
     } else {
         $c = 'Psc\\Doctrine\\CollectionSynchronizer';
     }
     return $c::createFor($this->getEntityName(), $collectionPropertyName, $this->dc);
 }
开发者ID:pscheit,项目名称:psc-cms,代码行数:14,代码来源:AbstractEntityController.php

示例15: testValue

 public function testValue()
 {
     $ex = 'Psc\\Code\\WrongValueException';
     $this->assertEquals('eins', Code::value('eins', 'eins', 'zwei', 'drei'));
     $this->assertEquals('zwei', Code::value('zwei', 'eins', 'zwei', 'drei'));
     $this->assertEquals('drei', Code::value('drei', 'eins', 'zwei', 'drei'));
     $this->assertException($ex, function () {
         Code::value(NULL, 'eins', 'zwei', 'drei');
     });
     $this->assertException($ex, function () {
         Code::value('notexistent', 'eins', 'zwei', 'drei');
     });
 }
开发者ID:pscheit,项目名称:psc-cms,代码行数:13,代码来源:CodeTest.php


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