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


PHP ReflectionObject::getFileName方法代码示例

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


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

示例1: getViewTemplate

 /**
  * @return string
  */
 public function getViewTemplate()
 {
     // set default view name
     if (is_null($this->viewTemplate)) {
         $reflected = new \ReflectionObject($this);
         $viewTemplate = substr($reflected->getFileName(), 0, -4);
         $templateFound = false;
         foreach (self::$viewExtensions as $extension) {
             if (file_exists($viewTemplate . '.' . ltrim($extension, '.'))) {
                 $templateFound = true;
                 break;
             }
         }
         if (!$templateFound) {
             // try to get parent template if any
             $parentReflectedClass = $reflected->getParentClass();
             if ($parentReflectedClass->isInstantiable() && $parentReflectedClass->implementsInterface(RenderableActionInterface::class)) {
                 $parentViewTemplate = $parentReflectedClass->newInstance()->getViewTemplate();
                 $viewTemplate = $parentViewTemplate;
             }
         }
         $this->viewTemplate = $viewTemplate;
     }
     return $this->viewTemplate;
 }
开发者ID:objective-php,项目名称:application,代码行数:28,代码来源:RenderableAction.php

示例2: load

 /**
  * @param AdminInterface $admin
  *
  * @return mixed
  * @throws \RuntimeException
  */
 public function load(AdminInterface $admin)
 {
     $filename = $this->cacheFolder . '/route_' . md5($admin->getCode());
     $cache = new ConfigCache($filename, $this->debug);
     if (!$cache->isFresh()) {
         $resources = array();
         $routes = array();
         $reflection = new \ReflectionObject($admin);
         $resources[] = new FileResource($reflection->getFileName());
         if (!$admin->getRoutes()) {
             throw new \RuntimeException('Invalid data type, Admin::getRoutes must return a RouteCollection');
         }
         foreach ($admin->getRoutes()->getElements() as $code => $route) {
             $routes[$code] = $route->getDefault('_sonata_name');
         }
         if (!is_array($admin->getExtensions())) {
             throw new \RuntimeException('extensions must be an array');
         }
         foreach ($admin->getExtensions() as $extension) {
             $reflection = new \ReflectionObject($extension);
             $resources[] = new FileResource($reflection->getFileName());
         }
         $cache->write(serialize($routes), $resources);
     }
     return unserialize(file_get_contents($filename));
 }
开发者ID:kwuerl,项目名称:SonataAdminBundle,代码行数:32,代码来源:RoutesCache.php

示例3: getPath

 /**
  * Gets the Module directory path.
  *
  * @return string The Module absolute path
  *
  * @api
  */
 public function getPath()
 {
     if (null === $this->reflected) {
         $this->reflected = new \ReflectionObject($this);
     }
     return dirname($this->reflected->getFileName());
 }
开发者ID:dragoonis,项目名称:framework,代码行数:14,代码来源:AbstractModule.php

示例4: getConfiguration

 public function getConfiguration(array $config, ContainerBuilder $container)
 {
     $configuration = new Configuration($this->getAlias());
     $r = new \ReflectionObject($configuration);
     $container->addResource(new FileResource($r->getFileName()));
     return $configuration;
 }
开发者ID:sstok,项目名称:rollerworks-datagrid-bundle,代码行数:7,代码来源:DatagridExtension.php

