本文整理汇总了PHP中ReflectionClass::getStaticPropertyValue方法的典型用法代码示例。如果您正苦于以下问题:PHP ReflectionClass::getStaticPropertyValue方法的具体用法?PHP ReflectionClass::getStaticPropertyValue怎么用?PHP ReflectionClass::getStaticPropertyValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ReflectionClass
的用法示例。
在下文中一共展示了ReflectionClass::getStaticPropertyValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __toString
public function __toString()
{
$to_string = "";
foreach ($this->supported_gateways as $gateway) {
$ref = new ReflectionClass($gateway);
$to_string .= $ref->getStaticPropertyValue('display_name') . " - " . $ref->getStaticPropertyValue('homepage_url') . " " . "[" . join(", ", $ref->getStaticPropertyValue('supported_countries')) . "]\n";
}
return $to_string;
}
示例2: testing
static function testing()
{
$ref = new ReflectionClass('Test');
foreach (array('pub', 'pro', 'pri') as $name) {
try {
var_dump($ref->getStaticPropertyValue($name));
var_dump($ref->getStaticPropertyValue($name));
$ref->setStaticPropertyValue($name, 'updated');
var_dump($ref->getStaticPropertyValue($name));
} catch (Exception $e) {
echo "EXCEPTION\n";
}
}
}
示例3: getStaticVal
public static function getStaticVal($className, $propName, $returnArr = true)
{
//----------------------------------------------------------
//init var
//----------------------------------------------------------
$arr = array();
//----------------------------------------------------------
if (!is_null($constant = eval("return " . $className . "::\$" . $propName . ";"))) {
$arr['constant'] = $constant;
}
//----------------------------------------------------------
$class = new ReflectionClass($className);
//----------------------------------------------------------
try {
$static = $class->getStaticPropertyValue(str_replace("\$", "", $propName));
$arr['static'] = $static;
} catch (Exception $e) {
//echo 'Caught exception: ', $e->getMessage(), "\n";
}
//----------------------------------------------------------
if (sizeof($arr) == 1 || !$returnArr) {
reset($arr);
return current($arr);
} else {
return $arr;
}
}
示例4: features
public function features()
{
$max = array_map(function ($a) {
$gateway = "AktiveMerchant\\Billing\\Gateways\\" . $a;
return strlen($gateway::$display_name);
}, $this->supported_gateways);
$max = max($max) + 1;
$max_column = 15;
$print = "";
$print .= "[1;36mName" . str_repeat(' ', $max - 4);
foreach ($this->actions as $action) {
$print .= $action . str_repeat(' ', $max_column - strlen($action));
}
$print .= "[0m" . PHP_EOL;
foreach ($this->supported_gateways as $gateway) {
$ref = new \ReflectionClass('AktiveMerchant\\Billing\\Gateways\\' . $gateway);
$display_name = $ref->getStaticPropertyValue('display_name');
$length = $max - strlen($display_name);
$print .= "[1;35m" . $display_name . "[0m" . str_repeat(' ', $length > 0 ? $length : 0);
foreach ($this->actions as $action) {
if ($ref->hasMethod($action)) {
$print .= "[1;32m O[0m" . str_repeat(' ', $max_column - 2);
} else {
$print .= "[1;31m X[0m" . str_repeat(' ', $max_column - 2);
}
}
$print .= PHP_EOL;
}
echo $print;
}
示例5: main
public function main()
{
$plugin = $this->plugin->getAbsolutePath();
$infoFile = $plugin . '/' . self::INFO_FILE;
if (!file_exists($infoFile)) {
$message = sprintf('Unable to read plugin_info.php file at "%s"', $plugin);
throw new BuildException($message);
}
require_once $infoFile;
$class = new ReflectionClass('plugin_info');
try {
$value = $class->getStaticPropertyValue($this->key);
} catch (Exception $e) {
$message = sprintf('Unable to read property with "%s"', $this->key);
throw new BuildException($message, $e);
}
if (!is_string($value) && !is_int($value) && !is_float($value)) {
$value = json_encode($value);
}
if ($this->to != '') {
$this->project->setProperty($this->to, $value);
} else {
$this->log($value);
}
}
示例6: test_RemoveState
public function test_RemoveState()
{
$course = new ReflectionClass('CourseP');
try {
$course->getStaticPropertyValue('$OneOff');
$this->fail("OneOff should be removed");
} catch (Exception $e) {
}
}
示例7: valueOf
/**
* Retrieve a TransactionTypeDescription by its name
*
* @param string name
* @return remote.reflect.TransactionTypeDescription
*/
public static function valueOf($name)
{
try {
$r = new ReflectionClass(__CLASS__);
return $r->getStaticPropertyValue($name);
} catch (ReflectionException $e) {
throw new IllegalArgumentException($name . ': ' . $e->getMessage());
}
}
示例8: init
public function init()
{
$r = new ReflectionClass($this);
$o = $r->getStaticPropertyValue("octave");
if ($o->init() === false) {
$this->assertEquals("", $o->lastError);
return false;
}
return $o;
}
示例9: testGetStaticPropertyValue
/**
*/
public function testGetStaticPropertyValue()
{
$prop = new ReflectionProperty('test');
$propStatic = new ReflectionProperty('testStatic');
$this->object->addProperty($prop);
$this->object->addProperty($propStatic);
$propStatic->setDefaultValue('testValue');
$propStatic->setStatic(true);
$this->assertFalse($this->object->getStaticPropertyValue('test'));
$this->assertEquals('testValue', $this->object->getStaticPropertyValue('testStatic'));
}
示例10: getValue
private function getValue()
{
if ($this->isPublic) {
$refl = new ReflectionClass($this->className);
$val = $refl->getStaticPropertyValue($this->propertyName);
} else {
$val = call_user_func(array($this->className, yTest_AddPublicAccessors::getGetterName($this->className, $this->propertyName)));
}
yTest_debugCC('getValue ' . $this->className . '::' . $this->propertyName . ' = ' . var_export($val, true));
return $val;
}
示例11: getDefinition
public static function getDefinition()
{
$class = get_called_class();
//get_class($class);
$reflection = new ReflectionClass($class);
if (!$reflection->hasProperty('definition')) {
return false;
}
$definition = $reflection->getStaticPropertyValue('definition');
//echo "<pre>";print_r($definition);die;
}
示例12: smarty_function_psureport_link
function smarty_function_psureport_link($params, &$smarty)
{
if (!isset($params['wrap'])) {
if ($params['include']) {
$params['wrap'] = '<li>%s %s</li>';
} else {
$params['wrap'] = '<li>%s</li>';
}
//end else
}
//end if
$link = '';
if ($params['report']) {
$report = 'PSUReport_' . str_replace('-', '_', $params['report']);
@(include_once $GLOBALS['BASE_DIR'] . '/includes/reports/' . $report . '.class.php');
if (!class_exists($report)) {
return '';
}
//end if
$reflection = new ReflectionClass($report);
try {
$name = $reflection->getStaticPropertyValue('name');
if ($reflection->hasMethod('authZ')) {
$authz = call_user_func(array($report, 'authZ'));
} else {
$authz = call_user_func('PSUReport', 'authZ');
}
//end else
} catch (Exception $err) {
$report = new $report('reportlink');
$name = $report->name;
$authz = $report->authZ();
}
//end catch
if ($authz) {
$link = '<a href="' . $GLOBALS['BASE_URL'] . '/report/' . str_replace('_', '-', $params['report']) . '/';
if ($params['query_string']) {
$link .= '?' . $params['query_string'];
}
//end if
$link .= '">' . ($params['name'] ? $params['name'] : $name) . '</a>';
if ($params['include']) {
$link = sprintf($params['wrap'], $link, $params['include']);
} else {
$link = sprintf($params['wrap'], $link);
}
//end else
}
//end if
}
//end if
unset($report);
return $link;
}
示例13: array
function get_modules_to_load_for($product_id)
{
$modules = array();
$obj = C_Component_Registry::get_instance()->get_product($product_id);
try {
$klass = new ReflectionClass($obj);
if ($klass->hasMethod('get_modules_to_load')) {
$modules = $obj->get_modules_to_load();
} elseif ($klass->hasProperty('modules')) {
$modules = $klass->getStaticPropertyValue('modules');
}
if (!$modules && $klass->hasMethod('define_modules')) {
$modules = $obj->define_modules();
if ($klass->hasProperty('modules')) {
$modules = $klass->getStaticPropertyValue('modules');
}
}
} catch (ReflectionException $ex) {
// Oh oh...
}
return $modules;
}
示例14: __construct
public function __construct($id = '')
{
parent::__construct();
$this->class = strtolower(get_class($this));
$obj = new ReflectionClass($this->class);
$this->data = $obj->getStaticPropertyValue('definitation');
if ($id != '') {
$this->where = array($this->data['primary'] => $id);
$this->order_by = array($this->data['primary'] => 'desc');
$this->return = 1;
$this->getData = $this->select();
}
}
示例15: Pman
static function cli_opts()
{
$ret = self::$cli_opts;
$ff = HTML_FlexyFramework::get();
$a = new Pman();
$mods = $a->modulesList();
foreach ($mods as $m) {
$fd = $ff->rootDir . "/Pman/{$m}/UpdateDatabase.php";
if (!file_exists($fd)) {
continue;
}
require_once $fd;
$cls = new ReflectionClass('Pman_' . $m . '_UpdateDatabase');
$ret = array_merge($ret, $cls->getStaticPropertyValue('cli_opts'));
}
return $ret;
}