本文整理汇总了PHP中Object::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP Object::__construct方法的具体用法?PHP Object::__construct怎么用?PHP Object::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Object
的用法示例。
在下文中一共展示了Object::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* @param string $host
* @param int $port
*/
public function __construct($host, $port)
{
parent::__construct();
$this->host = $host;
$this->port = $port;
$this->socket = $this->createSocket();
}
示例2:
function __construct($params = null)
{
if ($params) {
$this->params = $params;
}
parent::__construct();
}
示例3: __construct
public function __construct($name, $value, $prompt = '')
{
parent::__construct();
$this->setName($name);
$this->setValue($value);
$this->setPrompt($prompt);
}
示例4: __construct
/**
* Constructor
*
* @param ObjectConfig $config An optional ObjectConfig object with configuration options
* @return DatabaseRowsetAbstract
*/
public function __construct(ObjectConfig $config)
{
parent::__construct($config);
//Set the prototypable
$this->_prototypable = $config->prototypable;
//Set the table identifier
$this->_table = $config->table;
// Set the table identifier
if (isset($config->identity_column)) {
$this->_identity_column = $config->identity_column;
}
// Clear the rowset
$this->clear();
// Insert the data, if exists
if (!empty($config->data)) {
foreach ($config->data->toArray() as $properties) {
$this->insert($properties, $config->status);
}
// Unset data to save memory
unset($config->data);
}
//Set the status message
if (!empty($config->status_message)) {
$this->setStatusMessage($config->status_message);
}
}
示例5: __construct
public function __construct($filename = null)
{
// If we're working with image resampling, things could take a while. Bump up the time-limit
increase_time_limit_to(300);
if ($filename && is_readable($filename)) {
// We use getimagesize instead of extension checking, because sometimes extensions are wrong.
list($width, $height, $type, $attr) = getimagesize($filename);
switch ($type) {
case 1:
if (function_exists('imagecreatefromgif')) {
$this->setImageResource(imagecreatefromgif($filename));
}
break;
case 2:
if (function_exists('imagecreatefromjpeg')) {
$this->setImageResource(imagecreatefromjpeg($filename));
}
break;
case 3:
if (function_exists('imagecreatefrompng')) {
$img = imagecreatefrompng($filename);
imagesavealpha($img, true);
// save alphablending setting (important)
$this->setImageResource($img);
}
break;
}
}
parent::__construct();
$this->quality = $this->config()->default_quality;
$this->interlace = $this->config()->image_interlace;
}
示例6: __construct
public function __construct($content)
{
if (extension_loaded('tidy')) {
// using the tidy php extension
$tidy = new tidy();
$tidy->parseString($content, array('output-xhtml' => true, 'numeric-entities' => true, 'wrap' => 0), 'utf8');
$tidy->cleanRepair();
$tidy = str_replace('xmlns="http://www.w3.org/1999/xhtml"', '', $tidy);
$tidy = str_replace(' ', '', $tidy);
} elseif (@shell_exec('which tidy')) {
// using tiny through cli
$CLI_content = escapeshellarg($content);
$tidy = `echo {$CLI_content} | tidy --force-output 1 -n -q -utf8 -asxhtml -w 0 2> /dev/null`;
$tidy = str_replace('xmlns="http://www.w3.org/1999/xhtml"', '', $tidy);
$tidy = str_replace(' ', '', $tidy);
} else {
// no tidy library found, hence no sanitizing
$tidy = $content;
}
$this->simpleXML = @simplexml_load_string($tidy, 'SimpleXMLElement', LIBXML_NOWARNING);
if (!$this->simpleXML) {
throw new Exception('CSSContentParser::__construct(): Could not parse content.' . ' Please check the PHP extension tidy is installed.');
}
parent::__construct();
}
示例7: __construct
/**
* Constructor
*
*/
public function __construct()
{
parent::__construct();
App::uses('AclNode', 'Model');
$this->Aro = ClassRegistry::init(array('class' => 'Aro', 'alias' => 'Aro'));
$this->Aco = ClassRegistry::init(array('class' => 'Aco', 'alias' => 'Aco'));
}
示例8: __construct
/**
*
* @name __construct
* @param MariaBlockChain\MariaBlockChain $blockchain the scope
* @since 0.1.0
* @return object
*/
public function __construct($blockchain)
{
if (!isset($this->_cachePrefix)) {
$this->_cachePrefix = "";
}
parent::__construct($blockchain);
}
示例9:
/**
* __constructor
*
* @param FormField $field The field we're validating against
*/
function __construct(FormField $field = null) {
if ($field) {
$this->setField($field);
}
$this->setMessageType($this->getRuleName());
parent::__construct();
}
示例10: __construct
/**
* SshKey constructor.
* @param array $json
* @param array $headers
* @param int $status
*/
public function __construct(array $json = [], array $headers = [], $status = 200)
{
parent::__construct($json, $headers, $status);
$this->setFromJson('id');
$this->setFromJson('title');
$this->setFromJson('content');
}
示例11: __construct
/**
* WebhookRequest constructor.
* @param array $json
* @param array $headers
* @param int $status
*/
public function __construct(array $json = [], array $headers = [], $status = 200)
{
parent::__construct($json, $headers, $status);
$this->setFromJson('postDate', 'post_date');
$this->setFromJson('responseStatus', 'response_status');
$this->setFromJson('body');
}
示例12: array
/**
* Constructor
*
* @param array $options optional load object properties
*/
function __construct($options = array()) {
parent::__construct();
if (empty($options['name'])) {
$this->name = preg_replace('/schema$/i', '', get_class($this));
}
if (!empty($options['plugin'])) {
$this->plugin = $options['plugin'];
}
if (strtolower($this->name) === 'cake') {
$this->name = Inflector::camelize(Inflector::slug(Configure::read('App.dir')));
}
if (empty($options['path'])) {
if (is_dir(CONFIGS . 'schema')) {
$this->path = CONFIGS . 'schema';
} else {
$this->path = CONFIGS . 'sql';
}
}
$options = array_merge(get_object_vars($this), $options);
$this->_build($options);
}
示例13: strtotime
function __construct($arr = null, $arr_pre = "t_")
{
parent::__construct($arr, $arr_pre);
$this->date = strtotime($this->date);
$this->time = TrainingLog::getSecondsFromFormat($this->time);
//$this->route = new Route($arr);
}
示例14: __construct
/**
* Constructor
*
* @param ObjectConfig $config An optional ObjectConfig object with configuration options.
*/
public function __construct(ObjectConfig $config)
{
//Bypass DatabaseRowAbstract constructor to prevent data from being added twice
Object::__construct($config);
//Set the table identifier
$this->_table = $config->table;
// Set the table identifier
if (isset($config->identity_column)) {
$this->_identity_column = $config->identity_column;
}
// Reset the row
$this->reset();
//Set the status
if (isset($config->status)) {
$this->setStatus($config->status);
}
// Set the row data
if (isset($config->data)) {
$this->setData($config->data->toArray(), $this->isNew());
}
//Set the status message
if (!empty($config->status_message)) {
$this->setStatusMessage($config->status_message);
}
}
示例15: list
function __construct($filename = null)
{
// If we're working with image resampling, things could take a while. Bump up the time-limit
increase_time_limit_to(300);
if ($filename) {
// We use getimagesize instead of extension checking, because sometimes extensions are wrong.
list($width, $height, $type, $attr) = getimagesize($filename);
switch ($type) {
case 1:
if (function_exists('imagecreatefromgif')) {
$this->setGD(imagecreatefromgif($filename));
}
break;
case 2:
if (function_exists('imagecreatefromjpeg')) {
$this->setGD(imagecreatefromjpeg($filename));
}
break;
case 3:
if (function_exists('imagecreatefrompng')) {
$this->setGD(imagecreatefrompng($filename));
}
break;
}
}
$this->quality = self::$default_quality;
parent::__construct();
}