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


PHP get_class函数代码示例

本文整理汇总了PHP中get_class函数的典型用法代码示例。如果您正苦于以下问题:PHP get_class函数的具体用法?PHP get_class怎么用?PHP get_class使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_class函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Create

 function Create($proto)
 {
     if ($this->debug) {
         e("SAMConnection.Create(proto={$proto})");
     }
     $rc = false;
     /* search the PHP config for a factory to use...    */
     $x = get_cfg_var('sam.factory.' . $proto);
     if ($this->debug) {
         t('SAMConnection.Create() get_cfg_var() "' . $x . '"');
     }
     /* If there is no configuration (php.ini) entry for this protocol, default it.  */
     if (strlen($x) == 0) {
         /* for every protocol other than MQTT assume we will use XMS    */
         if ($proto != 'mqtt') {
             $x = 'xms';
         } else {
             $x = 'mqtt';
         }
     }
     /* Invoke the chosen factory to create a real connection object...   */
     $x = 'sam_factory_' . $x . '.php';
     if ($this->debug) {
         t("SAMConnection.Create() calling factory - {$x}");
     }
     $rc = (include $x);
     if ($this->debug && $rc) {
         t('SAMConnection.Create() rc = ' . get_class($rc));
     }
     if ($this->debug) {
         x('SAMConnection.Create()');
     }
     return $rc;
 }
开发者ID:guiping,项目名称:PhpMQTTClient,代码行数:34,代码来源:php_sam.php

示例2: run

 public function run()
 {
     //TODO: genericise this behaviour
     $cls_name = explode('\\', get_class($this));
     $this->shortName = array_pop($cls_name);
     if (file_exists(dirname(__FILE__) . '/js/' . $this->shortName . '.js')) {
         $this->assetFolder = Yii::app()->getAssetManager()->publish(dirname(__FILE__) . '/js/');
         Yii::app()->getClientScript()->registerScriptFile($this->assetFolder . '/' . $this->shortName . '.js');
         Yii::app()->getAssetManager()->registerCssFile('css/module.css', 'application.modules.PatientTicketing.assets', 10, \AssetManager::OUTPUT_ALL);
     }
     if ($this->ticket) {
         $this->event_types = $this->ticket->current_queue->getRelatedEventTypes();
         $this->ticket_info = $this->ticket->getInfoData(false);
         $this->current_queue_name = $this->ticket->current_queue->name;
         $this->outcome_options = array();
         $od = $this->ticket->current_queue->getOutcomeData(false);
         foreach ($od as $out) {
             $this->outcome_options[$out['id']] = $out['name'];
         }
         if (count($od) == 1) {
             $this->outcome_queue_id = $od[0]['id'];
         }
     }
     $this->render('TicketMove');
 }
开发者ID:openeyes,项目名称:openeyes,代码行数:25,代码来源:TicketMove.php

示例3: testBuild

 public function testBuild()
 {
     $type = 'history';
     $userId = 1;
     $user = $this->getMockBuilder('stdClass')->setMethods(['getId'])->getMock();
     $user->expects($this->once())->method('getId')->will($this->returnValue($userId));
     $token = $this->getMock('Symfony\\Component\\Security\\Core\\Authentication\\Token\\TokenInterface');
     $token->expects($this->once())->method('getUser')->will($this->returnValue($user));
     $this->tokenStorage->expects($this->once())->method('getToken')->will($this->returnValue($token));
     $item = $this->getMock('Oro\\Bundle\\NavigationBundle\\Entity\\NavigationItemInterface');
     $this->factory->expects($this->once())->method('createItem')->with($type, [])->will($this->returnValue($item));
     $repository = $this->getMockBuilder('Oro\\Bundle\\NavigationBundle\\Entity\\Repository\\HistoryItemRepository')->disableOriginalConstructor()->getMock();
     $items = [['id' => 1, 'title' => 'test1', 'url' => '/'], ['id' => 2, 'title' => 'test2', 'url' => '/home']];
     $repository->expects($this->once())->method('getNavigationItems')->with($userId, $type)->will($this->returnValue($items));
     $this->em->expects($this->once())->method('getRepository')->with(get_class($item))->will($this->returnValue($repository));
     $menu = $this->getMockBuilder('Knp\\Menu\\MenuItem')->disableOriginalConstructor()->getMock();
     $childMock = $this->getMock('Knp\\Menu\\ItemInterface');
     $childMock2 = clone $childMock;
     $children = [$childMock, $childMock2];
     $matcher = $this->getMock('\\Knp\\Menu\\Matcher\\Matcher');
     $matcher->expects($this->once())->method('isCurrent')->will($this->returnValue(true));
     $this->builder->setMatcher($matcher);
     $menu->expects($this->exactly(2))->method('addChild');
     $menu->expects($this->once())->method('setExtra')->with('type', $type);
     $menu->expects($this->once())->method('getChildren')->will($this->returnValue($children));
     $menu->expects($this->once())->method('removeChild');
     $n = rand(1, 10);
     $configMock = $this->getMockBuilder('Oro\\Bundle\\ConfigBundle\\Config\\UserConfigManager')->disableOriginalConstructor()->getMock();
     $configMock->expects($this->once())->method('get')->with($this->equalTo('oro_navigation.maxItems'))->will($this->returnValue($n));
     $this->manipulator->expects($this->once())->method('slice')->with($menu, 0, $n);
     $this->builder->setOptions($configMock);
     $this->builder->build($menu, [], $type);
 }
