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


PHP ReflectionObject::getShortName方法代码示例

本文整理汇总了PHP中ReflectionObject::getShortName方法的典型用法代码示例。如果您正苦于以下问题:PHP ReflectionObject::getShortName方法的具体用法?PHP ReflectionObject::getShortName怎么用?PHP ReflectionObject::getShortName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ReflectionObject的用法示例。


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

示例1: convert

 /**
  * {@inheritDoc}
  */
 public function convert(ReplyInterface $reply)
 {
     $headers = $statusCode = $content = null;
     if ($reply instanceof SymfonyHttpResponse) {
         $response = $reply->getResponse();
         $statusCode = $response->getStatusCode();
         $headers = $response->headers->all();
         $content = $response->getContent();
     } else {
         if ($reply instanceof HttpPostRedirect) {
             $statusCode = $reply->getStatusCode();
             $headers = $reply->getHeaders();
             $content = $this->preparePostRedirectContent($reply);
         } else {
             if ($reply instanceof HttpResponse) {
                 $statusCode = $reply->getStatusCode();
                 $headers = $reply->getHeaders();
                 $content = $reply->getContent();
             } else {
                 $ro = new \ReflectionObject($reply);
                 throw new LogicException(sprintf('Cannot convert reply %s to http response.', $ro->getShortName()), null, $reply);
             }
         }
     }
     $fixedHeaders = [];
     foreach ($headers as $name => $value) {
         $fixedHeaders[str_replace('- ', '-', ucwords(str_replace('-', '- ', $name)))] = $value;
     }
     $fixedHeaders['Content-Type'] = 'application/vnd.payum+json';
     return new JsonResponse(['status' => $statusCode, 'headers' => $fixedHeaders, 'content' => $content], $statusCode, ['X-Status-Code' => $statusCode]);
 }
开发者ID:detain,项目名称:PayumServer,代码行数:34,代码来源:ReplyToJsonResponseConverter.php

示例2: getFactoryByRequest

 /**
  * @param \Wehup\AMI\Request\RequestInterface $request
  * @return \Wehup\AMI\Factory\FactoryInterface
  */
 public static function getFactoryByRequest(Request\RequestInterface $request)
 {
     $reflection = new \ReflectionObject($request);
     $classname = substr($reflection->getShortName(), 0, -7);
     // remove "Request" suffix
     $fqcn = "\\Wehup\\AMI\\Factory\\{$classname}Factory";
     if (!class_exists($fqcn)) {
         throw new Exception\NoFactoryClassAvailableException("There is no available Factory class for \"{$classname}\"", $fqcn);
     }
     return new $fqcn($request);
 }
开发者ID:wehup,项目名称:asterisk-ami,代码行数:15,代码来源:FactoryProvider.php

示例3: value

 /**
  * @param mixed $value
  * @param bool $shortClass
  *
  * @return string
  */
 public static function value($value, $shortClass = true)
 {
     if (is_object($value)) {
         if ($shortClass) {
             $ro = new \ReflectionObject($value);
             return $ro->getShortName();
         }
         return get_class($value);
     }
     return gettype($value);
 }
开发者ID:Studio-40,项目名称:Payum,代码行数:17,代码来源:Humanify.php

示例4: resolveHandlerClass

 /**
  * Resolves an instance of the handler class
  * corresponding to $command.
  *
  * @param Command $command
  *
  * @return CommandHandler
  * @throws \Exception
  */
 private function resolveHandlerClass(Command $command)
 {
     $reflectionObject = new \ReflectionObject($command);
     $shortName = $reflectionObject->getShortName();
     $className = $reflectionObject->getNamespaceName() . '\\Handlers\\' . $shortName . 'Handler';
     if (!class_exists($className)) {
         throw new \Exception("Command handler {$className} not found.");
     }
     // Let the container resolve the instance and inject the required dependencies.
     return $this->container->get($className);
 }
