本文整理汇总了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');
}
}
示例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;
}