本文整理汇总了PHP中Assert::type方法的典型用法代码示例。如果您正苦于以下问题:PHP Assert::type方法的具体用法?PHP Assert::type怎么用?PHP Assert::type使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Assert
的用法示例。
在下文中一共展示了Assert::type方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
public function render($tabulations)
{
Assert::type(__METHOD__, 'is_string($tabulations)', is_string($tabulations));
echo $tabulations . '<!--' . "\n";
echo $tabulations . ' ' . $this->m_content . "\n";
echo $tabulations . '-->' . "\n";
}
示例2: addBlock
public function addBlock($p_block)
{
Assert::type(__METHOD__, '$p_block instanceof Block', $p_block instanceof Block);
Assert::precondition(__METHOD__, 'in_array($p_block, $this->m_blocks, true) == false', in_array($p_block, $this->m_blocks, true) == false);
$this->m_blocks[] = $p_block;
foreach ($p_block->getSettings() as $setting) {
$this->m_settings[] = $setting;
}
return $this;
}
示例3: render
public function render($tabulations)
{
Assert::type(__METHOD__, 'is_string($tabulations)', is_string($tabulations));
Debug::startTimer('render');
// m_attributes serialization
$attributes = '';
foreach ($this->m_attributes as $attribute => $value) {
$attributes = $attributes . ' ' . $attribute . '="' . $value . '"';
}
echo $tabulations . '<link' . $attributes . '>' . "\n";
Debug::stopTimer('render');
}
示例4: unsecure
public static function unsecure($variable)
{
Assert::type(__METHOD__, 'is_string($variable) || is_array($variable) || is_null($variable) || is_numeric($variable)', is_string($variable) || is_array($variable) || is_null($variable) || is_numeric($variable));
if (is_string($variable)) {
return htmlspecialchars_decode($variable, ENT_QUOTES);
} else {
if (is_array($variable) && !empty($variable)) {
foreach ($variable as $key => $value) {
$variable[$key] = self::unsecure($value);
}
}
}
return $variable;
}
示例5: setView
public function setView($p_view)
{
Assert::type(__METHOD__, '$p_view instanceof View', $p_view instanceof View);
unset($this->m_view);
// Destruction of the previous reference to avoid any conflict with the new one
$this->m_view = $p_view;
return $this;
}
示例6: run
public function run($options = array())
{
Assert::type(__METHOD__, 'is_array($options)', is_array($options));
foreach ($this->m_blocks as $block) {
$this->state = $block->process($this->state, $options);
}
echo "<!DOCTYPE html>\n";
echo "\t<html>\n";
echo "\t\t<head>\n";
foreach ($this->m_metas as $meta) {
$meta->render(' ');
}
foreach ($this->m_links as $link) {
$link->render(' ');
}
foreach ($this->m_scripts as $script) {
$script->render(' ');
}
echo "\t\t\t<title>" . $this->m_title . "</title>\n";
echo "\t\t</head>\n";
echo "\t\t<body>\n";
foreach ($this->m_blocks as $block) {
$block->render(' ');
}
echo "\t\t</body>\n";
echo "\t</html>\n";
}
示例7: __construct
public function __construct($p_settings)
{
Assert::type(__METHOD__, 'is_array($p_settings)', is_array($p_settings));
$this->m_settings = $p_settings;
}
示例8: render
public function render($tabulations)
{
Assert::type(__METHOD__, 'is_string($tabulations)', is_string($tabulations));
Debug::startTimer('render');
$singleTags = array('input', 'br', 'hr', 'img', 'meta', 'link');
// m_attributes serialization
$attributes = '';
foreach ($this->m_attributes as $attribute => $value) {
$attributes = $attributes . ' ' . $attribute . '="' . $value . '"';
}
// <tag> type HTML tags
if (in_array($this->m_tag, $singleTags)) {
echo $tabulations . '<' . $this->m_tag . ' ' . $attributes . '>' . "\n";
} else {
echo $tabulations . '<' . $this->m_tag . $attributes . ">\n";
if ($this->m_content != '') {
echo $tabulations . ' ' . $this->m_content . "\n";
}
foreach ($this->m_components as $component) {
$component->render($tabulations . ' ');
}
echo $tabulations . '</' . $this->m_tag . ">\n";
}
Debug::stopTimer('render');
}
示例9: render
public function render($tabulations, $outputs)
{
Assert::type(__METHOD__, 'is_string($tabulations)', is_string($tabulations));
Assert::type(__METHOD__, 'is_array($outputs)', is_array($outputs));
$this->build($outputs);
if (!empty($this->m_components)) {
foreach ($this->m_components as $component) {
$component->render($tabulations);
}
}
}