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