本文整理汇总了PHP中Thin\Arrays::isArray方法的典型用法代码示例。如果您正苦于以下问题:PHP Arrays::isArray方法的具体用法?PHP Arrays::isArray怎么用?PHP Arrays::isArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Thin\Arrays
的用法示例。
在下文中一共展示了Arrays::isArray方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: resolveCommands
/**
* Resolve an array of commands through the application.
*
* @param array|dynamic $commands
* @return void
*/
public function resolveCommands($commands)
{
$commands = Arrays::isArray($commands) ? $commands : func_get_args();
foreach ($commands as $command) {
$this->resolve($command);
}
}
示例2: render
/**
* Render the gravatar image HTML
*
* @param array $options [optional] The email to be used to generate the URL
* or a keyed array of option=>value pairs, for example:
* <code>
* echo $gravatar->render('john@johndoe.com');
* </code>
* or
* <code>
* echo $gravatar->render([
* $gravatar::OPTION_EMAIL => 'john@johndoe.com',
* $gravatar::OPTION_IMAGE_SIZE => 120
* ]);
* </code>
*
* @return string The img HTML tag containing the gravatar image
*
*
*/
public function render($options = array())
{
// check if the input is an array, and if not, assume it's an email address
if (!\Thin\Arrays::isArray($options)) {
$options = [self::OPTION_EMAIL => strval($options)];
}
$options = $options + $this->options;
// set HTML attributes
$attributes = new \Thin\Html\Attributes();
$attributes->set($this->attributes)->set('src', $this->getUrl($options))->set('width', $options[self::OPTION_IMAGE_SIZE])->set('height', $options[self::OPTION_IMAGE_SIZE]);
// build the HTML output and return it
return "<img {$attributes} />";
}
示例3: __set
/**
* Set a value in the config.
*
* Only allow setting of a property if $allowModifications was set to true
* on construction. Otherwise, throw an exception.
*
* @param string $name
* @param mixed $value
* @return void
* @throws Exception\RuntimeException
*/
public function __set($name, $value)
{
if ($this->allowModifications) {
if (Arrays::isArray($value)) {
$value = new static($value, true);
}
if (null === $name) {
$this->data[] = $value;
} else {
$this->data[$name] = $value;
}
$this->count++;
} else {
throw new Exception\RuntimeException('Config is read only');
}
}