示例5: testCacheIsFreshAfterCacheClearedWithWarmup

 public function testCacheIsFreshAfterCacheClearedWithWarmup()
 {
     $input = new ArrayInput(array('cache:clear'));
     $application = new Application($this->kernel);
     $application->setCatchExceptions(false);
     $application->doRun($input, new NullOutput());
     // Ensure that all *.meta files are fresh
     $finder = new Finder();
     $metaFiles = $finder->files()->in($this->kernel->getCacheDir())->name('*.php.meta');
     // simply check that cache is warmed up
     $this->assertGreaterThanOrEqual(1, count($metaFiles));
     foreach ($metaFiles as $file) {
         $configCache = new ConfigCache(substr($file, 0, -5), true);
         $this->assertTrue($configCache->isFresh(), sprintf('Meta file "%s" is not fresh', (string) $file));
     }
     // check that app kernel file present in meta file of container's cache
     $containerRef = new \ReflectionObject($this->kernel->getContainer());
     $containerFile = $containerRef->getFileName();
     $containerMetaFile = $containerFile . '.meta';
     $kernelRef = new \ReflectionObject($this->kernel);
     $kernelFile = $kernelRef->getFileName();
     /** @var ResourceInterface[] $meta */
     $meta = unserialize(file_get_contents($containerMetaFile));
     $found = false;
     foreach ($meta as $resource) {
         if ((string) $resource === $kernelFile) {
             $found = true;
             break;
         }
     }
     $this->assertTrue($found, 'Kernel file should present as resource');
 }
开发者ID:Dren-x,项目名称:mobit,代码行数:32,代码来源:CacheClearCommandTest.php

示例6: coreTest

 protected function coreTest(array $arguments)
 {
     $input = new ArrayInput($arguments);
     $application = new Application(static::$kernel);
     $application->setCatchExceptions(false);
     $application->doRun($input, new NullOutput());
     // Ensure that all *.meta files are fresh
     $finder = new Finder();
     $metaFiles = $finder->files()->in(static::$kernel->getCacheDir())->name('*.php.meta');
     // simply check that cache is warmed up
     $this->assertGreaterThanOrEqual(1, count($metaFiles));
     foreach ($metaFiles as $file) {
         $configCache = new ConfigCache(substr($file, 0, -5), true);
         $this->assertTrue($configCache->isFresh(), sprintf('Meta file "%s" is not fresh', (string) $file));
     }
     // check that app kernel file present in meta file of container's cache
     $containerRef = new \ReflectionObject(static::$kernel->getContainer());
     $containerFile = $containerRef->getFileName();
     $containerMetaFile = $containerFile . '.meta';
     $kernelRef = new \ReflectionObject(static::$kernel);
     $kernelFile = $kernelRef->getFileName();
     /** @var ResourceInterface[] $meta */
     $meta = unserialize(file_get_contents($containerMetaFile));
     $found = false;
     foreach ($meta as $resource) {
         if ((string) $resource === $kernelFile) {
             $found = true;
             break;
         }
     }
     $this->assertTrue($found, 'Kernel file should present as resource');
     $this->assertRegExp(sprintf('/\'kernel.name\'\\s*=>\\s*\'%s\'/', static::$kernel->getName()), file_get_contents($containerFile), 'kernel.name is properly set on the dumped container');
     $this->assertEquals(ini_get('memory_limit'), '1024M');
 }
开发者ID:skillberto,项目名称:ConsoleExtendBundle,代码行数:34,代码来源:CacheClearCommandTest.php

示例7: testAnnotationGenerator

 public function testAnnotationGenerator()
 {
     $client = static::createClient();
     $this->assertTrue(AnnotationTagGenerator::$haveBeenRun);
     $object = new \ReflectionObject($client->getContainer());
     $this->assertTrue(strpos(file_get_contents($object->getFileName()), '/* This is a test for annotation generation */') !== false);
 }
开发者ID:mpoiriert,项目名称:nucleus-bundle,代码行数:7,代码来源:NucleusCoreExtensionTest.php

示例8: setUp

 public function setUp()
 {
     $this->autoloader = new Loader();
     $loaderReflection = new \ReflectionObject($this->autoloader);
     $this->loaderFilePath = $loaderReflection->getFileName();
     spl_autoload_register($this->autoloader);
 }
开发者ID:respect,项目名称:loader,代码行数:7,代码来源:LoaderTest.php

