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


PHP Assert::isScalar方法代码示例

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


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

示例1: __construct

 function __construct($name, $address)
 {
     Assert::isScalar($name);
     Assert::isScalar($address);
     $this->name = $name;
     $this->address = $address;
 }
开发者ID:phoebius,项目名称:phoebius.com,代码行数:7,代码来源:ViewLink.php

示例2: move

 function move($filepath)
 {
     Assert::isScalar($filepath);
     Assert::isTrue(is_dir(dirname($filepath)));
     Assert::isTrue(is_writable(dirname($filepath)));
     return move_uploaded_file($this->getImportedFilepath(), $filepath);
 }
开发者ID:phoebus,项目名称:HTML_FormAbstraction,代码行数:7,代码来源:FileFormControl.class.php

示例3: importValue

 public function importValue($value)
 {
     if ($value instanceof UnifiedContainer) {
         if ($value->isLazy()) {
             return $this->import(array($this->name => $value->getList()));
         } elseif ($value->getParentObject()->getId() && ($list = $value->getList())) {
             return $this->import(array($this->name => ArrayUtils::getIdsArray($list)));
         } else {
             return parent::importValue(null);
         }
     }
     if (is_array($value)) {
         try {
             if ($this->scalar) {
                 Assert::isScalar(current($value));
             } else {
                 Assert::isInteger(current($value));
             }
             return $this->import(array($this->name => $value));
         } catch (WrongArgumentException $e) {
             return $this->import(array($this->name => ArrayUtils::getIdsArray($value)));
         }
     }
     return parent::importValue($value);
 }
开发者ID:onphp-framework,项目名称:onphp-framework,代码行数:25,代码来源:PrimitiveIdentifierList.class.php

示例4: __construct

 /**
  * @param ISqlQuery $query
  * @param string $errormsg
  * @param integer $errorno
  */
 function __construct(ISqlQuery $query, $errormsg, $errorno)
 {
     Assert::isScalar($errormsg);
     Assert::isNumeric($errorno);
     parent::__construct($errormsg, $errorno);
     $this->query = $query;
 }
开发者ID:phoebius,项目名称:phoebius,代码行数:12,代码来源:DBQueryException.class.php

示例5: setPattern

 /**
  * Sets the new URL pattern to use
  *
  * @param string $pattern pattern to set
  *
  * @return PathRewriteRule itself
  */
 function setPattern($pattern)
 {
     Assert::isScalar($pattern);
     $this->urlPattern = '/' . ltrim($pattern, '/');
     $this->parsePattern();
     return $this;
 }
开发者ID:phoebius,项目名称:ajax-example,代码行数:14,代码来源:PathRewriteRule.class.php

示例6: __construct

 function __construct($name, $label)
 {
     Assert::isScalar($name);
     Assert::isScalar($label);
     $this->name = $name;
     $this->label = $label;
 }
开发者ID:phoebus,项目名称:HTML_FormAbstraction,代码行数:7,代码来源:BaseFormControl.class.php

示例7: __construct

 /**
  * @param string $name name of the column
  * @param ISqlType $type SQL type of the column
  */
 function __construct($name, DBTable $table, ISqlType $type)
 {
     Assert::isScalar($name);
     $this->name = $name;
     $this->table = $table;
     $this->type = $type;
 }
开发者ID:phoebius,项目名称:phoebius,代码行数:11,代码来源:DBColumn.class.php

示例8: setDefaultValue

 function setDefaultValue($value)
 {
     Assert::isScalar($value, 'default value shall be scalar');
     Assert::isTrue(in_array($value, $this->getAvailableValues()), 'trying to set a default value that is out of options range');
     $this->defaultValue = $value;
     return $this;
 }
开发者ID:phoebus,项目名称:HTML_FormAbstraction,代码行数:7,代码来源:RadioFormControlSet.class.php

示例9: __construct

 /**
  * @param string $func name of the aggregate
  * @param string $expression property to be used for aggregation
  * @param string $alias optional label for the result of the aggregator
  */
 function __construct($func, $expression = null, $alias = null)
 {
     Assert::isScalar($func);
     $this->func = $func;
     $this->expression = $expression;
     $this->alias = $alias;
 }
开发者ID:phoebius,项目名称:phoebius,代码行数:12,代码来源:AggrProjection.class.php

示例10: __construct

 /**
  * @param string $field name of the column
  * @param string $table optional name of the table that owns the column
  */
 function __construct($field, $table = null)
 {
     Assert::isScalar($field);
     Assert::isScalarOrNull($table);
     $this->field = $field;
     $this->table = $table;
 }
开发者ID:phoebius,项目名称:phoebius,代码行数:11,代码来源:SqlColumn.class.php

示例11: __construct

 function __construct($title, $name)
 {
     Assert::isScalar($title);
     Assert::isScalar($name);
     $this->title = $title;
     $this->name = $name;
 }
开发者ID:phoebius,项目名称:phoebius.com,代码行数:7,代码来源:SiteDocAuthor.class.php

示例12: __construct

 /**
  * @param WebRequestDictionary $dictonary
  * @param array $getVars request's $_GET
  * @param array $postVars request's $_POST
  * @param array $cookieVars request's $_COOKIE
  * @param array $filesVars request's $_FILES
  * @param string|null $baseHost optional base host for request's request url (SiteUrl)
  * @param string $baseUri optional base uri
  */
 function __construct(WebRequestDictionary $dictonary, array $getVars, array $postVars, array $cookieVars, array $filesVars, $baseHost = null, $baseUri = '/')
 {
     Assert::isScalar($baseUri);
     $this->dictionary = $dictonary->getFields();
     $this->httpUrl = SiteUrl::import($dictonary, $baseHost, $baseUri);
     $this->vars = array(WebRequestPart::GET => $getVars, WebRequestPart::POST => $postVars, WebRequestPart::COOKIE => $cookieVars, WebRequestPart::FILES => $filesVars);
     $this->allVars = call_user_func_array('array_merge', array($filesVars, $cookieVars, $postVars, $getVars));
 }
开发者ID:phoebius,项目名称:ajax-example,代码行数:17,代码来源:WebRequest.class.php

示例13: __construct

 /**
  * @throws FileNotFoundException thrown when the path to a file is wrong
  * @param string $layoutPath path to PHP file
  */
 function __construct($layoutPath)
 {
     Assert::isScalar($layoutPath);
     $this->layoutPath = $layoutPath;
     if (!file_exists($layoutPath)) {
         throw new FileNotFoundException($layoutPath, 'template not found at the specified path');
     }
 }
开发者ID:phoebius,项目名称:ajax-example,代码行数:12,代码来源:UIPhpLayoutPresentation.class.php

示例14: getTable

 /**
  * Gets the DBTable object by its name
  *
  * @param string $name name of the table to look up
  * @throws ArgumentException thrown when no DBTable object identified by name found
  * @return DBTable
  */
 function getTable($name)
 {
     Assert::isScalar($name);
     if (!isset($this->tables[$name])) {
         throw new ArgumentException('name', 'not found');
     }
     return $this->tables[$name];
 }
开发者ID:phoebius,项目名称:ajax-example,代码行数:15,代码来源:DBSchema.class.php

示例15: __construct

 /**
  * @param array of string $fields
  */
 function __construct($name, DBTable $table, array $fields)
 {
     Assert::isScalar($name);
     Assert::isNotEmpty($fields, 'constraint cannot be across zero fields');
     $this->name = $name;
     $this->table = $table;
     $this->fields = $fields;
 }
开发者ID:phoebius,项目名称:phoebius,代码行数:11,代码来源:DBConstraint.class.php


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