當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。