示例9: load

    public function load($resource, $type = null)
    {
        $collection = new RouteCollection();

        foreach ($this->adminFactory->getAdmins() as $adminId => $admin) {
            $routePatternPrefix = $admin->getRoutePatternPrefix();
            $routeNamePrefix = $admin->getRouteNamePrefix();

            foreach ($admin->getActions() as $action) {
                $defaults = array(
                    '_controller' => 'WhiteOctoberAdminBundle:Admin:execute',
                    '_white_october_admin.admin'  => $adminId,
                    '_white_october_admin.action' => $action->getFullName(),
                );
                $defaults = array_merge($action->getRouteDefaults(), $defaults);
                $route = new Route($routePatternPrefix.$action->getRoutePatternSuffix(), $defaults, $action->getRouteRequirements());

                $collection->add($ups = $routeNamePrefix.'_'.$action->getRouteNameSuffix(), $route);

                $reflection = new \ReflectionObject($action);
                $collection->addResource(new FileResource($reflection->getFileName()));
            }

            $reflection = new \ReflectionObject($admin);
            $collection->addResource(new FileResource($reflection->getFileName()));
        }

        return $collection;
    }
开发者ID:nibsirahsieu,项目名称:WhiteOctoberAdminBundle,代码行数:29,代码来源:AdminFactoryLoader.php

示例10: testGetCollectorPath

 public function testGetCollectorPath()
 {
     $finder = new Finder();
     $collector = new \Itkg\Profiler\DataCollector\CacheDataCollector();
     $reflector = new \ReflectionObject($collector);
     $directory = dirname($reflector->getFileName());
     $this->assertEquals($directory . '/../Resources/views/collector/cache.html.php', $finder->getCollectorPath($collector));
 }
开发者ID:itkg,项目名称:profiler,代码行数:8,代码来源:FinderTest.php

示例11: getRootDir

 /**
  * @return string
  */
 protected function getRootDir()
 {
     if (!isset($this['root_dir'])) {
         $reflObject = new \ReflectionObject($this);
         $this['root_dir'] = dirname($reflObject->getFileName());
     }
     return realpath($this['root_dir']) ?: $this['root_dir'];
 }
开发者ID:sergiors,项目名称:lullaby,代码行数:11,代码来源:Kernel.php

示例12: getPath

 /**
  * {@inheritdoc}
  */
 public final function getPath()
 {
     if (null === $this->path) {
         $reflObject = new \ReflectionObject($this);
         $this->path = dirname($reflObject->getFileName());
     }
     return $this->path;
 }
开发者ID:sergiors,项目名称:lullaby,代码行数:11,代码来源:Application.php

示例13: addObjectResource

 /**
  * Adds the object class hierarchy as resources.
  *
  * @param object $object An object instance
  */
 public function addObjectResource($object)
 {
     $parent = new \ReflectionObject($object);
     $this->addResource(new FileResource($parent->getFileName()));
     while ($parent = $parent->getParentClass()) {
         $this->addResource(new FileResource($parent->getFileName()));
     }
 }
开发者ID:skoop,项目名称:symfony-sandbox,代码行数:13,代码来源:ContainerBuilder.php

示例14: getRootDir

 /**
  * @return string
  */
 public function getRootDir()
 {
     if (null === $this->rootDir) {
         $r = new \ReflectionObject($this);
         $this->rootDir = str_replace('\\', '/', dirname($r->getFileName()));
     }
     return $this->rootDir;
 }
开发者ID:daffef,项目名称:chamilo-lms,代码行数:11,代码来源:AppKernel.php

示例15: __construct

 public function __construct()
 {
     $r = new \ReflectionObject($this);
     $this->path = dirname($r->getFileName());
     $this->configDir = dirname($this->path) . '/config';
     $this->loadConfiguration();
     $this->loadRoutes();
     $this->configureTemplating();
 }
开发者ID:nirix,项目名称:unframework,代码行数:9,代码来源:AppKernel.php


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