本文整理汇总了PHP中get_class函数的典型用法代码示例。如果您正苦于以下问题:PHP get_class函数的具体用法?PHP get_class怎么用?PHP get_class使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_class函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: createStorage
private function createStorage($storageKey, array $storages, $urlResolver, Config $config)
{
if (!array_key_exists($storageKey, $storages)) {
throw new InvalidArgumentException("{$storageKey} is not a valid fineuploader server storage");
}
$storage = $storages[$storageKey];
if (!array_key_exists('class', $storage)) {
throw new InvalidArgumentException("{$storageKey} does not have a valid storage class");
}
$storageConfig = array_key_exists('config', $storage) ? $storage['config'] : [];
if (is_array($urlResolver)) {
if (!array_key_exists('class', $urlResolver)) {
throw new InvalidArgumentException("urlResolver needs a class key");
}
$resolverConfig = array_key_exists('config', $urlResolver) ? $urlResolver['config'] : [];
$urlResolver = new $urlResolver['class']($resolverConfig);
if (!$urlResolver instanceof UrlResolverInterface) {
throw new InvalidArgumentException(get_class($urlResolver) . " does not implement " . "Optimus\\Http\\UrlResolverInterface");
}
} elseif (!is_callable($urlResolver)) {
throw new InvalidArgumentException("Url resolver is not a method.");
}
$storage = new $storage['class']($storageConfig, $config, $urlResolver);
return $storage;
}
开发者ID:etorofiev,项目名称:fineuploader-server,代码行数:25,代码来源:LaravelServiceProvider.php
示例17: createLinks
/**
* Create the links for resources in the resource root
* @return array the links, name => config
*/
protected function createLinks()
{
$app = \Yii::app();
/* @var \Restyii\Web\Application $app */
$controller = $this->getController();
$module = $controller->getModule();
if (!$module) {
$module = $app;
}
$controllers = $app->getSchema()->getControllerInstances($module);
/* @var \Restyii\Controller\Base[]|\CController[] $controllers */
$links = array('self' => array('title' => $module->name, 'href' => trim($app->getBaseUrl(), '/') . '/'));
foreach ($controllers as $id => $controller) {
if ($id === $module->defaultController) {
continue;
}
$links[$id] = array('title' => method_exists($controller, 'classLabel') ? $controller->classLabel(true) : String::pluralize(String::humanize(substr(get_class($controller), 0, -10))), 'href' => $controller->createUrl('search'));
if (method_exists($controller, 'classDescription')) {
$links[$id]['description'] = $controller->classDescription();
}
if (isset($controller->modelClass)) {
$links[$id]['profile'] = array($controller->modelClass);
}
}
return $links;
}
开发者ID:codemix,项目名称:restyii,代码行数:30,代码来源:Index.php
示例18: renderEnctype
protected function renderEnctype(FormView $view)
{
if (!method_exists($form = $this->engine->get('form'), 'enctype')) {
$this->markTestSkipped(sprintf('Deprecated method %s->enctype() is not implemented.', get_class($form)));
}
return (string) $form->enctype($view);
}
开发者ID:BusinessCookies,项目名称:CoffeeMachineProject,代码行数:7,代码来源:FormHelperDivLayoutTest.php
示例19: resetCustomLPDataForUserIds
protected function resetCustomLPDataForUserIds(array $a_user_ids, $a_recursive = true)
{
/* @var ilObjTest $testOBJ */
require_once 'Services/Object/classes/class.ilObjectFactory.php';
$testOBJ = ilObjectFactory::getInstanceByObjId($this->obj_id);
$testOBJ->removeTestResults($a_user_ids);
// :TODO: there has to be a better way
$test_ref_id = (int) $_REQUEST["ref_id"];
if ($test_ref_id) {
require_once "Modules/Course/classes/Objectives/class.ilLOSettings.php";
$course_obj_id = ilLOSettings::isObjectiveTest($test_ref_id);
if ($course_obj_id) {
// is test initial and/or qualified?
$lo_settings = ilLOSettings::getInstanceByObjId($course_obj_id);
$is_i = $lo_settings->getInitialTest() == $test_ref_id;
$is_q = $lo_settings->getQualifiedTest() == $test_ref_id;
// remove objective results data
require_once "Modules/Course/classes/Objectives/class.ilLOUserResults.php";
ilLOUserResults::deleteResultsFromLP($course_obj_id, $a_user_ids, $is_i, $is_q);
// refresh LP - see ilLPStatusWrapper::_updateStatus()
require_once "Services/Tracking/classes/class.ilLPStatusFactory.php";
$lp_status = ilLPStatusFactory::_getInstance($course_obj_id);
if (strtolower(get_class($lp_status)) != "illpstatus") {
foreach ($a_user_ids as $user_id) {
$lp_status->_updateStatus($course_obj_id, $user_id);
}
}
}
}
}
开发者ID:bheyser,项目名称:qplskl,代码行数:30,代码来源:class.ilTestLP.php
示例20: __construct
/**
* Creates a new validation value for a validation set.
*
* @param string|IValidator $validator The validator to build be it a class name (fully qualified)
* or a dummy validator object.
* @param mixed ...$params The parameters to the validator. To use a field from the validated
* object, set these as ValidationKey objects.
*/
public function __construct($validator)
{
if (is_object($validator)) {
if (!$validator instanceof IValidator) {
throw new \InvalidArgumentException(Intl\GetText::_d('Flikore.Validator', 'The validator object must be a implementation of IValidator'));
} else {
$this->validator = get_class($validator);
}
} elseif (is_string($validator)) {
if (!is_subclass_of($validator, 'Flikore\\Validator\\Interfaces\\IValidator')) {
throw new \InvalidArgumentException(Intl\GetText::_d('Flikore.Validator', 'The validator object must be a implementation of IValidator'));
} else {
$this->validator = $validator;
}
} else {
throw new \InvalidArgumentException(Intl\GetText::_d('Flikore.Validator', 'The validator object must be a implementation of IValidator'));
}
$params = func_get_args();
array_shift($params);
foreach ($params as $arg) {
if ($arg instanceof ValidationKey) {
$this->fields[] = $arg->getKey();
}
}
$this->args = $params;
}
开发者ID:flikore,项目名称:validator,代码行数:34,代码来源:ValidationValue.php
注:本文中的get_class函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论