开发者ID:domynation,项目名称:domynation-framework,代码行数:20,代码来源:BasicCommandBus.php

示例5: convert

 /**
  * @param ReplyInterface $reply
  *
  * @return Response
  */
 public function convert(ReplyInterface $reply)
 {
     if ($reply instanceof SymfonyHttpResponse) {
         return $reply->getResponse();
     } elseif ($reply instanceof HttpResponse) {
         $headers = $reply->getHeaders();
         $headers['X-Status-Code'] = $reply->getStatusCode();
         return new Response($reply->getContent(), $reply->getStatusCode(), $headers);
     }
     $ro = new \ReflectionObject($reply);
     throw new LogicException(sprintf('Cannot convert reply %s to http response.', $ro->getShortName()), null, $reply);
 }
开发者ID:eamador,项目名称:Payum,代码行数:17,代码来源:ReplyToSymfonyResponseConverter.php

示例6: convert

 /**
  * @param ReplyInterface $reply
  *
  * @return Response
  */
 public function convert(ReplyInterface $reply)
 {
     if ($reply instanceof SymfonyHttpResponse) {
         return $reply->getResponse();
     } elseif ($reply instanceof HttpResponse) {
         return new Response($reply->getContent());
     } elseif ($reply instanceof HttpRedirect) {
         return new RedirectResponse($reply->getUrl());
     }
     $ro = new \ReflectionObject($reply);
     throw new LogicException(sprintf('Cannot convert reply %s to http response.', $ro->getShortName()), null, $reply);
 }
开发者ID:stan5621,项目名称:eduwind,代码行数:17,代码来源:ReplyToSymfonyResponseConverter.php

示例7: handleException

 public function handleException(\CExceptionEvent $event)
 {
     if (false == $event->exception instanceof ReplyInterface) {
         return;
     }
     $reply = $event->exception;
     if ($reply instanceof HttpRedirect) {
         $this->redirect($reply->getUrl(), true);
         $event->handled = true;
         return;
     }
     $ro = new \ReflectionObject($reply);
     $event->exception = new LogicException(sprintf('Cannot convert reply %s to Yii response.', $ro->getShortName()), null, $reply);
 }
开发者ID:stan5621,项目名称:eduwind,代码行数:14,代码来源:PaymentController.php

示例8: registersMappingFilesInTheSpecifiedDirectories

 /**
  * @test
  */
 public function registersMappingFilesInTheSpecifiedDirectories()
 {
     $container = new ContainerBuilder(new ParameterBag(array('kernel.debug' => false, 'kernel.bundles' => array('FrameworkBundle' => 'Symfony\\Bundle\\FrameworkBundle\\FrameworkBundle', 'PieceValidationDirectoryLoaderBundle' => 'Piece\\Bundle\\ValidationDirectoryLoaderBundle\\PieceValidationDirectoryLoaderBundle'), 'kernel.cache_dir' => __DIR__)));
     $container->registerExtension(new FrameworkExtension());
     $container->registerExtension(new PieceValidationDirectoryLoaderExtension());
     $container->loadFromExtension('framework', array('secret' => '154F520832A9BC66316C259EEC70E4FA671A12F5', 'validation' => array('enable_annotations' => false)));
     $container->loadFromExtension('piece_validationdirectoryloader', array('mapping_dirs' => array(__DIR__ . '/Fixtures/validation/a', __DIR__ . '/Fixtures/validation/b')));
     $container->getCompilerPassConfig()->setOptimizationPasses(array());
     $container->getCompilerPassConfig()->setRemovingPasses(array());
     $container->compile();
     foreach (array(new Foo(), new Bar(), new Baz()) as $entity) {
         $violations = $container->get('validator')->validate($entity);
         $this->assertEquals(1, count($violations));
         $this->assertSame($entity, $violations[0]->getRoot());
         $entityClass = new \ReflectionObject($entity);
         $this->assertEquals(strtolower($entityClass->getShortName()), $violations[0]->getPropertyPath());
     }
 }
