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


PHP Assert::isScalarOrNull方法代码示例

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


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

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

示例2: __construct

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

示例3: quoteValue

 function quoteValue($value)
 {
     Assert::isScalarOrNull($value, 'not a scalar, but %s', gettype($value));
     if (is_null($value)) {
         return 'NULL';
     }
     return '\'' . mysql_real_escape_string($value, $this->link) . '\'';
 }
开发者ID:phoebius,项目名称:phoebius,代码行数:8,代码来源:MySqlDialect.class.php

示例4: quoteValue

 function quoteValue($value)
 {
     Assert::isScalarOrNull($value);
     if (is_null($value)) {
         return 'NULL';
     }
     return "'" . str_replace("'", "''", $value) . "'";
 }
开发者ID:phoebius,项目名称:phoebius,代码行数:8,代码来源:DummyDialect.class.php

示例5: __construct

 /**
  * @param string $filepath path to the file that should be presented in response
  * @param string $filename optional name of the file to be specified in the response
  * @param string $contentType optional content type of the file to be specified in the response
  * @param boolean $unlinkOnFinish whether to remove the file when response is finished
  */
 function __construct($filepath, $filename = null, $contentType = null, $unlinkOnFinish = false)
 {
     Assert::isTrue(is_file($filepath));
     Assert::isScalarOrNull($filename);
     Assert::isScalarOrNull($contentType);
     Assert::isBoolean($unlinkOnFinish);
     $this->filepath = $filepath;
     $this->filename = $filename ? $filename : basename($filepath);
     $this->contentType = $contentType;
     $this->unlinkOnFileFlush = $unlinkOnFinish;
 }
开发者ID:phoebius,项目名称:ajax-example,代码行数:17,代码来源:FileResult.class.php

示例6: quoteValue

 function quoteValue($value)
 {
     Assert::isScalarOrNull($value, 'not a scalar, but %s', gettype($value));
     if (is_null($value)) {
         return 'NULL';
     }
     if (is_bool($value)) {
         $value = $value ? 't' : 'f';
     }
     return "'" . pg_escape_string($value) . "'";
 }
开发者ID:phoebius,项目名称:phoebius,代码行数:11,代码来源:PgSqlDialect.class.php

示例7: __construct

 /**
  * @param IQueryable $entity entity to use as base when guessing path to queried properties
  * @param string $alias optional table label
  */
 function __construct(IQueryable $entity, $alias = null)
 {
     Assert::isScalarOrNull($alias);
     $this->entity = $entity;
     $this->table = $entity->getPhysicalSchema()->getTable();
     $this->alias = $alias ? $alias : $this->table;
     $this->registeredIds[$this->table] = true;
     if ($alias) {
         $this->registeredIds[$alias] = true;
     }
     $this->joins[] = new SelectQuerySource(new AliasedSqlValueExpression(new SqlIdentifier($this->table), $alias));
 }
开发者ID:phoebius,项目名称:phoebius,代码行数:16,代码来源:EntityQueryBuilder.class.php

示例8: getDir

 /**
  * @return string
  */
 private function getDir($class, $scope, $internalDirectory = null)
 {
     Assert::isScalarOrNull($internalDirectory);
     $absolutePath = array($scope, $this->getActualClassName($class));
     if ($internalDirectory) {
         $absolutePath[] = (string) $internalDirectory;
     }
     $absolutePath = join(DIRECTORY_SEPARATOR, $absolutePath);
     if (!is_dir($absolutePath)) {
         mkdir($absolutePath, 0755, true);
     }
     Assert::isTrue(is_writable($absolutePath), 'directory %s is not writable', $absolutePath);
     return $absolutePath;
 }
开发者ID:phoebius,项目名称:ajax-example,代码行数:17,代码来源:PathResolver.class.php

示例9: setDbSchema

 /**
  * Sets the name of the database schema (defined within DBPool) where an entity should be
  * stored
  *
  * @param strign $dbSchema optional name of the database schema. NULL to set the default schema
  *
  * @return OrmClass itself
  */
 function setDbSchema($dbSchema = null)
 {
     Assert::isScalarOrNull($dbSchema);
     $this->dbSchema = $dbSchema;
     return $this;
 }
