本文整理汇总了PHP中yii\base\Object::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP Object::__construct方法的具体用法?PHP Object::__construct怎么用?PHP Object::__construct使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\base\Object
的用法示例。
在下文中一共展示了Object::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* @param string|mixed[] $config the configuration of [[\romkaChev\yii2\swiper\Slide]]
* You can create slide just from string
* For example:
*
* ~~~
* $slide = new \romkaChev\yii2\swiper\Slide('slide content');
* ~~~
*
*
* Also you can create slide from array or strings and
* they will be merged into one string
* For example:
*
* ~~~
* $slide = new \romkaChev\yii2\swiper\Slide([
* 'content' => [
* '<h1>Title</h1>',
* '<h3>Subtitle</h3>',
* '<p>Main content</p>'
* ]
* ]);
* ~~~
*
* @see \romkaChev\yii2\swiper\Slide::$background
* @see \romkaChev\yii2\swiper\Slide::$hash
* @see \romkaChev\yii2\swiper\Slide::$content
*/
public function __construct($config = [])
{
$config = is_string($config) ? [self::CONTENT => $config] : $config;
$config[self::CONTENT] = ArrayHelper::getValue($config, self::CONTENT, null);
$config[self::CONTENT] = is_array($config[self::CONTENT]) ? implode('', $config[self::CONTENT]) : $config[self::CONTENT];
parent::__construct($config);
}
示例2: __construct
/**
* Costruisce una nuova istanza della classe e imposta le proprietà fondamentali.
* @param type $id Id applicazione
* @param type $basePath Cartella root dell'applicazione
* @param type $filesSubfolder Sottocartella per i files di configurazione
*/
public function __construct($id, $basePath, $filesSubfolder = null)
{
$this->_id = $id;
$this->_basePath = $basePath;
$this->_configFolder = dirname(__FILE__) . '/../../../config/' . ($filesSubfolder ? $filesSubfolder . '/' : '');
parent::__construct();
}
示例3: __construct
/**
* @param \phpDocumentor\Reflection\BaseReflector $reflector
* @param Context $context
* @param array $config
*/
public function __construct($reflector = null, $context = null, $config = [])
{
parent::__construct($config);
if ($reflector === null) {
return;
}
// base properties
$this->name = ltrim($reflector->getName(), '\\');
$this->startLine = $reflector->getNode()->getAttribute('startLine');
$this->endLine = $reflector->getNode()->getAttribute('endLine');
$docblock = $reflector->getDocBlock();
if ($docblock !== null) {
$this->shortDescription = ucfirst($docblock->getShortDescription());
if (empty($this->shortDescription) && !$this instanceof PropertyDoc && $context !== null && $docblock->getTagsByName('inheritdoc') === null) {
$context->errors[] = ['line' => $this->startLine, 'file' => $this->sourceFile, 'message' => "No short description for " . substr(StringHelper::basename(get_class($this)), 0, -3) . " '{$this->name}'"];
}
$this->description = $docblock->getLongDescription()->getContents();
$this->phpDocContext = $docblock->getContext();
$this->tags = $docblock->getTags();
foreach ($this->tags as $i => $tag) {
if ($tag instanceof SinceTag) {
$this->since = $tag->getVersion();
unset($this->tags[$i]);
} elseif ($tag instanceof DeprecatedTag) {
$this->deprecatedSince = $tag->getVersion();
$this->deprecatedReason = $tag->getDescription();
unset($this->tags[$i]);
}
}
} elseif ($context !== null) {
$context->errors[] = ['line' => $this->startLine, 'file' => $this->sourceFile, 'message' => "No docblock for element '{$this->name}'"];
}
}
示例4: __construct
public function __construct(\luya\web\Request $request, \luya\web\UrlManager $urlManager, array $config = [])
{
$this->request = $request;
$this->urlManager = $urlManager;
// parent object
parent::__construct($config);
}
示例5: __construct
/**
* Fills property values
* @param array $properties
*/
public function __construct($properties)
{
foreach ($properties as $name => $value) {
$this->hasProperty($name) && ($this->{$name} = $value);
}
parent::__construct();
}
示例6: __construct
/**
*
* @param array $config
*/
public function __construct($config = [])
{
if (!empty($config['metadata']) && is_array($config['metadata'])) {
$this->_metadata = $config['metadata'];
unset($config['metadata']);
}
parent::__construct($config);
}
示例7: __construct
/**
* @inheritdoc
*/
public function __construct($config = [])
{
$source = ArrayHelper::remove($config, 'source');
parent::__construct($config);
if (!empty($source)) {
$this->setSource($source);
}
}
示例8: __construct
/**
* Конструктор
* @param string $path
* @param array $config
* @throws \common\exceptions\IoException
*/
public function __construct($path, $config = [])
{
if (!is_file($path)) {
throw new IoException(Yii::t('core', 'File {file} does not exists.', ["{file}" => $path]));
}
$this->path = $path;
parent::__construct($config);
}
示例9: __construct
/**
* @param string $name
* @param string $alias
* @param null|string $stamp
* @param array $config
*/
public function __construct($name, $alias, $stamp = null, $config = [])
{
$this->_name = $name;
$this->_alias = $alias;
$this->_stamp = $stamp;
$this->_fileName = static::extractFileName($alias, $stamp);
parent::__construct($config);
}
示例10: __construct
/**
* @inheritdoc
*adding rule that saying: not assigning id user to the view
*use global var $idAdmin
*/
public function __construct($id, $user = null, $config = array())
{
if ($id != Yii::$app->params['idAdmin']) {
$this->id = $id;
$this->user = $user;
}
parent::__construct($config);
}
示例11: __construct
/**
* Constructor
* @param \common\helper\DOMNode $node
* @param array $config config array
*/
public function __construct($config = [])
{
$this->reset();
if (isset($config['DomNode'])) {
$this->_root = $config['DomNode'];
unset($config['DomNode']);
}
parent::__construct($config);
}
示例12: __construct
/**
* @param string $callback
* @param array $parameters
* @param array $config
*/
public function __construct($callback, array $parameters = [], $config = [])
{
$this->callback = $callback;
$this->parameters = $parameters;
Object::__construct($config);
if (!is_string($this->callback) && !is_callable($this->callback)) {
throw new InvalidParamException("Invalid scheduled callback event. Must be string or callable.");
}
}
示例13: __construct
public function __construct($config = [])
{
$config = array_merge($this->defaults, $config);
$this->variant = $config['variant'];
$this->fileName = $config['fileName'];
$this->PHPWord = new \PHPWord();
$this->calculation = new Calculation();
parent::__construct();
}
示例14: __construct
public function __construct($config = [])
{
$config['config_file'] = \Yii::getAlias($config['config_file']);
parent::__construct($config);
if (!file_exists($this->config_file)) {
$this->saveDefaultCfg();
} else {
$this->load($this->config_file);
}
}
示例15: __construct
public function __construct($config)
{
parent::__construct($config);
$this->tableNameRaw = Yii::$app->db->schema->getRawTableName($this->tableName);
if (!$this->tableName) {
throw new ErrorException("Table name not defined");
}
$this->afterInit();
$this->generateFields();
}