开发者ID:piece,项目名称:piece-validationdirectoryloader-bundle,代码行数:21,代码来源:PieceValidationDirectoryLoaderExtensionTest.php

示例9: exportProperties

    /**
     * Extract and map properties for the metadata
     *
     * @param ClassMetadata $metadata
     */
    protected function exportProperties(ClassMetadata $metadata)
    {
        $map = array();

        foreach ($metadata->getFields() as $name => $field) {
            $ref = new \ReflectionObject($field);
            $class = $ref->getShortName();
            $method = sprintf('exportField%s', $class);
            $map[$name] = $this->$method($field);
        }

        foreach ($metadata->getEmbeds() as $name => $embed) {
            $embedMetadata = $metadata->getEmbeddedMetadata($name);
            $map[$name]['type'] = 'object';
            $map[$name]['properties'] = $this->exportProperties($embedMetadata);
        }

        return $map;
    }
开发者ID:nresni,项目名称:Ariadne,代码行数:24,代码来源:CreateIndex.php

示例10: boot

 /**
  * {@inheritDoc}
  */
 public function boot()
 {
     $this->package('payum/payum-laravel-package');
     \View::addNamespace('payum/payum', __DIR__ . '/../../views');
     $this->app->error(function (ReplyInterface $reply) {
         $response = null;
         if ($reply instanceof SymfonyHttpResponse) {
             $response = $reply->getResponse();
         } elseif ($reply instanceof HttpResponse) {
             $response = new Response($reply->getContent());
         } elseif ($reply instanceof HttpRedirect) {
             $response = new RedirectResponse($reply->getUrl());
         }
         if ($response) {
             return $response;
         }
         $ro = new \ReflectionObject($reply);
         throw new LogicException(sprintf('Cannot convert reply %s to Laravel response.', $ro->getShortName()), null, $reply);
     });
     \Route::any('/payment/authorize/{payum_token}', array('as' => 'payum_authorize_do', 'uses' => 'Payum\\LaravelPackage\\Controller\\AuthorizeController@doAction'));
     \Route::any('/payment/capture/{payum_token}', array('as' => 'payum_capture_do', 'uses' => 'Payum\\LaravelPackage\\Controller\\CaptureController@doAction'));
     \Route::any('/payment/refund/{payum_token}', array('as' => 'payum_refund_do', 'uses' => 'Payum\\LaravelPackage\\Controller\\RefundController@doAction'));
     \Route::get('/payment/notify/{payum_token}', array('as' => 'payum_notify_do', 'uses' => 'Payum\\LaravelPackage\\Controller\\NotifyController@doAction'));
     \Route::get('/payment/notify/unsafe/{payment_name}', array('as' => 'payum_notify_do_unsafe', 'uses' => 'Payum\\LaravelPackage\\Controller\\NotifyController@doUnsafeAction'));
     $this->app['payum'] = $this->app->share(function ($app) {
         //TODO add exceptions if invalid payments and storages options set.
         $payum = new ContainerAwareRegistry(\Config::get('payum-laravel-package::payments'), \Config::get('payum-laravel-package::storages'));
         $payum->setContainer($app);
         return $payum;
     });
     $this->app['payum.security.token_storage'] = $this->app->share(function ($app) {
         //TODO add exceptions if invalid payments and storages options set.
         $tokenStorage = \Config::get('payum-laravel-package::token_storage');
         return is_object($tokenStorage) ? $tokenStorage : $app[$tokenStorage];
     });
     $this->app['payum.security.token_factory'] = $this->app->share(function ($app) {
         return new TokenFactory($app['payum.security.token_storage'], $app['payum'], 'payum_capture_do', 'payum_notify_do', 'payum_authorize_do', 'payum_refund_do');
     });
     $this->app['payum.security.http_request_verifier'] = $this->app->share(function ($app) {
         return new HttpRequestVerifier($app['payum.security.token_storage']);
     });
 }
