本文整理匯總了PHP中CMap::__construct方法的典型用法代碼示例。如果您正苦於以下問題:PHP CMap::__construct方法的具體用法?PHP CMap::__construct怎麽用?PHP CMap::__construct使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CMap
的用法示例。
在下文中一共展示了CMap::__construct方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __construct
/**
* Constructor.
* @param mixed $data if string, it represents a config file (a PHP script returning the configuration as an array);
* If array, it is config data.
*/
public function __construct($data = null)
{
if (is_string($data)) {
parent::__construct(require $data);
} else {
parent::__construct($data);
}
}
示例2: __construct
/**
* Constructor.
* @param CForm the form object that owns this collection
* @param boolean whether this collection is used to store buttons.
*/
public function __construct($form, $forButtons = false)
{
parent::__construct();
$this->_form = $form;
$this->_forButtons = $forButtons;
}
示例3: __construct
public function __construct()
{
parent::__construct();
$this->init();
}
示例4: __construct
public function __construct(array $options)
{
parent::__construct($options);
}
示例5: __construct
/**
* @param Reflector $class
* @return CMap
*/
public function __construct($class)
{
$data = array('title' => NULL, 'description' => NULL);
if ($class instanceof Reflector && method_exists($class, 'getDocComment')) {
// Get the comment.
if (preg_match('#^/\\*\\*(.*)\\*/#s', $class->getDocComment(), $lines) !== false) {
$lines = trim($lines[1]);
// Get all the lines and strip the * from the first character.
if (preg_match_all('#^\\s*\\*(.*)#m', $lines, $lines) !== false) {
$description = array();
foreach ($lines[1] as $line) {
// Parse the line.
$line = trim($line);
if (!empty($line) && strpos($line, '@') === 0) {
// Get the parameter name and value.
$param = explode(' ', substr($line, 1), 2);
$data[$param[0]] = isset($param[1]) ? $param[1] : true;
} else {
if (count($data) <= 2) {
$description[] = $line;
// Store the first line in the title.
if (!empty($line) && empty($data['title'])) {
$data['title'] = $line;
}
}
}
// Store the line before params in the description.
$data['description'] = trim(implode(PHP_EOL, $description));
}
}
}
}
parent::__construct($data, true);
}