开发者ID:abdeldayem,项目名称:pim-community-dev,代码行数:33,代码来源:NavigationHistoryBuilderTest.php

示例4: render

 /**
  * @param mixed $objects
  * @param string $as
  * @param array $configuration
  * @return string
  * @throws \UnexpectedValueException
  */
 public function render($objects, $as, array $configuration = array('itemsPerPage' => 10, 'insertAbove' => false, 'insertBelow' => true, 'maximumNumberOfLinks' => 99))
 {
     if (!($objects instanceof QueryResultInterface || $objects instanceof ObjectStorage || is_array($objects))) {
         throw new \UnexpectedValueException('Supplied file object type ' . get_class($objects) . ' must be QueryResultInterface or ObjectStorage or be an array.', 1454510731);
     }
     return $this->initiateSubRequest();
 }
开发者ID:TYPO3Incubator,项目名称:TYPO3.CMS,代码行数:14,代码来源:PaginateViewHelper.php

示例5: __construct

		function __construct()
		{
			parent::__construct();
			$this->module=strtolower(get_class());
			$this->load->model('Mtintuc');
			$this->load->library('pagination');
		}
开发者ID:hungnv0789,项目名称:vhtm,代码行数:7,代码来源:tintuc.php

示例6: updating

 /**
  * @return void
  */
 protected function updating()
 {
     if ($this->frozen) {
         $class = get_class($this);
         throw new InvalidStateException("Cannot modify a frozen object {$class}.");
     }
 }
开发者ID:BozzaCoon,项目名称:SPHERE-Framework,代码行数:10,代码来源:FreezableObject.php

示例7: isValid

 /**
  * @param Doctrine\ODM\MongoDB\Document $value
  * @param Constraint $constraint
  * @return Boolean
  */
 public function isValid($document, Constraint $constraint)
 {
     $class = get_class($document);
     $dm = $this->getDocumentManager($constraint);
     $metadata = $dm->getClassMetadata($class);
     if ($metadata->isEmbeddedDocument) {
         throw new \InvalidArgumentException(sprintf("Document '%s' is an embedded document, and cannot be validated", $class));
     }
     $query = $this->getQueryArray($metadata, $document, $constraint->path);
     // check if document exists in mongodb
     if (null === ($doc = $dm->getRepository($class)->findOneBy($query))) {
         return true;
     }
     // check if document in mongodb is the same document as the checked one
     if ($doc === $document) {
         return true;
     }
     // check if returned document is proxy and initialize the minimum identifier if needed
     if ($doc instanceof Proxy) {
         $metadata->setIdentifierValue($doc, $doc->__identifier);
     }
     // check if document has the same identifier as the current one
     if ($metadata->getIdentifierValue($doc) === $metadata->getIdentifierValue($document)) {
         return true;
     }
     $this->context->setPropertyPath($this->context->getPropertyPath() . '.' . $constraint->path);
     $this->setMessage($constraint->message, array('{{ property }}' => $constraint->path));
     return false;
 }
开发者ID:nickaggarwal,项目名称:sample-symfony2,代码行数:34,代码来源:UniqueValidator.php

示例8: extract

 /**
  * {@inheritdoc}
  */
 public function extract($command)
 {
     $className = substr(strrchr(get_class($command), '\\'), 1);
     return preg_replace_callback('/(^|[a-z])([A-Z])/', function ($s) {
         return strtolower(strlen($s[1]) ? "{$s['1']}_{$s['2']}" : "{$s['2']}");
     }, $className);
 }
开发者ID:ferodss,项目名称:tactician-pimple-service-provider,代码行数:10,代码来源:DecamelizeClassNameExtractor.php

示例9: buildXml

 /**
  * @param DOMElement $element
  * @param mixed $data
  */
 protected function buildXml($element, $data)
 {
     if (is_object($data)) {
         $child = new DOMElement(StringHelper::basename(get_class($data)));
         $element->appendChild($child);
         if ($data instanceof Arrayable) {
             $this->buildXml($child, $data->toArray());
         } else {
             $array = [];
             foreach ($data as $name => $value) {
                 $array[$name] = $value;
             }
             $this->buildXml($child, $array);
         }
     } elseif (is_array($data)) {
         foreach ($data as $name => $value) {
             if (is_int($name) && is_object($value)) {
                 $this->buildXml($element, $value);
             } elseif (is_array($value) || is_object($value)) {
                 $child = new DOMElement(is_int($name) ? $this->itemTag : $name);
                 $element->appendChild($child);
                 $this->buildXml($child, $value);
             } else {
                 $child = new DOMElement(is_int($name) ? $this->itemTag : $name);
                 $element->appendChild($child);
                 $child->appendChild(new DOMText((string) $value));
             }
         }
     } else {
         $element->appendChild(new DOMText((string) $data));
     }
 }
