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


PHP data::isNonEmptyString方法代码示例

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


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

示例1: switch

 /**
  * Retrieves reference on usable variable space.
  *
  * @note Using global session space shared by several applications requires
  *       external setup to provide access on same PHP session.
  *
  * @param int $scope one of the SCOPE_* constants
  * @param string|bool $parameter additional selector used according to $scope
  * @return array-ref
  */
 public final function &access($scope, $parameter = null)
 {
     if (!class_exists('\\de\\toxa\\txf\\txf', false)) {
         throw new \RuntimeException('missing TXF context for accessing managed data');
     }
     // ensure session has been restored from serialization
     $this->makeUsable();
     /*
      * process selected scope
      */
     // validate provided parameter
     if ($scope & self::SCOPE_CLASS) {
         if (!($parameter = data::isNonEmptyString($parameter))) {
             throw new \InvalidArgumentException('invalid/missing class selector');
         }
     }
     // prepare subset of session data according to scope and parameter and
     // return reference on it for read/write access
     switch ($scope) {
         case self::SCOPE_SCRIPT:
             self::makeArray($this->usable['applications']);
             self::makeArray($this->usable['applications'][TXF_APPLICATION]);
             self::makeArray($this->usable['applications'][TXF_APPLICATION]['scripts']);
             self::makeArray($this->usable['applications'][TXF_APPLICATION]['scripts'][TXF_SCRIPT_PATH]);
             return $this->usable['applications'][TXF_APPLICATION]['scripts'][TXF_SCRIPT_PATH];
         case self::SCOPE_CLASS + self::SCOPE_SCRIPT:
             self::makeArray($this->usable['applications']);
             self::makeArray($this->usable['applications'][TXF_APPLICATION]);
             self::makeArray($this->usable['applications'][TXF_APPLICATION]['scripts']);
             self::makeArray($this->usable['applications'][TXF_APPLICATION]['scripts'][TXF_SCRIPT_PATH]);
             self::makeArray($this->usable['applications'][TXF_APPLICATION]['scripts'][TXF_SCRIPT_PATH]['classes']);
             self::makeArray($this->usable['applications'][TXF_APPLICATION]['scripts'][TXF_SCRIPT_PATH]['classes'][$parameter]);
             return $this->usable['applications'][TXF_APPLICATION]['scripts'][TXF_SCRIPT_PATH]['classes'][$parameter];
         case self::SCOPE_CLASS + self::SCOPE_APPLICATION:
             self::makeArray($this->usable['applications']);
             self::makeArray($this->usable['applications'][TXF_APPLICATION]);
             self::makeArray($this->usable['applications'][TXF_APPLICATION]['classes']);
             self::makeArray($this->usable['applications'][TXF_APPLICATION]['classes'][$parameter]);
             return $this->usable['applications'][TXF_APPLICATION]['classes'][$parameter];
         case self::SCOPE_CLASS + self::SCOPE_GLOBAL:
             self::makeArray($this->usable['classes']);
             self::makeArray($this->usable['classes'][$parameter]);
             return $this->usable['classes'][$parameter];
         case self::SCOPE_APPLICATION:
             self::makeArray($this->usable['applications']);
             self::makeArray($this->usable['applications'][TXF_APPLICATION]);
             self::makeArray($this->usable['applications'][TXF_APPLICATION]['shared']);
             return $this->usable['applications'][TXF_APPLICATION]['shared'];
         case self::SCOPE_GLOBAL:
             self::makeArray($this->usable['shared']);
             return $this->usable['shared'];
         default:
             throw new \InvalidArgumentException('invalid session scope');
     }
 }
开发者ID:cepharum,项目名称:txf,代码行数:65,代码来源:session.php

示例2: update

 /**
  * Adjusts value of selected variable.
  *
  * If selected variable isn't found in variable space, it's created
  * implicitly.
  *
  * @param string $name name for variable to change
  * @param mixed $value value to assign
  * @throws \InvalidArgumentException
  * @return mixed adjusted value for chaining assignments
  */
 public function update($name, $value = null)
 {
     if (($name = data::isNonEmptyString($name)) === false) {
         throw new \InvalidArgumentException('invalid variable name');
     }
     if (\func_num_args() == 1) {
         unset($this->__heap[$name]);
     } else {
         $this->__heap[$name] = $value;
     }
     return $value;
 }
开发者ID:cepharum,项目名称:txf,代码行数:23,代码来源:variable_space.php


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