当前位置: 首页>>代码示例>>PHP>>正文


PHP ReflectionClass::getStaticPropertyValue方法代码示例

本文整理汇总了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;
 }
开发者ID:nickbabenko,项目名称:fuel-aktivemerchant,代码行数:9,代码来源:GatewaySupport.php

示例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";
         }
     }
 }
开发者ID:gleamingthecube,项目名称:php,代码行数:14,代码来源:ext_reflection_tests_006.php

示例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;
     }
 }
开发者ID:awwthentic1234,项目名称:hey,代码行数:27,代码来源:ClassUtil.php

示例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;
 }
开发者ID:bluetechy,项目名称:Aktive-Merchant,代码行数:30,代码来源:GatewaySupport.php

示例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);
     }
 }
开发者ID:zenith6,项目名称:eccube-zeclib,代码行数:25,代码来源:PluginInfoGetTask.php

示例6: test_RemoveState

 public function test_RemoveState()
 {
     $course = new ReflectionClass('CourseP');
     try {
         $course->getStaticPropertyValue('$OneOff');
         $this->fail("OneOff should be removed");
     } catch (Exception $e) {
     }
 }
开发者ID:VictoriaLacroix,项目名称:umple,代码行数:9,代码来源:MixinTest.php

示例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());
     }
 }
开发者ID:melogamepay,项目名称:xp-framework,代码行数:15,代码来源:TransactionTypeDescription.class.php

示例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;
 }
开发者ID:gutza,项目名称:octave-daemon,代码行数:10,代码来源:common_phpunit_test.php

示例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'));
 }
开发者ID:neiluJ,项目名称:Documentor,代码行数:13,代码来源:ReflectionClassTest.php

示例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;
 }
开发者ID:rsaugier,项目名称:ytest,代码行数:11,代码来源:yTest_SetStaticProperty.php

示例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;
 }
开发者ID:agwan786,项目名称:codesmarty,代码行数:11,代码来源:MY_Model.php

示例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;
}
开发者ID:AholibamaSI,项目名称:plymouth-webapp,代码行数:54,代码来源:function.psureport_link.php

示例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;
 }
开发者ID:albinmartinsson91,项目名称:ux_blog,代码行数:22,代码来源:class.nextgen_product_installer.php

示例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();
     }
 }
开发者ID:agwan786,项目名称:framework,代码行数:13,代码来源:objectmodel.php

示例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;
 }
开发者ID:roojs,项目名称:Pman.Core,代码行数:17,代码来源:UpdateDatabase.php


注:本文中的ReflectionClass::getStaticPropertyValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。