开发者ID:Jaaviieer,项目名称:PrograWeb,代码行数:36,代码来源:XmlResponseFormatter.php

示例10: validatePlugin

 /**
  * Validate the plugin
  *
  * Checks that the Model is an instance of ModelInterface
  *
  * @param  mixed $plugin
  * @throws InvalidPluginException
  * @return void
  */
 public function validatePlugin($plugin)
 {
     if ($plugin instanceof ModelInterface) {
         return;
     }
     throw new InvalidPluginException(sprintf('Plugin of type %s is invalid; must implement %s\\Model\\ModelInterface', is_object($plugin) ? get_class($plugin) : gettype($plugin), __NAMESPACE__));
 }
开发者ID:uthando-cms,项目名称:uthando-common,代码行数:16,代码来源:ModelManager.php

示例11: XMLAppend

 /**
  * Append any supported $content to $parent
  *
  * @param  DOMNode $parent  Node to append to
  * @param  mixed   $content Content to append
  * @return self
  */
 protected function XMLAppend(\DOMNode &$parent = null, $content = null)
 {
     if (is_null($parent)) {
         $parent = $this->root;
     }
     if (is_string($content) or is_numeric($content) or is_object($content) and method_exists($content, '__toString')) {
         $parent->appendChild($this->createTextNode("{$content}"));
     } elseif (is_object($content) and is_subclass_of($content, '\\DOMNode')) {
         $parent->appendChild($content);
     } elseif (is_array($content) or is_object($content) and $content = get_object_vars($content)) {
         array_map(function ($node, $value) use(&$parent) {
             if (is_string($node)) {
                 if (substr($node, 0, 1) === '@') {
                     $parent->setAttribute(substr($node, 1), $value);
                 } else {
                     $node = $parent->appendChild($this->createElement($node));
                     if (is_string($value)) {
                         $this->XMLAppend($node, $this->createTextNode($value));
                     } else {
                         $this->XMLAppend($node, $value);
                     }
                 }
             } else {
                 $this->XMLAppend($parent, $value);
             }
         }, array_keys($content), array_values($content));
     } elseif (is_bool($content)) {
         $parent->appendChild($this->createTextNode($content ? 'true' : 'false'));
     } else {
         throw new \InvalidArgumentException(sprintf('Unable to append unknown content [%s] to %s', get_class($content), get_class($this)));
     }
     return $this;
 }
开发者ID:KVSun,项目名称:core_api,代码行数:40,代码来源:xmlappend.php

示例12: __construct

 function __construct()
 {
     parent::__construct();
     $this->controller = strtolower(get_class($this));
     $this->load->model('Algorithm_quality');
     $this->load->model('Implementation');
 }
开发者ID:jaksmid,项目名称:website,代码行数:7,代码来源:updatedb.php

示例13: remove

 public function remove(Publishing $pub)
 {
     if (!$pub instanceof \Trismegiste\Socialist\Picture) {
         throw new \InvalidArgumentException(get_class($pub) . ' is not a Picture');
     }
     $this->storage->remove($pub->getStorageKey());
 }
开发者ID:xtrasmal,项目名称:iinano,代码行数:7,代码来源:DeletePicture.php

示例14: dumpObject

 protected function dumpObject($obj, $hash)
 {
     if (isset($this->objectsDepth[$hash])) {
         if ($this->objectsDepth[$hash] < $this->depth) {
             $this->refPool[$this->counter]['ref_counter'] = $this->counter;
             $this->dumpRef(true, $this->counter, $obj, 'object');
             return;
         } else {
             unset($this->objectsDepth[$hash]);
         }
     }
     $a = (array) $obj;
     $c = get_class($obj);
     $p = array($c => $c) + class_parents($obj) + class_implements($obj) + array('*' => '*');
     foreach (array_reverse($p) as $p) {
         if (!empty($this->casters[$p = 'o:' . strtolower($p)])) {
             foreach ($this->casters[$p] as $p) {
                 try {
                     $a = call_user_func($p, $obj, $a);
                 } catch (\Exception $e) {
                 }
             }
         }
     }
     $this->walkHash($c, $a, count($a));
 }
开发者ID:nicolas-grekas,项目名称:Patchwork,代码行数:26,代码来源:Dumper.php

示例15: it_wraps_non_token_arguments_into_ExactValueToken

 /**
  * @param \stdClass $object
  */
 function it_wraps_non_token_arguments_into_ExactValueToken($object)
 {
     $this->beConstructedWith(array(42, 'zet', $object));
     $class = get_class($object->getWrappedObject());
     $hash = spl_object_hash($object->getWrappedObject());
     $this->__toString()->shouldReturn("exact(42), exact(\"zet\"), exact({$class}:{$hash} Object (\n    'objectProphecy' => Prophecy\\Prophecy\\ObjectProphecy Object (*Prophecy*)\n))");
 }
开发者ID:huycao,项目名称:yodelivery,代码行数:10,代码来源:ArgumentsWildcardSpec.php


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