开发者ID:phoebius,项目名称:ajax-example,代码行数:14,代码来源:OrmClass.class.php

示例10: route

 /**
  * Smart route assembler.
  *
  * Accepts the name of the route to be assembled, URI to be used as a template for the rules.
  *
  * Example:
  * @code
  * $router->route("blogEntry", "/blog:controller/entry:action/?id");
  * @endcode
  *
  * In future, the third parameter will be allowed to contain various objects that will be
  * smartly mapped to appropriate rules.
  *
  * @param string $name name of the route
  * @param string $uri URI that will be used as request variables template
  * @param array $parameters array of parameters to be appended to Trace
  * @return ChainedRouter itself
  */
 function route($name, $uri = null, array $parameters = array())
 {
     Assert::isScalar($name);
     Assert::isScalarOrNull($uri);
     $rules = array();
     if ($uri) {
         $parsedUrlPattern = parse_url($uri);
         if (isset($parsedUrlPattern['path'])) {
             $rules[] = new PathRewriteRule($parsedUrlPattern['path']);
         }
         if (isset($parsedUrlPattern['query'])) {
             $queryStringVariables = array();
             parse_str($parsedUrlPattern['query'], $queryStringVariables);
             foreach ($queryStringVariables as $qsVar => $qsValue) {
                 $rules[] = new RequestVarImportRule($qsVar, new WebRequestPart(WebRequestPart::GET), !empty($qsValue), empty($qsValue) ? null : $qsValue);
             }
         }
     }
     foreach ($parameters as $parameter => $value) {
         $rules[] = new ParameterImportRule($parameter, $value);
     }
     $this->addRoute($name, new Route($this->defaultDispatcher, $rules));
     return $this;
 }
开发者ID:phoebius,项目名称:ajax-example,代码行数:42,代码来源:ChainedRouter.class.php

示例11: setVersion

 /**
  * @return DoxyGroup
  */
 function setVersion($version = null)
 {
     Assert::isScalarOrNull($version);
     $this->version = $version;
     return $this;
 }
开发者ID:phoebius,项目名称:phoebius.com,代码行数:9,代码来源:DoxyGroup.class.php

示例12: __construct

 function __construct($activeElement = null)
 {
     Assert::isScalarOrNull($activeElement);
     $this->activeElement = $activeElement;
     parent::__construct('parts/top-menu');
 }
开发者ID:phoebius,项目名称:phoebius.com,代码行数:6,代码来源:MenuView.class.php

示例13: setSubdomain

 /**
  * Sets the subdomain prepending it to the base host
  *
  * @param string|null $subdomain host to be treated as subdomain, or NULL if need
  * 			to drop the subdomain
  *
  * @return SiteUrl itself
  */
 function setSubdomain($subdomain = null)
 {
     Assert::isScalarOrNull($subdomain);
     $host = $subdomain ? $subdomain . '.' . $this->baseHost : $this->baseHost;
     $this->setHost($host);
     return $this;
 }
开发者ID:phoebius,项目名称:phoebius,代码行数:15,代码来源:SiteUrl.class.php

示例14: __construct

 /**
  * @param string $content texutal data to be passed to response
  */
 function __construct($content = null)
 {
     Assert::isScalarOrNull($content);
     $this->content = $content;
 }
开发者ID:phoebius,项目名称:phoebius,代码行数:8,代码来源:ContentResult.class.php

示例15: getOption

 /**
  * Gets the <option> tag as string
  * @param  $value
  * @param  $selected
  * @return string
  */
 protected function getOption($value, $selected)
 {
     Assert::isScalarOrNull($value);
     Assert::isBoolean($selected);
     $attributes = array();
     if ($value) {
         $attributes['value'] = $value;
     }
     if ($selected) {
         $attributes['selected'] = 'selected';
     }
     return HtmlUtil::getContainer('option', $attributes, $this->getLabelFor($value));
 }
开发者ID:phoebus,项目名称:HTML_FormAbstraction,代码行数:19,代码来源:SetFormControl.class.php


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