本文整理汇总了PHP中ReflectionObject::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP ReflectionObject::getName方法的具体用法?PHP ReflectionObject::getName怎么用?PHP ReflectionObject::getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ReflectionObject
的用法示例。
在下文中一共展示了ReflectionObject::getName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __toString
public function __toString()
{
$str = '';
$reflection_object = new ReflectionObject($this);
$str .= 'Start: ' . $reflection_object->getName() . "\n";
$file_name_formatter = new Formatting_FileName($this->get_name());
$str .= $file_name_formatter->get_pretty_name();
$str .= 'End: ' . $reflection_object->getName() . "\n";
return $str;
}
示例2: register
/**
* @param $object
* @return $this
*/
public function register($object)
{
/** @var ReflectionObject $reflectionClass */
$reflectionObject = new \ReflectionObject($object);
if (!$this->objectRegistered($reflectionObject->getName())) {
$this->objects[$reflectionObject->getName()] = $object;
}
//injection
$this->resolveInjection($object);
return $this;
}
示例3: generate
public function generate($obj)
{
$refObj = new \ReflectionObject($obj);
if ($refObj->implementsInterface("\\hvasoares\\phplombok\\GeneratedClass")) {
return $obj;
}
$oldClassName = array_pop(explode("\\", $refObj->getName()));
$newClassName = $oldClassName . (time() + rand());
if (!$this->c->classExists(get_class($obj))) {
$this->c->generateAndLoadClassFile(get_class($obj), $this->t->generateInheritedClass($newClassName, $obj));
$this->f->configure($refObj->getName(), $refObj->getNamespaceName() . "\\" . $newClassName);
}
return $this->f->get($obj);
}
示例4: __toString
public function __toString()
{
$str = '';
$reflection_object = new ReflectionObject($this);
$str .= 'Start: ' . $reflection_object->getName() . "\n";
$str .= "\$this->mysql_user:\n";
$str .= "\n";
$str .= $this->mysql_user->__toString();
$str .= "\n";
$str .= "\$this->name:\n";
$str .= $this->name;
$str .= "\n";
$str .= 'End: ' . $reflection_object->getName() . "\n";
return $str;
}
示例5: serializeObject
function serializeObject($object)
{
if ($object instanceof Exception) {
echo '<error>';
$this->writeTag('code', $object->getCode());
$this->writeTag('message', $object->getMessage());
echo '</error>';
} else {
// get object class
$reflectObject = new ReflectionObject($object);
$class = $reflectObject->getName();
// write the object type
$this->writeTag('objectType', $class);
// load class reflection
$typeReflector = KalturaTypeReflectorCacher::get($class);
if (!$typeReflector) {
echo '<error>';
$this->writeTag('message', 'Type reflector not found');
echo '</error>';
return;
}
$properties = $typeReflector->getProperties();
foreach ($properties as $property) {
$name = $property->getName();
$value = $object->{$name};
if ($this->_ignoreNull === true && $value === null) {
continue;
}
echo '<' . $name . '>';
$this->serialize($value);
echo '</' . $name . '>';
}
}
}
示例6: processPreRun
/**
* Processes the handler pre-run.
*
* @param Glimpse $glimpse The current Glimpse instance.
* @return string The rendered handler.
*/
public function processPreRun(Glimpse $glimpse)
{
if (!isset($_REQUEST['glimpseFile']) || $_REQUEST['glimpseFile'] != 'Config') {
return;
}
echo "<!DOCTYPE html><html><head><link rel=\"shortcut icon\" href=\"http://getglimpse.com/favicon.ico\" />";
echo "<style>body { margin: 0px; text-align:center; font-family:\"avante garde\", \"Century Gothic\", Serif; font-size:0.8em; line-height:1.4em; } .important { font-size:1.4em; } .content { position:absolute; left:50%; margin-left:-450px; text-align:left; width:900px; } h1, h2, h3, h4 { line-height:1.2em; font-weight:normal; } h1 { font-size:4em; } h2 { font-size:2.5em; } h3 { font-size:2em; } .logo { font-family: \"TitilliumMaps\", helvetica, sans-serif; margin:0 0 40px; position:relative; background: url(?glimpseFile=logo.png) -10px -15px no-repeat; padding: 0 0 0 140px; } .logo h1 { color:transparent; } .logo div { font-size:1.5em; margin: 25px 0 0 -10px; } .logo blockquote { width:350px; position:absolute; right:0; top:10px; } blockquote { font: 1.2em/1.6em \"avante garde\", \"Century Gothic\", Serif; width: 400px; background: url(http://getglimpse.com/Content/close-quote.gif) no-repeat right bottom; padding-left: 18px; text-indent: -18px; } .footer { text-align:center; margin-bottom:30px; } blockquote:first-letter { background: url(http://getglimpse.com/Content/open-quote.gif) no-repeat left top; padding-left: 18px; font: italic 1.4em \"avante garde\", \"Century Gothic\", Serif; } .myButton{width:175px; line-height: 1.2em; margin:0.25em 0; text-align:center; -moz-box-shadow:inset 0 1px 0 0 #fff;-webkit-box-shadow:inset 0 1px 0 0 #fff;box-shadow:inset 0 1px 0 0 #fff;background:-webkit-gradient(linear,left top,left bottom,color-stop(0.05,#ededed),color-stop(1,#dfdfdf));background:-moz-linear-gradient(center top,#ededed 5%,#dfdfdf 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ededed',endColorstr='#dfdfdf');background-color:#ededed;-moz-border-radius:6px;-webkit-border-radius:6px;border-radius:6px;border:1px solid #dcdcdc;display:inline-block;color:#777;font-family:arial;font-size:24px;padding:10px 41px;text-decoration:none;text-shadow:1px 1px 0 #fff}.myButton:hover{background:-webkit-gradient(linear,left top,left bottom,color-stop(0.05,#dfdfdf),color-stop(1,#ededed));background:-moz-linear-gradient(center top,#dfdfdf 5%,#ededed 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#dfdfdf',endColorstr='#ededed');background-color:#dfdfdf}.myButton:active{position:relative;top:1px}</style>";
echo "<title>Glimpse Config</title>";
echo "<script>function toggleCookie(){var mode = document.getElementById('glimpseState'); if (mode.innerHTML==='On'){mode.innerHTML='Off';document.cookie='glimpseState=Off; path=/;';}else{mode.innerHTML='On';document.cookie='glimpseState=On; path=/;';}}</script>";
echo "<head><body>";
if (isset($_COOKIE["glimpseState"]) && $_COOKIE["glimpseState"] == 'On') {
echo "<div style='background-color: #B5CDA4; border-bottom: thin solid #486E25; color: #486E25; padding: 6px; font-size: 1.2em; position: fixed; width: 100%; z-index: 499;'><strong>Glimpse is now ON</strong> - When you <a href='javascript:history.back(1);'>go back</a> to your site you should see Glimpse at the bottom right of the page.</div>";
}
echo "<div class=\"content\"><div class=\"logo\"><blockquote>What Firebug is for the client, Glimpse does for the server... in other words, a client side Glimpse into whats going on in your server.</blockquote><h1>Glimpse</h1><div>A client side Glimpse to your server</div></div>";
echo "<table width=\"100%\"><tr align=\"center\"><td width=\"33%\"><a class=\"myButton\" href=\"javascript:(function(){document.cookie='glimpseState=On; path=/; expires=Sat, 01 Jan 2050 12:00:00 GMT;'; window.location.reload();})();\">Turn Glimpse On</a></td><td width=\"34%\"><a class=\"myButton\" href=\"javascript:(function(){document.cookie='glimpseState=; path=/; expires=Sat, 01 Jan 2050 12:00:00 GMT;'; window.location.reload();})();\">Turn Glimpse Off</a></td><td><a class=\"myButton\" href=\"javascript:(function(){document.cookie='glimpseClientName='+ prompt('Client Name?') +'; path=/; expires=Sat, 01 Jan 2050 12:00:00 GMT;'; window.location.reload();})();\">Set Glimpse Session Name</a></td></tr></table>";
echo "<p style=\"text-align:center\">Drag the above button to your favorites bar for quick and easy access to Glimpse.</p>";
echo "<h2>Your Settings:</h2><p>This section tells you how Glimpse sees your requests.</p><ul><li>glimpseState = <label for='gChk' id='glimpseState'>" . (isset($_COOKIE['glimpseState']) && $_COOKIE['glimpseState'] != '' ? $_COOKIE['glimpseState'] : 'Off') . "</label></li></ul>";
echo "<h2>Plugins:</h2><p>This is the list of Glimpse plugins for this web application. Glimpse plugins show up as individual tabs in the Glimpse client. You can stop a plugin from being loaded by setting the <em>plugins-disabled</am> value in <em>glimpse.ini</em>.</p><ul>";
foreach ($glimpse->retrievePlugins() as $plugin) {
$pluginClass = new ReflectionObject($plugin);
echo "<li>" . $pluginClass->getName() . "</li>";
}
echo "</ul>";
echo "<h2>More Info:</h2>";
echo "<div class=\"footer\"><span class=\"important\">For more info see <a href=\"http://getGlimpse.com\" />getGlimpse.com</a></span><br /><br /><img src=\"http://getglimpse.com/content/uservoice-icon.png\" width=\"16\" /> Have a <em>feature</em> request? <a href=\"http://getglimpse.uservoice.com\">Submit the idea</a>. <img src=\"http://getglimpse.com/content/github.gif\" /> Found an <em>error</em>? <a href=\"https://github.com/glimpse/glimpse/issues\">Help us improve</a>. <img src=\"http://getglimpse.com/content/twitter.png\" /> Have a <em>question</em>? <a href=\"http://twitter.com/#search?q=%23glimpse\">Tweet us using #glimpse</a>.</div>";
echo "</body></html>";
$glimpse->endRequest();
}
示例7: setCreationParams
/**
* Set the creation parameters
*
* @param array $creationParams
* @return void
*/
public function setCreationParams(array $creationParams)
{
if (empty($creationParams)) {
return;
}
$r = new ReflectionObject($this);
$class = $r->getName();
$constants = $r->getConstants();
$parameterConstants = array_filter(array_keys($constants), array($this, '_getParameterConstants'));
$supportedParameters = array();
for ($i = 0, $n = count($parameterConstants); $i < $n; $i++) {
$constant = $parameterConstants[$i];
$supportedParameters[] = constant($class . '::' . $constant);
}
if (empty($supportedParameters)) {
return;
}
foreach ($creationParams as $param => $value) {
if (in_array($param, $supportedParameters)) {
$method = 'set' . ucfirst($param);
if (method_exists($this, $method)) {
$this->{$method}($value);
}
}
}
}
示例8: replace
/**
* Replace placeholder one by one
*
* @param string $template hystack
* @param string $value replacement
* @param int $position placeholder position
* @return string
*/
protected function replace($template, $value, $position = 1)
{
$arrayToString = new ArrayToString();
$needle = sprintf($this->configTemplate, (int) $position);
if (strpos($template, $needle) !== false) {
if (is_array($value)) {
$string = $arrayToString->filter($value);
} else {
if ($value instanceof \Exception) {
$obj = new \ReflectionObject($value);
$string = "Exception Object: " . $obj->getName();
$string .= "\n Message: " . $value->getMessage();
$string .= "\n Trace: " . $value->getTraceAsString();
} else {
if (is_object($value)) {
$obj = new \ReflectionObject($value);
$string = "Object with name : " . $obj->getName();
} else {
$string = (string) $value;
}
}
}
return str_replace($needle, $string, $template);
}
return $template;
}
示例9: serializeObject
function serializeObject($object)
{
if ($object instanceof Exception) {
$this->writeStartTag("error");
$this->writeTag("code", $object->getCode());
$this->writeTag("message", $object->getMessage());
$this->writeEndTag("error");
} else {
// get object class
$reflectObject = new ReflectionObject($object);
$class = $reflectObject->getName();
// load class reflection
$typeReflector = KalturaTypeReflectorCacher::get($class);
$properties = $typeReflector->getProperties();
// write the object type
$this->writeTag("objectType", $class);
foreach ($properties as $property) {
$name = $property->getName();
$value = $object->{$name};
if ($this->_ignoreNull === true && $value === null) {
continue;
}
$this->writeStartTag($name);
$this->serialize($value);
$this->writeEndTag($name);
}
}
}
示例10: QcodoHandleException
function QcodoHandleException(Exception $__exc_objException)
{
QApplication::$ErrorFlag = true;
global $__exc_strType;
if (isset($__exc_strType)) {
return;
}
$__exc_objReflection = new ReflectionObject($__exc_objException);
$__exc_strType = "Exception";
$__exc_strMessage = $__exc_objException->getMessage();
$__exc_strObjectType = $__exc_objReflection->getName();
if ($__exc_objException instanceof QDatabaseExceptionBase) {
$__exc_objErrorAttribute = new QErrorAttribute("Database Error Number", $__exc_objException->ErrorNumber, false);
$__exc_objErrorAttributeArray[0] = $__exc_objErrorAttribute;
if ($__exc_objException->Query) {
$__exc_objErrorAttribute = new QErrorAttribute("Query", $__exc_objException->Query, true);
$__exc_objErrorAttributeArray[1] = $__exc_objErrorAttribute;
}
}
$__exc_strFilename = $__exc_objException->getFile();
$__exc_intLineNumber = $__exc_objException->getLine();
$__exc_strStackTrace = trim($__exc_objException->getTraceAsString());
if (ob_get_length()) {
$__exc_strRenderedPage = ob_get_contents();
ob_clean();
}
// Call to display the Error Page (as defined in configuration.inc.php)
require __DOCROOT__ . ERROR_PAGE_PATH;
exit;
}
示例11: getName
public function getName()
{
if (null === $this->name) {
$r = new \ReflectionObject($this);
$this->name = strtolower(preg_replace(['/(.+?)Kernel$/', '/([A-Z]+)([A-Z][a-z])/', '/([a-z\\d])([A-Z])/'], ['\\1', '\\1_\\2', '\\1_\\2'], $r->getName()));
}
return $this->name;
}
示例12: testReaderResultIsCached
public function testReaderResultIsCached()
{
$testCase = new TestsCases\BaseTestCase();
$classInformation = Reader::getClassInformation($testCase);
$reflectionObject = new \ReflectionObject($testCase);
$cacheId = md5("classInformation:" . $reflectionObject->getName());
$this->assertEquals($classInformation, Reader::getFromCache($cacheId));
}
示例13: __toString
public function __toString()
{
$str = '';
$reflection_object = new ReflectionObject($this);
$str .= 'Start: ' . $reflection_object->getName() . "\n";
$str .= "\$this->project_directories:\n";
if (count($this->project_directories) == 0) {
$str .= "<Empty List>\n";
} else {
foreach ($this->project_directories as $p_d) {
$str .= $p_d;
$str .= "\n";
}
}
$str .= 'End: ' . $reflection_object->getName() . "\n";
return $str;
}
开发者ID:saulhoward,项目名称:haddock-cms,代码行数:17,代码来源:HaddockProjectOrganisation_ProjectDirectoryFinder.inc.php
示例14: generateInheritedClass
public function generateInheritedClass($newClassName, $obj)
{
$refObj = new \ReflectionObject($obj);
$innerCode = $this->s->generateCode($newClassName, $obj);
$innerCode = str_replace("\n", "\n\t", $innerCode);
$className = array_pop(explode("\\", $refObj->getName()));
$namespace = $refObj->getNamespaceName();
return "<?php\nnamespace {$namespace};\nclass {$newClassName} extends {$className} implements \\hvasoares\\phplombok\\GeneratedClass{\n\tpublic function setAnnotatedObject(\$object){\n\t\t\$this->annotatedObject = \$object;\n\t\t\$this->reflectedObject = new \\ReflectionObject(\$object);\n\t}\n\n\tpublic function getAnnotatedObject(){\n\t\treturn \$this->annotatedObject;\n\t}\n\t{$innerCode}\t\n}\n?>";
}
示例15: _getExceptionClass
protected function _getExceptionClass()
{
$reflection = new \ReflectionObject($this);
// Elastica\Test\Exception\RuntimeExceptionTest => Elastica\Exception\RuntimeExceptionTest
$name = preg_replace('/^Elastica\\\\Test/', 'Elastica', $reflection->getName());
// Elastica\Exception\RuntimeExceptionTest => Elastica\Exception\RuntimeException
$name = preg_replace('/Test$/', '', $name);
return $name;
}