开发者ID:ateixeira,项目名称:PayumLaravelPackage,代码行数:45,代码来源:PayumServiceProvider.php

示例11: onKernelException

 /**
  * @param GetResponseForExceptionEvent $event
  */
 public function onKernelException(GetResponseForExceptionEvent $event)
 {
     if (false == $event->getException() instanceof InteractiveRequestInterface) {
         return;
     }
     $interactiveRequest = $event->getException();
     if ($interactiveRequest instanceof SymfonyResponseInteractiveRequest) {
         $event->setResponse($interactiveRequest->getResponse());
     } elseif ($interactiveRequest instanceof ResponseInteractiveRequest) {
         $event->setResponse(new Response($interactiveRequest->getContent()));
     } elseif ($interactiveRequest instanceof RedirectUrlInteractiveRequest) {
         $event->setResponse(new RedirectResponse($interactiveRequest->getUrl()));
     }
     if ($event->getResponse()) {
         if (false == $event->getResponse()->headers->has('X-Status-Code')) {
             $event->getResponse()->headers->set('X-Status-Code', $event->getResponse()->getStatusCode());
         }
         return;
     }
     $ro = new \ReflectionObject($interactiveRequest);
     $event->setException(new LogicException(sprintf('Cannot convert interactive request %s to symfony response.', $ro->getShortName()), null, $interactiveRequest));
 }
开发者ID:sanchojaf,项目名称:oldmytriptocuba,代码行数:25,代码来源:InteractiveRequestListener.php

示例12: shouldLogReplyWhenSetOnPostExecute

 /**
  * @test
  */
 public function shouldLogReplyWhenSetOnPostExecute()
 {
     $action = new FooAction();
     $replyMock = $this->createReplyMock();
     $ro = new \ReflectionObject($replyMock);
     $logger = $this->createLoggerMock();
     $logger->expects($this->at(0))->method('debug')->with('[Payum] 1# FooAction::execute(string) throws reply ' . $ro->getShortName());
     $context = new Context($this->createGatewayMock(), 'string', array());
     $context->setAction($action);
     $context->setReply($replyMock);
     $extension = new LogExecutedActionsExtension($logger);
     $extension->onPostExecute($context);
 }
开发者ID:eamador,项目名称:Payum,代码行数:16,代码来源:LogExecutedActionsExtensionTest.php

