本文整理汇总了PHP中AbstractObject::__get方法的典型用法代码示例。如果您正苦于以下问题:PHP AbstractObject::__get方法的具体用法?PHP AbstractObject::__get怎么用?PHP AbstractObject::__get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AbstractObject
的用法示例。
在下文中一共展示了AbstractObject::__get方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __get
public function __get($name)
{
switch ($name) {
case 'name':
return $this->description;
}
return parent::__get($name);
}
示例2: __get
public function __get($name)
{
switch ($name) {
case 'shortname':
$value = $this->get('name');
foreach (array('.vdi', '.vmdk') as $suffix) {
if (strrpos($value, $suffix) === strlen($value) - strlen($suffix)) {
return substr($value, 0, strrpos($value, $suffix));
}
}
return $value;
case 'time':
if ($this->has('path')) {
return filemtime($this->get('path'));
}
return 0;
case 'autoreset':
return $this->get('autoreset', 'off');
}
return parent::__get($name);
}
示例3: __get
public function __get($name)
{
switch ($name) {
// booleans
case 'bioslogofadein':
case 'bioslogofadeout':
case 'acpi':
case 'ioapic':
case 'pae':
case 'hpet':
case 'rtcuseutc':
case 'hwvirtex':
// case 'hwvirtexexcl':
// case 'hwvirtexexcl':
case 'nestedpaging':
case 'largepages':
case 'pagefusion':
case 'vtxvpid':
case 'synthcpu':
case 'accelerate2dvideo':
case 'accelerate3d':
case 'usb':
case 'usbehci':
case 'vrde':
return $this->get($name, 'off') == 'on';
// integers
// integers
case 'cpus':
case 'memory':
case 'vram':
case 'bioslogodisplaytime':
case 'biossystemtimeoffset':
return intval($this->get($name, '0'));
// storage controllers
// storage controllers
case 'storage0':
case 'storage1':
case 'storage2':
case 'storage3':
case 'storage4':
case 'storage5':
case 'storage6':
case 'storage7':
$i = substr($name, 7);
if (!$this->has('storagecontrollername' . $i)) {
break;
}
$name = $this->get('storagecontrollername' . $i, '');
$ports = intval($this->get('storagecontrollerportcount' . $i, '0'));
$maxdevices = intval($this->get('storagecontrollermaxdeviceperport' . $i, '0'));
$devices = array();
for ($j = 0; $j < $ports; $j++) {
for ($k = 0; $k < $maxdevices; $k++) {
$slot = $name . '-' . $j . '-' . $k;
if (!$this->has($slot)) {
continue;
}
if ($this->endsWith($slot, '.vdi') || $this->endsWith($slot, '.vmdk')) {
$devices[$j][$k] = Repository::getHdd($this->get($slot));
} else {
if ($this->get($slot) == 'emptydrive') {
$devices[$j][$k] = new DVD();
} else {
$devices[$j][$k] = Repository::getDvd($this->get($slot));
}
}
}
}
return array('name' => $name, 'type' => $this->get('storagecontrollertype' . $i, 'none'), 'instance' => intval($this->get('storagecontrollerinstance' . $i, '0')), 'ports' => array('count' => $ports, 'min' => intval($this->get('storagecontrollerminportcount' . $i, '0')), 'max' => intval($this->get('storagecontrollermaxportcount' . $i, '0')), 'maxdevices' => $maxdevices), 'devices' => $devices);
// fdd controllers
// fdd controllers
case 'fd0':
case 'fd1':
$slot = 'FLOPPY-0-0';
switch ($name) {
case 'fd0':
$slot = 'FLOPPY-0-0';
break;
case 'fd1':
$slot = 'FLOPPY-0-1';
break;
}
if (!$this->has($slot)) {
break;
}
if ($this->get($slot) == 'emptydrive') {
return new FDD();
}
return Repository::getFdd($this->get($slot));
// ide controllers
// ide controllers
case 'ide0':
case 'ide1':
case 'ide2':
case 'ide3':
$slot = 'IDE-0-0';
switch ($name) {
case 'ide0':
$slot = 'IDE-0-0';
break;
//.........这里部分代码省略.........