本文整理汇总了PHP中Symfony\Component\ClassLoader\ClassCollectionLoader::inline方法的典型用法代码示例。如果您正苦于以下问题:PHP ClassCollectionLoader::inline方法的具体用法?PHP ClassCollectionLoader::inline怎么用?PHP ClassCollectionLoader::inline使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\ClassLoader\ClassCollectionLoader
的用法示例。
在下文中一共展示了ClassCollectionLoader::inline方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: warmUp
/**
* Warms up the cache.
*
* @param string $cacheDir The cache directory
*/
public function warmUp($cacheDir)
{
$classmap = $cacheDir . '/classes.map';
if (!is_file($classmap)) {
return;
}
if (file_exists($cacheDir . '/classes.php')) {
return;
}
$declared = null !== $this->declaredClasses ? $this->declaredClasses : array_merge(get_declared_classes(), get_declared_interfaces(), get_declared_traits());
ClassCollectionLoader::inline(include $classmap, $cacheDir . '/classes.php', $declared);
}
示例2: testInline
public function testInline()
{
$this->assertTrue(class_exists(WarmedClass::class, true));
@unlink($cache = sys_get_temp_dir() . '/inline.php');
$classes = array(WarmedClass::class);
$excluded = array(DeclaredClass::class);
ClassCollectionLoader::inline($classes, $cache, $excluded);
$this->assertSame(<<<'EOTXT'
<?php
namespace Symfony\Component\ClassLoader\Tests\Fixtures
{
interface WarmedInterface
{
}
}
namespace Symfony\Component\ClassLoader\Tests\Fixtures
{
class WarmedClass extends DeclaredClass implements WarmedInterface
{
}
}
EOTXT
, file_get_contents($cache));
unlink($cache);
}
示例3: doBuildBootstrap
public static function doBuildBootstrap($bootstrapDir)
{
$file = $bootstrapDir . '/bootstrap.php.cache';
if (file_exists($file)) {
unlink($file);
}
$classes = array('Symfony\\Component\\HttpFoundation\\ParameterBag', 'Symfony\\Component\\HttpFoundation\\HeaderBag', 'Symfony\\Component\\HttpFoundation\\FileBag', 'Symfony\\Component\\HttpFoundation\\ServerBag', 'Symfony\\Component\\HttpFoundation\\Request', 'Symfony\\Component\\HttpKernel\\Kernel', 'Symfony\\Component\\ClassLoader\\ClassCollectionLoader', 'Symfony\\Component\\ClassLoader\\ApcClassLoader');
if (method_exists('Symfony\\Component\\ClassLoader\\ClassCollectionLoader', 'inline')) {
ClassCollectionLoader::inline($classes, $file, array());
} else {
ClassCollectionLoader::load($classes, dirname($file), basename($file, '.php.cache'), false, false, '.php.cache');
}
$bootstrapContent = substr(file_get_contents($file), 5);
file_put_contents($file, sprintf(<<<'EOF'
<?php
%s
EOF
, $bootstrapContent));
}