示例13: getAnalyzeHtml_Object

 private function getAnalyzeHtml_Object($obj, $index)
 {
     $reflector = new \ReflectionObject($obj);
     $result = '';
     $result .= '<h4>About</h4>';
     $result .= '<table class="aboutTable">';
     $result .= '<tbody>';
     $result .= '<tr>';
     $result .= '<td class="colLeft"><strong>Name</strong></td>';
     $result .= '<td class="colRight">' . htmlentities($reflector->getShortName()) . '</td>';
     $result .= '</tr>';
     $result .= '<tr>';
     $result .= '<td class="colLeft"><strong>Namespace</strong></td>';
     $result .= '<td class="colRight">' . htmlentities($reflector->getNamespaceName()) . '</td>';
     $result .= '</tr>';
     $result .= '</tbody>';
     $result .= '<tr>';
     $result .= '<td class="colLeft"><strong>File</strong></td>';
     $result .= '<td class="colRight">' . htmlentities($reflector->getFileName()) . '</td>';
     $result .= '</tr>';
     $result .= '</tbody>';
     $result .= '</table>';
     $result .= '<h4>Members</h4>';
     $result .= '<ul class="accordion" data-accordion>';
     $accId = "objConstants{$index}";
     $constants = $reflector->getConstants();
     uksort($constants, function ($x, $y) {
         return strcmp(trim(strtolower($x)), trim(strtolower($y)));
     });
     $content = 'No constants found.';
     if (!empty($constants)) {
         $content = '<table class="memberTable">';
         $content .= '<thead>';
         $content .= '<tr>';
         $content .= '<th class="memberName">Name</th>';
         $content .= '<th>Value</th>';
         $content .= '</tr>';
         $content .= '</thead>';
         $content .= '<tbody>';
         foreach ($constants as $name => $value) {
             $content .= '<tr>';
             $content .= '<td>' . htmlentities($name) . '</td>';
             $content .= '<td>' . htmlentities(var_export($value, true)) . '</td>';
             $content .= '</tr>';
         }
         $content .= '</tbody>';
         $content .= '</table>';
     }
     $result .= '<li class="accordion-navigation">';
     $result .= '<a href="#' . $accId . '" aria-expanded="false">Constants (' . trim(count($constants)) . ')</a>';
     $result .= '<div id="' . $accId . '" class="content">' . $content . '</div>';
     $result .= '</li>';
     $accId = "objMethods{$index}";
     $methods = $reflector->getMethods();
     usort($methods, function (\ReflectionMethod $x, \ReflectionMethod $y) {
         return strcmp(trim(strtolower($x->getName())), trim(strtolower($y->getName())));
     });
     foreach ($methods as $i => $m) {
         if (!$m->isPublic()) {
             unset($methods[$i]);
         }
     }
     $content = 'No methods found.';
     if (!empty($methods)) {
         $content = '<table class="memberTable">';
         $content .= '<thead>';
         $content .= '<tr>';
         $content .= '<th class="memberName">Name</th>';
         $content .= '</tr>';
         $content .= '</thead>';
         $content .= '<tbody>';
         foreach ($methods as $m) {
             $content .= '<tr>';
             $content .= '<td>' . htmlentities($m->getName()) . '</td>';
             $content .= '</tr>';
         }
         $content .= '</tbody>';
         $content .= '</table>';
     }
     $result .= '<li class="accordion-navigation">';
     $result .= '<a href="#' . $accId . '" aria-expanded="false">Methods (' . trim(count($methods)) . ')</a>';
     $result .= '<div id="' . $accId . '" class="content">' . $content . '</div>';
     $result .= '</li>';
     $accId = "objProperties{$index}";
     $properties = $reflector->getProperties();
     usort($properties, function (\ReflectionProperty $x, \ReflectionProperty $y) {
         return strcmp(trim(strtolower($x->getName())), trim(strtolower($y->getName())));
     });
     foreach ($properties as $i => $p) {
         if (!$p->isPublic()) {
             unset($properties[$i]);
         }
     }
     $content = 'No properties found.';
     if (!empty($properties)) {
         $content = '<table class="memberTable">';
         $content .= '<thead>';
         $content .= '<tr>';
         $content .= '<th class="memberName">Name</th>';
         $content .= '<th>Current value</th>';
//.........这里部分代码省略.........
开发者ID:bbehbudi,项目名称:phpDeeBuk,代码行数:101,代码来源:phpDeeBuk.php

示例14: get_tracking_file_name

 protected final function get_tracking_file_name()
 {
     $obj = new ReflectionObject($this);
     return "test-results/" . $obj->getShortName() . ".json";
 }
开发者ID:AaronAsAChimp,项目名称:Bundt,代码行数:5,代码来源:bundt.tests.harness.php

示例15: shouldLogOnInteractiveRequest

 /**
  * @test
  */
 public function shouldLogOnInteractiveRequest()
 {
     $action = new FooAction();
     $interactiveRequest = $this->createInteractiveRequestMock();
     $ro = new \ReflectionObject($interactiveRequest);
     $logger = $this->createLoggerMock();
     $logger->expects($this->at(0))->method('debug')->with('[Payum] 1# FooAction::execute(string) throws interactive ' . $ro->getShortName());
     $extension = new LogExecutedActionsExtension($logger);
     $extension->onPreExecute('string');
     $extension->onInteractiveRequest($interactiveRequest, 'string', $action);
 }
开发者ID:stan5621,项目名称:eduwind,代码行数:14,代码来源:LogExecutedActionsExtensionTest.php


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