本文整理汇总了PHP中Nette\Object类的典型用法代码示例。如果您正苦于以下问题:PHP Object类的具体用法?PHP Object怎么用?PHP Object使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Object类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: register
/**
* Registers all object's events to matching methods
*
* @param vBuilder\Object $object
*/
public function register(Nette\Object $object)
{
$rc = $object->getReflection();
$rc2 = $this->getReflection();
$publicProperties = $rc->getProperties(\ReflectionProperty::IS_PUBLIC);
foreach ($publicProperties as $property) {
$eventName = $property->getName();
if (!preg_match('#^on[A-Z]#', $eventName)) {
continue;
}
if ($rc2->hasMethod($eventName)) {
array_push($object->{$eventName}, array($this, $eventName));
}
}
}
开发者ID:vbuilder,项目名称:framework,代码行数:20,代码来源:EventListener.php
示例2: register
/**
* Register TextInputCustomLabel
* @param string $control_name string
* @return void
*/
public static function register($control_name = 'addTextCustomLabel')
{
Nette\Object::extensionMethod('Nette\\Forms\\Container::' . $control_name, function ($form, $name, $label = NULL, array $items = NULL) {
$control = new self($label, $items);
return $form[$name] = $control;
});
}
开发者ID:ublaboo,项目名称:controls,代码行数:12,代码来源:TextInputCustomLabel.php
示例3: register
public static function register($controlName = 'addMultiSelectFileChoicer')
{
if (!is_string($controlName)) {
throw new Exception(sprintf('Control name must be string, %s given', gettype($controlName)));
}
Nette\Object::extensionMethod('Nette\\Forms\\Container::' . $controlName, function ($form, $name, IManager $mediaManager, $namespace, $label = null, $withPrimary = true) {
return $form[$name] = new \vojtabiberle\MediaStorage\Bridges\Nette\Forms\Controls\MultiSelectFileChoicer($mediaManager, $namespace, $label, $withPrimary);
});
}
开发者ID:vojtabiberle,项目名称:MediaStorage,代码行数:9,代码来源:MultiSelectFileChoicer.php
示例4: register
/**
* Register NotTranslatableSelectBox
* @param string $control_name string
* @return void
*/
public static function register($control_name = 'addNotTranslatableSelect')
{
Nette\Object::extensionMethod('Nette\\Forms\\Container::' . $control_name, function ($form, $name, $label = NULL, array $items = NULL, $size = NULL) {
$control = new self($label, $items);
if ($size > 1) {
$control->setAttribute('size', (int) $size);
}
return $form[$name] = $control;
});
}
开发者ID:ublaboo,项目名称:controls,代码行数:15,代码来源:NotTranslatableSelectBox.php
示例5: register
/**
* @param string $controlName
* @throws ImageStorageException
*/
public static function register($controlName = 'addMultiImageUpload')
{
if (!is_string($controlName)) {
throw new ImageStorageException(sprintf('Control name must be a string, %s given', gettype($controlName)));
}
Object::extensionMethod(Container::class . '::' . $controlName, function ($form, $name, $label = NULL, $namespace = NULL) {
$control = new self($label);
$control->setNamespace($namespace);
return $form[$name] = $control;
});
}
开发者ID:webchemistry,项目名称:images,代码行数:15,代码来源:MultiUpload.php
示例6: __call
public function __call($name, $args = [])
{
if (method_exists($this->acl, $name)) {
return call_user_func_array([$this->acl, $name], $args);
}
return parent::__call($name, $args);
}
开发者ID:zaxcms,项目名称:framework,代码行数:7,代码来源:Acl.php
示例7: __call
/**
* Allows calling $column->icon() instead of $column->setIcon (Same for title, class, ...)
* @param string $name
* @param array $args
* @return mixed
*/
public function __call($name, $args)
{
$method_setter = 'set' . ucfirst($name);
if (method_exists($this, $method_setter)) {
return Nette\Utils\Callback::invokeArgs([$this, $method_setter], $args);
}
parent::__call($name, $args);
}
开发者ID:JakubKontra,项目名称:datagrid,代码行数:14,代码来源:Object.php
示例8: elseif
/**
* @param string
* @return string|NULL
*/
public function &__get($name)
{
if (strtolower($name) === 'info') {
return $this->info;
} elseif (array_key_exists($name, $this->info)) {
return $this->info[$name];
}
return parent::__get($name);
}
开发者ID:milo,项目名称:github-api-nette,代码行数:13,代码来源:User.php
示例9:
public function &__get($name)
{
$service = $this->getService($name, false);
if ($service) {
return $service;
}
$object = parent::__get($name);
return $object;
}
开发者ID:pipaslot,项目名称:rest,代码行数:9,代码来源:AContext.php
示例10:
public function &__get($name)
{
$val = \strtoupper($name);
if (\defined(self::INFO . $val)) {
$a = $this->getInfo(constant(self::INFO . $val));
return $a;
}
return parent::__get($name);
}
开发者ID:rokerkony,项目名称:Exchange,代码行数:9,代码来源:CUrl.php
示例11: __isset
/**
* @param string $name
* @return bool
*/
public function __isset($name)
{
$isset = parent::__isset($name);
if ($isset) {
return TRUE;
}
$data = $this->getData();
return isset($data[$name]);
}
开发者ID:lucien144,项目名称:Restful,代码行数:13,代码来源:Input.php
示例12:
/**
* Returns user data value.
* @param string property name
* @return mixed
*/
public function &__get($key)
{
if (parent::__isset($key)) {
return parent::__get($key);
} else {
$data = $this->data->toArray();
return $data[$key];
}
}
开发者ID:angelcam,项目名称:angelcam-sdk-php,代码行数:14,代码来源:Identity.php
示例13: __call
public function __call($methodName, $args)
{
if (preg_match('|.*getModel([a-zA-Z0-9]+).*|', $methodName, $mtch)) {
if (class_exists('Model\\' . $mtch[1] . 'Model')) {
return $this->modelLoader->loadModel($mtch[1] . 'Model');
}
} else {
return parent::__call($methodName, $args);
}
}
开发者ID:jurasm2,项目名称:bubo,代码行数:10,代码来源:BaseModel.php
示例14: __call
/**
* @param string $name
* @param array $args
* @return mixed
*/
public function __call($name, $args)
{
$function = 'newrelic_' . self::convertCamelCaseToUnderscore($name);
if (!extension_loaded('newrelic')) {
return FALSE;
}
if (!function_exists($function)) {
return parent::__call($name, $args);
}
return call_user_func_array($function, $args);
}
开发者ID:damejidlo,项目名称:newrelic,代码行数:16,代码来源:Client.php
示例15: __call
public function __call($name, $args)
{
if (preg_match('~^create(Select|Update|Delete|Insert)$~', $name, $m)) {
#query object factory
$class = "Flunorette\\Queries\\{$m[1]}Query";
$queryContext = new QueryContext(reset($args), $this);
return new $class($queryContext);
}
return parent::__call($name, $args);
}
开发者ID:icaine,项目名称:flunorette,代码行数:10,代码来源:Connection.php
示例16: __call
/**
* Call to undefined method.
*
* @param string method name
* @param array arguments
* @return mixed
* @throws Nette\MemberAccessException
*/
public function __call($name, $args)
{
$function = 'image' . $name;
if (function_exists($function)) {
foreach ($args as $key => $value) {
if ($value instanceof self) {
$args[$key] = $value->getImageResource();
} elseif (is_array($value) && isset($value['red'])) {
// rgb
$args[$key] = imagecolorallocatealpha($this->image, $value['red'], $value['green'], $value['blue'], $value['alpha']);
}
}
array_unshift($args, $this->image);
$res = call_user_func_array($function, $args);
return is_resource($res) && get_resource_type($res) === 'gd' ? $this->setImageResource($res) : $res;
}
return parent::__call($name, $args);
}
开发者ID:VasekPurchart,项目名称:khanovaskola-v3,代码行数:26,代码来源:Image.php
示例17: __isset
/**
* Is property defined?
* @param string property name
* @return bool
*/
public function __isset($key)
{
return isset($this->data[$key]) || parent::__isset($key);
}
开发者ID:eduardobenito10,项目名称:jenkins-php-quickstart,代码行数:9,代码来源:Identity.php
示例18: __unset
public function __unset($name)
{
if (parent::__isset($name)) {
parent::__unset($name);
} else {
unset($this->data->{$name});
}
}
开发者ID:redwormik,项目名称:fakeorm,代码行数:8,代码来源:Entity.php
示例19: __call
/**
* Call a template run-time helper. Do not call directly.
* @param string helper name
* @param array arguments
* @return mixed
*/
public function __call($name, $args)
{
$lname = strtolower($name);
if (!isset($this->helpers[$lname])) {
foreach ($this->helperLoaders as $loader) {
$helper = Callback::invoke($loader, $lname);
if ($helper) {
$this->registerHelper($lname, $helper);
return Callback::invokeArgs($this->helpers[$lname], $args);
}
}
return parent::__call($name, $args);
}
return Callback::invokeArgs($this->helpers[$lname], $args);
}
开发者ID:nette,项目名称:deprecated,代码行数:21,代码来源:Template.php
示例20: __call
public function __call($method, $args)
{
if (isset($this->proxyMethods[strtolower($method)])) {
if (FindByParserHelper::parse($method, $args)) {
return call_user_func([$this, $method], $args);
}
$result = call_user_func_array([$this->mapper, $method], $args);
if (!($result instanceof ICollection || $result instanceof IEntity || $result === NULL)) {
$result = $this->mapper->toCollection($result);
}
return $result;
} else {
return parent::__call($method, $args);
}
}
开发者ID:Vyki,项目名称:orm,代码行数:15,代码来源:Repository.php
注:本文中的Nette\Object类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论