public function testUseIncludePath() { $loader = new ClassLoader(); $this->assertFalse($loader->getUseIncludePath()); $this->assertNull($loader->findFile('Foo')); $includePath = get_include_path(); $loader->setUseIncludePath(true); $this->assertTrue($loader->getUseIncludePath()); set_include_path(__DIR__ . '/Fixtures/includepath' . PATH_SEPARATOR . $includePath); $this->assertEquals(__DIR__ . DIRECTORY_SEPARATOR . 'Fixtures' . DIRECTORY_SEPARATOR . 'includepath' . DIRECTORY_SEPARATOR . 'Foo.php', $loader->findFile('Foo')); set_include_path($includePath); }
/** * Finds a file by class name while caching lookups to WinCache. * * @param string $class A class name to resolve to file * * @return string|null */ public function findFile($class) { if (false === ($file = wincache_ucache_get($this->prefix . $class))) { wincache_ucache_set($this->prefix . $class, $file = $this->decorated->findFile($class), 0); } return $file; }
/** * Finds a file by class name while caching lookups to APC. * * @param string $class A class name to resolve to file * * @return string|null */ public function findFile($class) { if (false === ($file = apc_fetch($this->prefix . $class))) { apc_store($this->prefix . $class, $file = $this->decorated->findFile($class)); } return $file; }
/** * Finds a file by class name while caching lookups to APC. * * @param string $class A class name to resolve to file * * @return string|null */ public function findFile($class) { $file = apc_fetch($this->prefix . $class); if (false === $file) { $file = $this->decorated->findFile($class); if (strlen($file) > $this->base_len && substr_compare($file, $this->base, 0, $this->base_len) == 0) { apc_store($this->prefix . $class, substr($file, $this->base_len)); } } else { $file = $this->base . $file; } return $file; }
/** * {@inheritdoc} */ public function buildDefaultConfiguration($resourceName = null, OutputInterface $output = null) { $this->setBundle($resourceName); $this->output = $output; //Model directory if (!$this->configuration['directory']) { $this->configuration['directory'] = $this->bundle->getPath() . '/Form/Type'; } //Model namespace if (!$this->configuration['namespace']) { $this->configuration['namespace'] = $this->bundle->getNamespace() . '\\Form\\Type'; } if (!$this->configuration['path']) { $loader = new ClassLoader(); $loader->setUseIncludePath(true); $namespace = $this->registry->getAliasNamespace($this->bundle->getName()) . '\\' . $this->model; $test = new $namespace(); $reflector = new \ReflectionClass(get_class($test)); $entity = $loader->findFile(dirname($reflector->getFileName()) . '\\' . $this->model); $this->configuration['path'] = $entity; } $this->setSkeletonDirs($this->getSkeletonDirs($this->bundle)); $this->_initialized = true; }