initial commit
This commit is contained in:
10
core/Thelia/Thelia.php
Normal file
10
core/Thelia/Thelia.php
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Thelia;
|
||||||
|
|
||||||
|
class Thelia {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
?>
|
||||||
6
core/autoload.php
Normal file
6
core/autoload.php
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
$loader = require_once __DIR__ . "/vendor/autoload.php";
|
||||||
|
|
||||||
|
return $loader;
|
||||||
|
?>
|
||||||
13
core/composer.json
Normal file
13
core/composer.json
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"require":{
|
||||||
|
"symfony/class-loader": "2.1.*",
|
||||||
|
"symfony/http-kernel" : "2.1.*",
|
||||||
|
"symfony/routing" : "2.1.*",
|
||||||
|
"symfony/config" : "2.1.*",
|
||||||
|
"symfony/yaml" : "2.1.*",
|
||||||
|
"symfony/dependency-injection" : "2.1.*",
|
||||||
|
"symfony/console" : "2.1.*",
|
||||||
|
"symfony/event-dispatcher" : "2.1.*"
|
||||||
|
},
|
||||||
|
"minimum-stability": "stable"
|
||||||
|
}
|
||||||
49
core/composer.lock
generated
Normal file
49
core/composer.lock
generated
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
{
|
||||||
|
"hash": "49f3143b77fd4fbd695a56746b52042a",
|
||||||
|
"packages": [
|
||||||
|
{
|
||||||
|
"package": "symfony/class-loader",
|
||||||
|
"version": "v2.1.2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"package": "symfony/config",
|
||||||
|
"version": "v2.1.2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"package": "symfony/console",
|
||||||
|
"version": "v2.1.2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"package": "symfony/dependency-injection",
|
||||||
|
"version": "v2.1.2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"package": "symfony/event-dispatcher",
|
||||||
|
"version": "v2.1.2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"package": "symfony/http-foundation",
|
||||||
|
"version": "v2.1.2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"package": "symfony/http-kernel",
|
||||||
|
"version": "v2.1.2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"package": "symfony/routing",
|
||||||
|
"version": "v2.1.2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"package": "symfony/yaml",
|
||||||
|
"version": "v2.1.2"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"packages-dev": null,
|
||||||
|
"aliases": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"minimum-stability": "stable",
|
||||||
|
"stability-flags": [
|
||||||
|
|
||||||
|
]
|
||||||
|
}
|
||||||
7
core/vendor/autoload.php
vendored
Normal file
7
core/vendor/autoload.php
vendored
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// autoload.php generated by Composer
|
||||||
|
|
||||||
|
require_once __DIR__ . '/composer' . '/autoload_real.php';
|
||||||
|
|
||||||
|
return ComposerAutoloaderInit::getLoader();
|
||||||
207
core/vendor/composer/ClassLoader.php
vendored
Normal file
207
core/vendor/composer/ClassLoader.php
vendored
Normal file
@@ -0,0 +1,207 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Composer.
|
||||||
|
*
|
||||||
|
* (c) Nils Adermann <naderman@naderman.de>
|
||||||
|
* Jordi Boggiano <j.boggiano@seld.be>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Composer\Autoload;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ClassLoader implements a PSR-0 class loader
|
||||||
|
*
|
||||||
|
* See https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md
|
||||||
|
*
|
||||||
|
* $loader = new \Composer\Autoload\ClassLoader();
|
||||||
|
*
|
||||||
|
* // register classes with namespaces
|
||||||
|
* $loader->add('Symfony\Component', __DIR__.'/component');
|
||||||
|
* $loader->add('Symfony', __DIR__.'/framework');
|
||||||
|
*
|
||||||
|
* // activate the autoloader
|
||||||
|
* $loader->register();
|
||||||
|
*
|
||||||
|
* // to enable searching the include path (eg. for PEAR packages)
|
||||||
|
* $loader->setUseIncludePath(true);
|
||||||
|
*
|
||||||
|
* In this example, if you try to use a class in the Symfony\Component
|
||||||
|
* namespace or one of its children (Symfony\Component\Console for instance),
|
||||||
|
* the autoloader will first look for the class under the component/
|
||||||
|
* directory, and it will then fallback to the framework/ directory if not
|
||||||
|
* found before giving up.
|
||||||
|
*
|
||||||
|
* This class is loosely based on the Symfony UniversalClassLoader.
|
||||||
|
*
|
||||||
|
* @author Fabien Potencier <fabien@symfony.com>
|
||||||
|
* @author Jordi Boggiano <j.boggiano@seld.be>
|
||||||
|
*/
|
||||||
|
class ClassLoader
|
||||||
|
{
|
||||||
|
private $prefixes = array();
|
||||||
|
private $fallbackDirs = array();
|
||||||
|
private $useIncludePath = false;
|
||||||
|
private $classMap = array();
|
||||||
|
|
||||||
|
public function getPrefixes()
|
||||||
|
{
|
||||||
|
return $this->prefixes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFallbackDirs()
|
||||||
|
{
|
||||||
|
return $this->fallbackDirs;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getClassMap()
|
||||||
|
{
|
||||||
|
return $this->classMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array $classMap Class to filename map
|
||||||
|
*/
|
||||||
|
public function addClassMap(array $classMap)
|
||||||
|
{
|
||||||
|
if ($this->classMap) {
|
||||||
|
$this->classMap = array_merge($this->classMap, $classMap);
|
||||||
|
} else {
|
||||||
|
$this->classMap = $classMap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers a set of classes
|
||||||
|
*
|
||||||
|
* @param string $prefix The classes prefix
|
||||||
|
* @param array|string $paths The location(s) of the classes
|
||||||
|
*/
|
||||||
|
public function add($prefix, $paths)
|
||||||
|
{
|
||||||
|
if (!$prefix) {
|
||||||
|
foreach ((array) $paths as $path) {
|
||||||
|
$this->fallbackDirs[] = $path;
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (isset($this->prefixes[$prefix])) {
|
||||||
|
$this->prefixes[$prefix] = array_merge(
|
||||||
|
$this->prefixes[$prefix],
|
||||||
|
(array) $paths
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$this->prefixes[$prefix] = (array) $paths;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Turns on searching the include path for class files.
|
||||||
|
*
|
||||||
|
* @param bool $useIncludePath
|
||||||
|
*/
|
||||||
|
public function setUseIncludePath($useIncludePath)
|
||||||
|
{
|
||||||
|
$this->useIncludePath = $useIncludePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Can be used to check if the autoloader uses the include path to check
|
||||||
|
* for classes.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function getUseIncludePath()
|
||||||
|
{
|
||||||
|
return $this->useIncludePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers this instance as an autoloader.
|
||||||
|
*
|
||||||
|
* @param bool $prepend Whether to prepend the autoloader or not
|
||||||
|
*/
|
||||||
|
public function register($prepend = false)
|
||||||
|
{
|
||||||
|
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unregisters this instance as an autoloader.
|
||||||
|
*/
|
||||||
|
public function unregister()
|
||||||
|
{
|
||||||
|
spl_autoload_unregister(array($this, 'loadClass'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads the given class or interface.
|
||||||
|
*
|
||||||
|
* @param string $class The name of the class
|
||||||
|
* @return bool|null True, if loaded
|
||||||
|
*/
|
||||||
|
public function loadClass($class)
|
||||||
|
{
|
||||||
|
if ($file = $this->findFile($class)) {
|
||||||
|
include $file;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds the path to the file where the class is defined.
|
||||||
|
*
|
||||||
|
* @param string $class The name of the class
|
||||||
|
*
|
||||||
|
* @return string|null The path, if found
|
||||||
|
*/
|
||||||
|
public function findFile($class)
|
||||||
|
{
|
||||||
|
if (isset($this->classMap[$class])) {
|
||||||
|
return $this->classMap[$class];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ('\\' == $class[0]) {
|
||||||
|
$class = substr($class, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (false !== $pos = strrpos($class, '\\')) {
|
||||||
|
// namespaced class name
|
||||||
|
$classPath = str_replace('\\', DIRECTORY_SEPARATOR, substr($class, 0, $pos)) . DIRECTORY_SEPARATOR;
|
||||||
|
$className = substr($class, $pos + 1);
|
||||||
|
} else {
|
||||||
|
// PEAR-like class name
|
||||||
|
$classPath = null;
|
||||||
|
$className = $class;
|
||||||
|
}
|
||||||
|
|
||||||
|
$classPath .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php';
|
||||||
|
|
||||||
|
foreach ($this->prefixes as $prefix => $dirs) {
|
||||||
|
if (0 === strpos($class, $prefix)) {
|
||||||
|
foreach ($dirs as $dir) {
|
||||||
|
if (file_exists($dir . DIRECTORY_SEPARATOR . $classPath)) {
|
||||||
|
return $dir . DIRECTORY_SEPARATOR . $classPath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($this->fallbackDirs as $dir) {
|
||||||
|
if (file_exists($dir . DIRECTORY_SEPARATOR . $classPath)) {
|
||||||
|
return $dir . DIRECTORY_SEPARATOR . $classPath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->useIncludePath && $file = stream_resolve_include_path($classPath)) {
|
||||||
|
return $file;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->classMap[$class] = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
9
core/vendor/composer/autoload_classmap.php
vendored
Normal file
9
core/vendor/composer/autoload_classmap.php
vendored
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// autoload_classmap.php generated by Composer
|
||||||
|
|
||||||
|
$vendorDir = dirname(__DIR__);
|
||||||
|
$baseDir = dirname($vendorDir);
|
||||||
|
|
||||||
|
return array(
|
||||||
|
);
|
||||||
19
core/vendor/composer/autoload_namespaces.php
vendored
Normal file
19
core/vendor/composer/autoload_namespaces.php
vendored
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// autoload_namespaces.php generated by Composer
|
||||||
|
|
||||||
|
$vendorDir = dirname(__DIR__);
|
||||||
|
$baseDir = dirname($vendorDir);
|
||||||
|
|
||||||
|
return array(
|
||||||
|
'Symfony\\Component\\Yaml' => $vendorDir . '/symfony/yaml/',
|
||||||
|
'Symfony\\Component\\Routing' => $vendorDir . '/symfony/routing/',
|
||||||
|
'Symfony\\Component\\HttpKernel' => $vendorDir . '/symfony/http-kernel/',
|
||||||
|
'Symfony\\Component\\HttpFoundation' => $vendorDir . '/symfony/http-foundation/',
|
||||||
|
'Symfony\\Component\\EventDispatcher' => $vendorDir . '/symfony/event-dispatcher/',
|
||||||
|
'Symfony\\Component\\DependencyInjection' => $vendorDir . '/symfony/dependency-injection/',
|
||||||
|
'Symfony\\Component\\Console' => $vendorDir . '/symfony/console/',
|
||||||
|
'Symfony\\Component\\Config' => $vendorDir . '/symfony/config/',
|
||||||
|
'Symfony\\Component\\ClassLoader' => $vendorDir . '/symfony/class-loader/',
|
||||||
|
'SessionHandlerInterface' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Resources/stubs',
|
||||||
|
);
|
||||||
29
core/vendor/composer/autoload_real.php
vendored
Normal file
29
core/vendor/composer/autoload_real.php
vendored
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// autoload_real.php generated by Composer
|
||||||
|
|
||||||
|
require __DIR__ . '/ClassLoader.php';
|
||||||
|
|
||||||
|
class ComposerAutoloaderInit
|
||||||
|
{
|
||||||
|
public static function getLoader()
|
||||||
|
{
|
||||||
|
$loader = new \Composer\Autoload\ClassLoader();
|
||||||
|
$vendorDir = dirname(__DIR__);
|
||||||
|
$baseDir = dirname($vendorDir);
|
||||||
|
|
||||||
|
$map = require __DIR__ . '/autoload_namespaces.php';
|
||||||
|
foreach ($map as $namespace => $path) {
|
||||||
|
$loader->add($namespace, $path);
|
||||||
|
}
|
||||||
|
|
||||||
|
$classMap = require __DIR__ . '/autoload_classmap.php';
|
||||||
|
if ($classMap) {
|
||||||
|
$loader->addClassMap($classMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
$loader->register();
|
||||||
|
|
||||||
|
return $loader;
|
||||||
|
}
|
||||||
|
}
|
||||||
349
core/vendor/composer/installed.json
vendored
Normal file
349
core/vendor/composer/installed.json
vendored
Normal file
@@ -0,0 +1,349 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"name": "symfony/http-foundation",
|
||||||
|
"version": "v2.1.2",
|
||||||
|
"version_normalized": "2.1.2.0",
|
||||||
|
"target-dir": "Symfony/Component/HttpFoundation",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/symfony/HttpFoundation",
|
||||||
|
"reference": "v2.1.2"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://github.com/symfony/HttpFoundation/zipball/v2.1.2",
|
||||||
|
"reference": "v2.1.2",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.3.3"
|
||||||
|
},
|
||||||
|
"time": "2012-09-18 14:09:52",
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "2.1-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"installation-source": "dist",
|
||||||
|
"autoload": {
|
||||||
|
"psr-0": {
|
||||||
|
"Symfony\\Component\\HttpFoundation": "",
|
||||||
|
"SessionHandlerInterface": "Symfony/Component/HttpFoundation/Resources/stubs"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "symfony/event-dispatcher",
|
||||||
|
"version": "v2.1.2",
|
||||||
|
"version_normalized": "2.1.2.0",
|
||||||
|
"target-dir": "Symfony/Component/EventDispatcher",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/symfony/EventDispatcher",
|
||||||
|
"reference": "v2.1.2"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://github.com/symfony/EventDispatcher/zipball/v2.1.2",
|
||||||
|
"reference": "v2.1.2",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.3.3"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"symfony/dependency-injection": "2.1.*"
|
||||||
|
},
|
||||||
|
"suggest": {
|
||||||
|
"symfony/dependency-injection": "2.1.*",
|
||||||
|
"symfony/http-kernel": "2.1.*"
|
||||||
|
},
|
||||||
|
"time": "2012-09-10 08:53:42",
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "2.1-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"installation-source": "dist",
|
||||||
|
"autoload": {
|
||||||
|
"psr-0": {
|
||||||
|
"Symfony\\Component\\EventDispatcher": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "symfony/http-kernel",
|
||||||
|
"version": "v2.1.2",
|
||||||
|
"version_normalized": "2.1.2.0",
|
||||||
|
"target-dir": "Symfony/Component/HttpKernel",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/symfony/HttpKernel",
|
||||||
|
"reference": "v2.1.2"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://github.com/symfony/HttpKernel/zipball/v2.1.2",
|
||||||
|
"reference": "v2.1.2",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.3.3",
|
||||||
|
"symfony/event-dispatcher": "2.1.*",
|
||||||
|
"symfony/http-foundation": "2.1.*"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"symfony/browser-kit": "2.1.*",
|
||||||
|
"symfony/class-loader": "2.1.*",
|
||||||
|
"symfony/config": "2.1.*",
|
||||||
|
"symfony/console": "2.1.*",
|
||||||
|
"symfony/dependency-injection": "2.1.*",
|
||||||
|
"symfony/finder": "2.1.*",
|
||||||
|
"symfony/process": "2.1.*",
|
||||||
|
"symfony/routing": "2.1.*"
|
||||||
|
},
|
||||||
|
"suggest": {
|
||||||
|
"symfony/browser-kit": "2.1.*",
|
||||||
|
"symfony/class-loader": "2.1.*",
|
||||||
|
"symfony/config": "2.1.*",
|
||||||
|
"symfony/console": "2.1.*",
|
||||||
|
"symfony/dependency-injection": "2.1.*",
|
||||||
|
"symfony/finder": "2.1.*"
|
||||||
|
},
|
||||||
|
"time": "2012-09-20 05:13:00",
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "2.1-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"installation-source": "dist",
|
||||||
|
"autoload": {
|
||||||
|
"psr-0": {
|
||||||
|
"Symfony\\Component\\HttpKernel": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "symfony/routing",
|
||||||
|
"version": "v2.1.2",
|
||||||
|
"version_normalized": "2.1.2.0",
|
||||||
|
"target-dir": "Symfony/Component/Routing",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/symfony/Routing",
|
||||||
|
"reference": "v2.1.2"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://github.com/symfony/Routing/zipball/v2.1.2",
|
||||||
|
"reference": "v2.1.2",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.3.3"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"symfony/config": "2.1.*",
|
||||||
|
"symfony/yaml": "2.1.*",
|
||||||
|
"symfony/http-kernel": "2.1.*",
|
||||||
|
"doctrine/common": ">=2.2,<2.4-dev"
|
||||||
|
},
|
||||||
|
"suggest": {
|
||||||
|
"symfony/config": "2.1.*",
|
||||||
|
"symfony/yaml": "2.1.*",
|
||||||
|
"doctrine/common": ">=2.2,<2.4-dev"
|
||||||
|
},
|
||||||
|
"time": "2012-09-10 08:53:42",
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "2.1-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"installation-source": "dist",
|
||||||
|
"autoload": {
|
||||||
|
"psr-0": {
|
||||||
|
"Symfony\\Component\\Routing": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "symfony/config",
|
||||||
|
"version": "v2.1.2",
|
||||||
|
"version_normalized": "2.1.2.0",
|
||||||
|
"target-dir": "Symfony/Component/Config",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/symfony/Config",
|
||||||
|
"reference": "v2.1.0-RC2"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://github.com/symfony/Config/zipball/v2.1.0-RC2",
|
||||||
|
"reference": "v2.1.0-RC2",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.3.3"
|
||||||
|
},
|
||||||
|
"time": "2012-08-22 11:48:41",
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "2.1-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"installation-source": "dist",
|
||||||
|
"autoload": {
|
||||||
|
"psr-0": {
|
||||||
|
"Symfony\\Component\\Config": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "symfony/yaml",
|
||||||
|
"version": "v2.1.2",
|
||||||
|
"version_normalized": "2.1.2.0",
|
||||||
|
"target-dir": "Symfony/Component/Yaml",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/symfony/Yaml",
|
||||||
|
"reference": "v2.1.0-RC2"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://github.com/symfony/Yaml/zipball/v2.1.0-RC2",
|
||||||
|
"reference": "v2.1.0-RC2",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.3.3"
|
||||||
|
},
|
||||||
|
"time": "2012-08-22 11:48:41",
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "2.1-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"installation-source": "dist",
|
||||||
|
"autoload": {
|
||||||
|
"psr-0": {
|
||||||
|
"Symfony\\Component\\Yaml": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "symfony/dependency-injection",
|
||||||
|
"version": "v2.1.2",
|
||||||
|
"version_normalized": "2.1.2.0",
|
||||||
|
"target-dir": "Symfony/Component/DependencyInjection",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/symfony/DependencyInjection",
|
||||||
|
"reference": "v2.1.2"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://github.com/symfony/DependencyInjection/zipball/v2.1.2",
|
||||||
|
"reference": "v2.1.2",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.3.3"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"symfony/yaml": "2.1.*",
|
||||||
|
"symfony/config": "2.1.*"
|
||||||
|
},
|
||||||
|
"suggest": {
|
||||||
|
"symfony/yaml": "2.1.*",
|
||||||
|
"symfony/config": "2.1.*"
|
||||||
|
},
|
||||||
|
"time": "2012-09-17 18:41:57",
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "2.1-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"installation-source": "dist",
|
||||||
|
"autoload": {
|
||||||
|
"psr-0": {
|
||||||
|
"Symfony\\Component\\DependencyInjection": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "symfony/console",
|
||||||
|
"version": "v2.1.2",
|
||||||
|
"version_normalized": "2.1.2.0",
|
||||||
|
"target-dir": "Symfony/Component/Console",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/symfony/Console",
|
||||||
|
"reference": "v2.1.0-RC2"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://github.com/symfony/Console/zipball/v2.1.0-RC2",
|
||||||
|
"reference": "v2.1.0-RC2",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.3.3"
|
||||||
|
},
|
||||||
|
"time": "2012-08-22 11:48:41",
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "2.1-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"installation-source": "dist",
|
||||||
|
"autoload": {
|
||||||
|
"psr-0": {
|
||||||
|
"Symfony\\Component\\Console": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "symfony/class-loader",
|
||||||
|
"version": "v2.1.2",
|
||||||
|
"version_normalized": "2.1.2.0",
|
||||||
|
"target-dir": "Symfony/Component/ClassLoader",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/symfony/ClassLoader",
|
||||||
|
"reference": "v2.1.2"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://github.com/symfony/ClassLoader/zipball/v2.1.2",
|
||||||
|
"reference": "v2.1.2",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.3.3"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"symfony/finder": "2.1.*"
|
||||||
|
},
|
||||||
|
"time": "2012-09-01 07:02:36",
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "2.1-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"installation-source": "dist",
|
||||||
|
"autoload": {
|
||||||
|
"psr-0": {
|
||||||
|
"Symfony\\Component\\ClassLoader": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
2
core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/.gitignore
vendored
Normal file
2
core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
vendor/
|
||||||
|
composer.lock
|
||||||
118
core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/ApcClassLoader.php
vendored
Normal file
118
core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/ApcClassLoader.php
vendored
Normal file
@@ -0,0 +1,118 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien@symfony.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Symfony\Component\ClassLoader;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ApcClassLoader implements a wrapping autoloader cached in APC for PHP 5.3.
|
||||||
|
*
|
||||||
|
* It expects an object implementing a findFile method to find the file. This
|
||||||
|
* allow using it as a wrapper around the other loaders of the component (the
|
||||||
|
* ClassLoader and the UniversalClassLoader for instance) but also around any
|
||||||
|
* other autoloader following this convention (the Composer one for instance)
|
||||||
|
*
|
||||||
|
* $loader = new ClassLoader();
|
||||||
|
*
|
||||||
|
* // register classes with namespaces
|
||||||
|
* $loader->add('Symfony\Component', __DIR__.'/component');
|
||||||
|
* $loader->add('Symfony', __DIR__.'/framework');
|
||||||
|
*
|
||||||
|
* $cachedLoader = new ApcClassLoader('my_prefix', $loader);
|
||||||
|
*
|
||||||
|
* // activate the cached autoloader
|
||||||
|
* $cachedLoader->register();
|
||||||
|
*
|
||||||
|
* // eventually deactivate the non-cached loader if it was registered previously
|
||||||
|
* // to be sure to use the cached one.
|
||||||
|
* $loader->unregister();
|
||||||
|
*
|
||||||
|
* @author Fabien Potencier <fabien@symfony.com>
|
||||||
|
* @author Kris Wallsmith <kris@symfony.com>
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
class ApcClassLoader
|
||||||
|
{
|
||||||
|
private $prefix;
|
||||||
|
private $classFinder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param string $prefix A prefix to create a namespace in APC
|
||||||
|
* @param object $classFinder An object that implements findFile() method.
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
public function __construct($prefix, $classFinder)
|
||||||
|
{
|
||||||
|
if (!extension_loaded('apc')) {
|
||||||
|
throw new \RuntimeException('Unable to use ApcClassLoader as APC is not enabled.');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!method_exists($classFinder, 'findFile')) {
|
||||||
|
throw new \InvalidArgumentException('The class finder must implement a "findFile" method.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->prefix = $prefix;
|
||||||
|
$this->classFinder = $classFinder;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers this instance as an autoloader.
|
||||||
|
*
|
||||||
|
* @param Boolean $prepend Whether to prepend the autoloader or not
|
||||||
|
*/
|
||||||
|
public function register($prepend = false)
|
||||||
|
{
|
||||||
|
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unregisters this instance as an autoloader.
|
||||||
|
*/
|
||||||
|
public function unregister()
|
||||||
|
{
|
||||||
|
spl_autoload_unregister(array($this, 'loadClass'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads the given class or interface.
|
||||||
|
*
|
||||||
|
* @param string $class The name of the class
|
||||||
|
*
|
||||||
|
* @return Boolean|null True, if loaded
|
||||||
|
*/
|
||||||
|
public function loadClass($class)
|
||||||
|
{
|
||||||
|
if ($file = $this->findFile($class)) {
|
||||||
|
require $file;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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->classFinder->findFile($class));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $file;
|
||||||
|
}
|
||||||
|
}
|
||||||
98
core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/ApcUniversalClassLoader.php
vendored
Normal file
98
core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/ApcUniversalClassLoader.php
vendored
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien@symfony.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Symfony\Component\ClassLoader;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ApcUniversalClassLoader implements a "universal" autoloader cached in APC for PHP 5.3.
|
||||||
|
*
|
||||||
|
* It is able to load classes that use either:
|
||||||
|
*
|
||||||
|
* * The technical interoperability standards for PHP 5.3 namespaces and
|
||||||
|
* class names (https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md);
|
||||||
|
*
|
||||||
|
* * The PEAR naming convention for classes (http://pear.php.net/).
|
||||||
|
*
|
||||||
|
* Classes from a sub-namespace or a sub-hierarchy of PEAR classes can be
|
||||||
|
* looked for in a list of locations to ease the vendoring of a sub-set of
|
||||||
|
* classes for large projects.
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
*
|
||||||
|
* require 'vendor/symfony/src/Symfony/Component/ClassLoader/UniversalClassLoader.php';
|
||||||
|
* require 'vendor/symfony/src/Symfony/Component/ClassLoader/ApcUniversalClassLoader.php';
|
||||||
|
*
|
||||||
|
* use Symfony\Component\ClassLoader\ApcUniversalClassLoader;
|
||||||
|
*
|
||||||
|
* $loader = new ApcUniversalClassLoader('apc.prefix.');
|
||||||
|
*
|
||||||
|
* // register classes with namespaces
|
||||||
|
* $loader->registerNamespaces(array(
|
||||||
|
* 'Symfony\Component' => __DIR__.'/component',
|
||||||
|
* 'Symfony' => __DIR__.'/framework',
|
||||||
|
* 'Sensio' => array(__DIR__.'/src', __DIR__.'/vendor'),
|
||||||
|
* ));
|
||||||
|
*
|
||||||
|
* // register a library using the PEAR naming convention
|
||||||
|
* $loader->registerPrefixes(array(
|
||||||
|
* 'Swift_' => __DIR__.'/Swift',
|
||||||
|
* ));
|
||||||
|
*
|
||||||
|
* // activate the autoloader
|
||||||
|
* $loader->register();
|
||||||
|
*
|
||||||
|
* In this example, if you try to use a class in the Symfony\Component
|
||||||
|
* namespace or one of its children (Symfony\Component\Console for instance),
|
||||||
|
* the autoloader will first look for the class under the component/
|
||||||
|
* directory, and it will then fallback to the framework/ directory if not
|
||||||
|
* found before giving up.
|
||||||
|
*
|
||||||
|
* @author Fabien Potencier <fabien@symfony.com>
|
||||||
|
* @author Kris Wallsmith <kris@symfony.com>
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
class ApcUniversalClassLoader extends UniversalClassLoader
|
||||||
|
{
|
||||||
|
private $prefix;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param string $prefix A prefix to create a namespace in APC
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
public function __construct($prefix)
|
||||||
|
{
|
||||||
|
if (!extension_loaded('apc')) {
|
||||||
|
throw new \RuntimeException('Unable to use ApcUniversalClassLoader as APC is not enabled.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->prefix = $prefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds a file by class name while caching lookups to APC.
|
||||||
|
*
|
||||||
|
* @param string $class A class name to resolve to file
|
||||||
|
*
|
||||||
|
* @return string|null The path, if found
|
||||||
|
*/
|
||||||
|
public function findFile($class)
|
||||||
|
{
|
||||||
|
if (false === $file = apc_fetch($this->prefix.$class)) {
|
||||||
|
apc_store($this->prefix.$class, $file = parent::findFile($class));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $file;
|
||||||
|
}
|
||||||
|
}
|
||||||
15
core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/CHANGELOG.md
vendored
Normal file
15
core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/CHANGELOG.md
vendored
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
CHANGELOG
|
||||||
|
=========
|
||||||
|
|
||||||
|
2.1.0
|
||||||
|
-----
|
||||||
|
|
||||||
|
* added a DebugClassLoader able to wrap any autoloader providing a findFile
|
||||||
|
method
|
||||||
|
* added a new ApcClassLoader and XcacheClassLoader using composition to wrap
|
||||||
|
other loaders
|
||||||
|
* added a new ClassLoader which does not distinguish between namespaced and
|
||||||
|
pear-like classes (as the PEAR convention is a subset of PSR-0) and
|
||||||
|
supports using Composer's namespace maps
|
||||||
|
* added a class map generator
|
||||||
|
* added support for loading globally-installed PEAR packages
|
||||||
320
core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/ClassCollectionLoader.php
vendored
Normal file
320
core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/ClassCollectionLoader.php
vendored
Normal file
@@ -0,0 +1,320 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien@symfony.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Symfony\Component\ClassLoader;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ClassCollectionLoader.
|
||||||
|
*
|
||||||
|
* @author Fabien Potencier <fabien@symfony.com>
|
||||||
|
*/
|
||||||
|
class ClassCollectionLoader
|
||||||
|
{
|
||||||
|
private static $loaded;
|
||||||
|
private static $seen;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads a list of classes and caches them in one big file.
|
||||||
|
*
|
||||||
|
* @param array $classes An array of classes to load
|
||||||
|
* @param string $cacheDir A cache directory
|
||||||
|
* @param string $name The cache name prefix
|
||||||
|
* @param Boolean $autoReload Whether to flush the cache when the cache is stale or not
|
||||||
|
* @param Boolean $adaptive Whether to remove already declared classes or not
|
||||||
|
* @param string $extension File extension of the resulting file
|
||||||
|
*
|
||||||
|
* @throws \InvalidArgumentException When class can't be loaded
|
||||||
|
*/
|
||||||
|
public static function load($classes, $cacheDir, $name, $autoReload, $adaptive = false, $extension = '.php')
|
||||||
|
{
|
||||||
|
// each $name can only be loaded once per PHP process
|
||||||
|
if (isset(self::$loaded[$name])) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
self::$loaded[$name] = true;
|
||||||
|
|
||||||
|
$declared = array_merge(get_declared_classes(), get_declared_interfaces());
|
||||||
|
if (function_exists('get_declared_traits')) {
|
||||||
|
$declared = array_merge($declared, get_declared_traits());
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($adaptive) {
|
||||||
|
// don't include already declared classes
|
||||||
|
$classes = array_diff($classes, $declared);
|
||||||
|
|
||||||
|
// the cache is different depending on which classes are already declared
|
||||||
|
$name = $name.'-'.substr(md5(implode('|', $classes)), 0, 5);
|
||||||
|
}
|
||||||
|
|
||||||
|
$classes = array_unique($classes);
|
||||||
|
|
||||||
|
$cache = $cacheDir.'/'.$name.$extension;
|
||||||
|
|
||||||
|
// auto-reload
|
||||||
|
$reload = false;
|
||||||
|
if ($autoReload) {
|
||||||
|
$metadata = $cacheDir.'/'.$name.$extension.'.meta';
|
||||||
|
if (!is_file($metadata) || !is_file($cache)) {
|
||||||
|
$reload = true;
|
||||||
|
} else {
|
||||||
|
$time = filemtime($cache);
|
||||||
|
$meta = unserialize(file_get_contents($metadata));
|
||||||
|
|
||||||
|
sort($meta[1]);
|
||||||
|
sort($classes);
|
||||||
|
|
||||||
|
if ($meta[1] != $classes) {
|
||||||
|
$reload = true;
|
||||||
|
} else {
|
||||||
|
foreach ($meta[0] as $resource) {
|
||||||
|
if (!is_file($resource) || filemtime($resource) > $time) {
|
||||||
|
$reload = true;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$reload && is_file($cache)) {
|
||||||
|
require_once $cache;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$files = array();
|
||||||
|
$content = '';
|
||||||
|
foreach (self::getOrderedClasses($classes) as $class) {
|
||||||
|
if (in_array($class->getName(), $declared)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$files[] = $class->getFileName();
|
||||||
|
|
||||||
|
$c = preg_replace(array('/^\s*<\?php/', '/\?>\s*$/'), '', file_get_contents($class->getFileName()));
|
||||||
|
|
||||||
|
// add namespace declaration for global code
|
||||||
|
if (!$class->inNamespace()) {
|
||||||
|
$c = "\nnamespace\n{\n".self::stripComments($c)."\n}\n";
|
||||||
|
} else {
|
||||||
|
$c = self::fixNamespaceDeclarations('<?php '.$c);
|
||||||
|
$c = preg_replace('/^\s*<\?php/', '', $c);
|
||||||
|
}
|
||||||
|
|
||||||
|
$content .= $c;
|
||||||
|
}
|
||||||
|
|
||||||
|
// cache the core classes
|
||||||
|
if (!is_dir(dirname($cache))) {
|
||||||
|
mkdir(dirname($cache), 0777, true);
|
||||||
|
}
|
||||||
|
self::writeCacheFile($cache, '<?php '.$content);
|
||||||
|
|
||||||
|
if ($autoReload) {
|
||||||
|
// save the resources
|
||||||
|
self::writeCacheFile($metadata, serialize(array($files, $classes)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds brackets around each namespace if it's not already the case.
|
||||||
|
*
|
||||||
|
* @param string $source Namespace string
|
||||||
|
*
|
||||||
|
* @return string Namespaces with brackets
|
||||||
|
*/
|
||||||
|
public static function fixNamespaceDeclarations($source)
|
||||||
|
{
|
||||||
|
if (!function_exists('token_get_all')) {
|
||||||
|
return $source;
|
||||||
|
}
|
||||||
|
|
||||||
|
$output = '';
|
||||||
|
$inNamespace = false;
|
||||||
|
$tokens = token_get_all($source);
|
||||||
|
|
||||||
|
for ($i = 0, $max = count($tokens); $i < $max; $i++) {
|
||||||
|
$token = $tokens[$i];
|
||||||
|
if (is_string($token)) {
|
||||||
|
$output .= $token;
|
||||||
|
} elseif (in_array($token[0], array(T_COMMENT, T_DOC_COMMENT))) {
|
||||||
|
// strip comments
|
||||||
|
continue;
|
||||||
|
} elseif (T_NAMESPACE === $token[0]) {
|
||||||
|
if ($inNamespace) {
|
||||||
|
$output .= "}\n";
|
||||||
|
}
|
||||||
|
$output .= $token[1];
|
||||||
|
|
||||||
|
// namespace name and whitespaces
|
||||||
|
while (($t = $tokens[++$i]) && is_array($t) && in_array($t[0], array(T_WHITESPACE, T_NS_SEPARATOR, T_STRING))) {
|
||||||
|
$output .= $t[1];
|
||||||
|
}
|
||||||
|
if (is_string($t) && '{' === $t) {
|
||||||
|
$inNamespace = false;
|
||||||
|
--$i;
|
||||||
|
} else {
|
||||||
|
$output = rtrim($output);
|
||||||
|
$output .= "\n{";
|
||||||
|
$inNamespace = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$output .= $token[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($inNamespace) {
|
||||||
|
$output .= "}\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
return $output;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Writes a cache file.
|
||||||
|
*
|
||||||
|
* @param string $file Filename
|
||||||
|
* @param string $content Temporary file content
|
||||||
|
*
|
||||||
|
* @throws \RuntimeException when a cache file cannot be written
|
||||||
|
*/
|
||||||
|
private static function writeCacheFile($file, $content)
|
||||||
|
{
|
||||||
|
$tmpFile = tempnam(dirname($file), basename($file));
|
||||||
|
if (false !== @file_put_contents($tmpFile, $content) && @rename($tmpFile, $file)) {
|
||||||
|
@chmod($file, 0666 & ~umask());
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new \RuntimeException(sprintf('Failed to write cache file "%s".', $file));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes comments from a PHP source string.
|
||||||
|
*
|
||||||
|
* We don't use the PHP php_strip_whitespace() function
|
||||||
|
* as we want the content to be readable and well-formatted.
|
||||||
|
*
|
||||||
|
* @param string $source A PHP string
|
||||||
|
*
|
||||||
|
* @return string The PHP string with the comments removed
|
||||||
|
*/
|
||||||
|
private static function stripComments($source)
|
||||||
|
{
|
||||||
|
if (!function_exists('token_get_all')) {
|
||||||
|
return $source;
|
||||||
|
}
|
||||||
|
|
||||||
|
$output = '';
|
||||||
|
foreach (token_get_all($source) as $token) {
|
||||||
|
if (is_string($token)) {
|
||||||
|
$output .= $token;
|
||||||
|
} elseif (!in_array($token[0], array(T_COMMENT, T_DOC_COMMENT))) {
|
||||||
|
$output .= $token[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// replace multiple new lines with a single newline
|
||||||
|
$output = preg_replace(array('/\s+$/Sm', '/\n+/S'), "\n", $output);
|
||||||
|
|
||||||
|
return $output;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets an ordered array of passed classes including all their dependencies.
|
||||||
|
*
|
||||||
|
* @param array $classes
|
||||||
|
*
|
||||||
|
* @return array An array of sorted \ReflectionClass instances (dependencies added if needed)
|
||||||
|
*
|
||||||
|
* @throws \InvalidArgumentException When a class can't be loaded
|
||||||
|
*/
|
||||||
|
private static function getOrderedClasses(array $classes)
|
||||||
|
{
|
||||||
|
$map = array();
|
||||||
|
self::$seen = array();
|
||||||
|
foreach ($classes as $class) {
|
||||||
|
try {
|
||||||
|
$reflectionClass = new \ReflectionClass($class);
|
||||||
|
} catch (\ReflectionException $e) {
|
||||||
|
throw new \InvalidArgumentException(sprintf('Unable to load class "%s"', $class));
|
||||||
|
}
|
||||||
|
|
||||||
|
$map = array_merge($map, self::getClassHierarchy($reflectionClass));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $map;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function getClassHierarchy(\ReflectionClass $class)
|
||||||
|
{
|
||||||
|
if (isset(self::$seen[$class->getName()])) {
|
||||||
|
return array();
|
||||||
|
}
|
||||||
|
|
||||||
|
self::$seen[$class->getName()] = true;
|
||||||
|
|
||||||
|
$classes = array($class);
|
||||||
|
$parent = $class;
|
||||||
|
while (($parent = $parent->getParentClass()) && $parent->isUserDefined() && !isset(self::$seen[$parent->getName()])) {
|
||||||
|
self::$seen[$parent->getName()] = true;
|
||||||
|
|
||||||
|
array_unshift($classes, $parent);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (function_exists('get_declared_traits')) {
|
||||||
|
foreach ($classes as $c) {
|
||||||
|
foreach (self::getTraits($c) as $trait) {
|
||||||
|
self::$seen[$trait->getName()] = true;
|
||||||
|
|
||||||
|
array_unshift($classes, $trait);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return array_merge(self::getInterfaces($class), $classes);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function getInterfaces(\ReflectionClass $class)
|
||||||
|
{
|
||||||
|
$classes = array();
|
||||||
|
|
||||||
|
foreach ($class->getInterfaces() as $interface) {
|
||||||
|
$classes = array_merge($classes, self::getInterfaces($interface));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($class->isUserDefined() && $class->isInterface() && !isset(self::$seen[$class->getName()])) {
|
||||||
|
self::$seen[$class->getName()] = true;
|
||||||
|
|
||||||
|
$classes[] = $class;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $classes;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function getTraits(\ReflectionClass $class)
|
||||||
|
{
|
||||||
|
$traits = $class->getTraits();
|
||||||
|
$classes = array();
|
||||||
|
while ($trait = array_pop($traits)) {
|
||||||
|
if ($trait->isUserDefined() && !isset(self::$seen[$trait->getName()])) {
|
||||||
|
$classes[] = $trait;
|
||||||
|
|
||||||
|
$traits = array_merge($traits, $trait->getTraits());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $classes;
|
||||||
|
}
|
||||||
|
}
|
||||||
203
core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/ClassLoader.php
vendored
Normal file
203
core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/ClassLoader.php
vendored
Normal file
@@ -0,0 +1,203 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien@symfony.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Symfony\Component\ClassLoader;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ClassLoader implements an PSR-0 class loader
|
||||||
|
*
|
||||||
|
* See https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md
|
||||||
|
*
|
||||||
|
* $loader = new ClassLoader();
|
||||||
|
*
|
||||||
|
* // register classes with namespaces
|
||||||
|
* $loader->addPrefix('Symfony\Component', __DIR__.'/component');
|
||||||
|
* $loader->addPrefix('Symfony', __DIR__.'/framework');
|
||||||
|
*
|
||||||
|
* // activate the autoloader
|
||||||
|
* $loader->register();
|
||||||
|
*
|
||||||
|
* // to enable searching the include path (e.g. for PEAR packages)
|
||||||
|
* $loader->setUseIncludePath(true);
|
||||||
|
*
|
||||||
|
* In this example, if you try to use a class in the Symfony\Component
|
||||||
|
* namespace or one of its children (Symfony\Component\Console for instance),
|
||||||
|
* the autoloader will first look for the class under the component/
|
||||||
|
* directory, and it will then fallback to the framework/ directory if not
|
||||||
|
* found before giving up.
|
||||||
|
*
|
||||||
|
* @author Fabien Potencier <fabien@symfony.com>
|
||||||
|
* @author Jordi Boggiano <j.boggiano@seld.be>
|
||||||
|
*/
|
||||||
|
class ClassLoader
|
||||||
|
{
|
||||||
|
private $prefixes = array();
|
||||||
|
private $fallbackDirs = array();
|
||||||
|
private $useIncludePath = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns prefixes.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getPrefixes()
|
||||||
|
{
|
||||||
|
return $this->prefixes;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns fallback directories.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getFallbackDirs()
|
||||||
|
{
|
||||||
|
return $this->fallbackDirs;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds prefixes.
|
||||||
|
*
|
||||||
|
* @param array $prefixes Prefixes to add
|
||||||
|
*/
|
||||||
|
public function addPrefixes(array $prefixes)
|
||||||
|
{
|
||||||
|
foreach ($prefixes as $prefix => $path) {
|
||||||
|
$this->addPrefix($prefix, $path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers a set of classes
|
||||||
|
*
|
||||||
|
* @param string $prefix The classes prefix
|
||||||
|
* @param array|string $paths The location(s) of the classes
|
||||||
|
*/
|
||||||
|
public function addPrefix($prefix, $paths)
|
||||||
|
{
|
||||||
|
if (!$prefix) {
|
||||||
|
foreach ((array) $paths as $path) {
|
||||||
|
$this->fallbackDirs[] = $path;
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (isset($this->prefixes[$prefix])) {
|
||||||
|
$this->prefixes[$prefix] = array_merge(
|
||||||
|
$this->prefixes[$prefix],
|
||||||
|
(array) $paths
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$this->prefixes[$prefix] = (array) $paths;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Turns on searching the include for class files.
|
||||||
|
*
|
||||||
|
* @param Boolean $useIncludePath
|
||||||
|
*/
|
||||||
|
public function setUseIncludePath($useIncludePath)
|
||||||
|
{
|
||||||
|
$this->useIncludePath = $useIncludePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Can be used to check if the autoloader uses the include path to check
|
||||||
|
* for classes.
|
||||||
|
*
|
||||||
|
* @return Boolean
|
||||||
|
*/
|
||||||
|
public function getUseIncludePath()
|
||||||
|
{
|
||||||
|
return $this->useIncludePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers this instance as an autoloader.
|
||||||
|
*
|
||||||
|
* @param Boolean $prepend Whether to prepend the autoloader or not
|
||||||
|
*/
|
||||||
|
public function register($prepend = false)
|
||||||
|
{
|
||||||
|
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unregisters this instance as an autoloader.
|
||||||
|
*/
|
||||||
|
public function unregister()
|
||||||
|
{
|
||||||
|
spl_autoload_unregister(array($this, 'loadClass'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads the given class or interface.
|
||||||
|
*
|
||||||
|
* @param string $class The name of the class
|
||||||
|
*
|
||||||
|
* @return Boolean|null True, if loaded
|
||||||
|
*/
|
||||||
|
public function loadClass($class)
|
||||||
|
{
|
||||||
|
if ($file = $this->findFile($class)) {
|
||||||
|
require $file;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds the path to the file where the class is defined.
|
||||||
|
*
|
||||||
|
* @param string $class The name of the class
|
||||||
|
*
|
||||||
|
* @return string|null The path, if found
|
||||||
|
*/
|
||||||
|
public function findFile($class)
|
||||||
|
{
|
||||||
|
if ('\\' == $class[0]) {
|
||||||
|
$class = substr($class, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (false !== $pos = strrpos($class, '\\')) {
|
||||||
|
// namespaced class name
|
||||||
|
$classPath = str_replace('\\', DIRECTORY_SEPARATOR, substr($class, 0, $pos)) . DIRECTORY_SEPARATOR;
|
||||||
|
$className = substr($class, $pos + 1);
|
||||||
|
} else {
|
||||||
|
// PEAR-like class name
|
||||||
|
$classPath = null;
|
||||||
|
$className = $class;
|
||||||
|
}
|
||||||
|
|
||||||
|
$classPath .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php';
|
||||||
|
|
||||||
|
foreach ($this->prefixes as $prefix => $dirs) {
|
||||||
|
if (0 === strpos($class, $prefix)) {
|
||||||
|
foreach ($dirs as $dir) {
|
||||||
|
if (file_exists($dir . DIRECTORY_SEPARATOR . $classPath)) {
|
||||||
|
return $dir . DIRECTORY_SEPARATOR . $classPath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($this->fallbackDirs as $dir) {
|
||||||
|
if (file_exists($dir . DIRECTORY_SEPARATOR . $classPath)) {
|
||||||
|
return $dir . DIRECTORY_SEPARATOR . $classPath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->useIncludePath && $file = stream_resolve_include_path($classPath)) {
|
||||||
|
return $file;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
133
core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/ClassMapGenerator.php
vendored
Normal file
133
core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/ClassMapGenerator.php
vendored
Normal file
@@ -0,0 +1,133 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien@symfony.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Symfony\Component\ClassLoader;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ClassMapGenerator
|
||||||
|
*
|
||||||
|
* @author Gyula Sallai <salla016@gmail.com>
|
||||||
|
*/
|
||||||
|
class ClassMapGenerator
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Generate a class map file
|
||||||
|
*
|
||||||
|
* @param array|string $dirs Directories or a single path to search in
|
||||||
|
* @param string $file The name of the class map file
|
||||||
|
*/
|
||||||
|
public static function dump($dirs, $file)
|
||||||
|
{
|
||||||
|
$dirs = (array) $dirs;
|
||||||
|
$maps = array();
|
||||||
|
|
||||||
|
foreach ($dirs as $dir) {
|
||||||
|
$maps = array_merge($maps, static::createMap($dir));
|
||||||
|
}
|
||||||
|
|
||||||
|
file_put_contents($file, sprintf('<?php return %s;', var_export($maps, true)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Iterate over all files in the given directory searching for classes
|
||||||
|
*
|
||||||
|
* @param Iterator|string $dir The directory to search in or an iterator
|
||||||
|
*
|
||||||
|
* @return array A class map array
|
||||||
|
*/
|
||||||
|
public static function createMap($dir)
|
||||||
|
{
|
||||||
|
if (is_string($dir)) {
|
||||||
|
$dir = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($dir));
|
||||||
|
}
|
||||||
|
|
||||||
|
$map = array();
|
||||||
|
|
||||||
|
foreach ($dir as $file) {
|
||||||
|
if (!$file->isFile()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$path = $file->getRealPath();
|
||||||
|
|
||||||
|
if (pathinfo($path, PATHINFO_EXTENSION) !== 'php') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$classes = self::findClasses($path);
|
||||||
|
|
||||||
|
foreach ($classes as $class) {
|
||||||
|
$map[$class] = $path;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return $map;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extract the classes in the given file
|
||||||
|
*
|
||||||
|
* @param string $path The file to check
|
||||||
|
*
|
||||||
|
* @return array The found classes
|
||||||
|
*/
|
||||||
|
private static function findClasses($path)
|
||||||
|
{
|
||||||
|
$contents = file_get_contents($path);
|
||||||
|
$tokens = token_get_all($contents);
|
||||||
|
$T_TRAIT = version_compare(PHP_VERSION, '5.4', '<') ? -1 : T_TRAIT;
|
||||||
|
|
||||||
|
$classes = array();
|
||||||
|
|
||||||
|
$namespace = '';
|
||||||
|
for ($i = 0, $max = count($tokens); $i < $max; $i++) {
|
||||||
|
$token = $tokens[$i];
|
||||||
|
|
||||||
|
if (is_string($token)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$class = '';
|
||||||
|
|
||||||
|
switch ($token[0]) {
|
||||||
|
case T_NAMESPACE:
|
||||||
|
$namespace = '';
|
||||||
|
// If there is a namespace, extract it
|
||||||
|
while (($t = $tokens[++$i]) && is_array($t)) {
|
||||||
|
if (in_array($t[0], array(T_STRING, T_NS_SEPARATOR))) {
|
||||||
|
$namespace .= $t[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$namespace .= '\\';
|
||||||
|
break;
|
||||||
|
case T_CLASS:
|
||||||
|
case T_INTERFACE:
|
||||||
|
case $T_TRAIT:
|
||||||
|
// Find the classname
|
||||||
|
while (($t = $tokens[++$i]) && is_array($t)) {
|
||||||
|
if (T_STRING === $t[0]) {
|
||||||
|
$class .= $t[1];
|
||||||
|
} elseif ($class !== '' && T_WHITESPACE == $t[0]) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$classes[] = ltrim($namespace . $class, '\\');
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $classes;
|
||||||
|
}
|
||||||
|
}
|
||||||
91
core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/DebugClassLoader.php
vendored
Normal file
91
core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/DebugClassLoader.php
vendored
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien@symfony.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Symfony\Component\ClassLoader;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Autoloader checking if the class is really defined in the file found.
|
||||||
|
*
|
||||||
|
* The DebugClassLoader will wrap all registered autoloaders providing a
|
||||||
|
* findFile method and will throw an exception if a file is found but does
|
||||||
|
* not declare the class.
|
||||||
|
*
|
||||||
|
* @author Fabien Potencier <fabien@symfony.com>
|
||||||
|
* @author Christophe Coevoet <stof@notk.org>
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
class DebugClassLoader
|
||||||
|
{
|
||||||
|
private $classFinder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param object $classFinder
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
public function __construct($classFinder)
|
||||||
|
{
|
||||||
|
$this->classFinder = $classFinder;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Replaces all autoloaders implementing a findFile method by a DebugClassLoader wrapper.
|
||||||
|
*/
|
||||||
|
public static function enable()
|
||||||
|
{
|
||||||
|
if (!is_array($functions = spl_autoload_functions())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($functions as $function) {
|
||||||
|
spl_autoload_unregister($function);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($functions as $function) {
|
||||||
|
if (is_array($function) && method_exists($function[0], 'findFile')) {
|
||||||
|
$function = array(new static($function[0]), 'loadClass');
|
||||||
|
}
|
||||||
|
|
||||||
|
spl_autoload_register($function);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unregisters this instance as an autoloader.
|
||||||
|
*/
|
||||||
|
public function unregister()
|
||||||
|
{
|
||||||
|
spl_autoload_unregister(array($this, 'loadClass'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads the given class or interface.
|
||||||
|
*
|
||||||
|
* @param string $class The name of the class
|
||||||
|
*
|
||||||
|
* @return Boolean|null True, if loaded
|
||||||
|
*/
|
||||||
|
public function loadClass($class)
|
||||||
|
{
|
||||||
|
if ($file = $this->classFinder->findFile($class)) {
|
||||||
|
require $file;
|
||||||
|
|
||||||
|
if (!class_exists($class, false) && !interface_exists($class, false) && (!function_exists('trait_exists') || !trait_exists($class, false))) {
|
||||||
|
throw new \RuntimeException(sprintf('The autoloader expected class "%s" to be defined in file "%s". The file was found but the class was not in it, the class name or namespace probably has a typo.', $class, $file));
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
63
core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/DebugUniversalClassLoader.php
vendored
Normal file
63
core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/DebugUniversalClassLoader.php
vendored
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien@symfony.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Symfony\Component\ClassLoader;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks that the class is actually declared in the included file.
|
||||||
|
*
|
||||||
|
* @author Fabien Potencier <fabien@symfony.com>
|
||||||
|
*/
|
||||||
|
class DebugUniversalClassLoader extends UniversalClassLoader
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Replaces all regular UniversalClassLoader instances by a DebugUniversalClassLoader ones.
|
||||||
|
*/
|
||||||
|
public static function enable()
|
||||||
|
{
|
||||||
|
if (!is_array($functions = spl_autoload_functions())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($functions as $function) {
|
||||||
|
spl_autoload_unregister($function);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($functions as $function) {
|
||||||
|
if (is_array($function) && $function[0] instanceof UniversalClassLoader) {
|
||||||
|
$loader = new static();
|
||||||
|
$loader->registerNamespaceFallbacks($function[0]->getNamespaceFallbacks());
|
||||||
|
$loader->registerPrefixFallbacks($function[0]->getPrefixFallbacks());
|
||||||
|
$loader->registerNamespaces($function[0]->getNamespaces());
|
||||||
|
$loader->registerPrefixes($function[0]->getPrefixes());
|
||||||
|
$loader->useIncludePath($function[0]->getUseIncludePath());
|
||||||
|
|
||||||
|
$function[0] = $loader;
|
||||||
|
}
|
||||||
|
|
||||||
|
spl_autoload_register($function);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public function loadClass($class)
|
||||||
|
{
|
||||||
|
if ($file = $this->findFile($class)) {
|
||||||
|
require $file;
|
||||||
|
|
||||||
|
if (!class_exists($class, false) && !interface_exists($class, false) && (!function_exists('trait_exists') || !trait_exists($class, false))) {
|
||||||
|
throw new \RuntimeException(sprintf('The autoloader expected class "%s" to be defined in file "%s". The file was found but the class was not in it, the class name or namespace probably has a typo.', $class, $file));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
19
core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/LICENSE
vendored
Normal file
19
core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/LICENSE
vendored
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
Copyright (c) 2004-2012 Fabien Potencier
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is furnished
|
||||||
|
to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
76
core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/MapClassLoader.php
vendored
Normal file
76
core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/MapClassLoader.php
vendored
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien@symfony.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Symfony\Component\ClassLoader;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A class loader that uses a mapping file to look up paths.
|
||||||
|
*
|
||||||
|
* @author Fabien Potencier <fabien@symfony.com>
|
||||||
|
*/
|
||||||
|
class MapClassLoader
|
||||||
|
{
|
||||||
|
private $map = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param array $map A map where keys are classes and values the absolute file path
|
||||||
|
*/
|
||||||
|
public function __construct(array $map)
|
||||||
|
{
|
||||||
|
$this->map = $map;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers this instance as an autoloader.
|
||||||
|
*
|
||||||
|
* @param Boolean $prepend Whether to prepend the autoloader or not
|
||||||
|
*/
|
||||||
|
public function register($prepend = false)
|
||||||
|
{
|
||||||
|
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads the given class or interface.
|
||||||
|
*
|
||||||
|
* @param string $class The name of the class
|
||||||
|
*/
|
||||||
|
public function loadClass($class)
|
||||||
|
{
|
||||||
|
if ('\\' === $class[0]) {
|
||||||
|
$class = substr($class, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($this->map[$class])) {
|
||||||
|
require $this->map[$class];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds the path to the file where the class is defined.
|
||||||
|
*
|
||||||
|
* @param string $class The name of the class
|
||||||
|
*
|
||||||
|
* @return string|null The path, if found
|
||||||
|
*/
|
||||||
|
public function findFile($class)
|
||||||
|
{
|
||||||
|
if ('\\' === $class[0]) {
|
||||||
|
$class = substr($class, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($this->map[$class])) {
|
||||||
|
return $this->map[$class];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
72
core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/README.md
vendored
Normal file
72
core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/README.md
vendored
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
ClassLoader Component
|
||||||
|
=====================
|
||||||
|
|
||||||
|
ClassLoader loads your project classes automatically if they follow some
|
||||||
|
standard PHP conventions.
|
||||||
|
|
||||||
|
The Universal ClassLoader is able to autoload classes that implement the PSR-0
|
||||||
|
standard or the PEAR naming convention.
|
||||||
|
|
||||||
|
First, register the autoloader:
|
||||||
|
|
||||||
|
require_once __DIR__.'/src/Symfony/Component/ClassLoader/UniversalClassLoader.php';
|
||||||
|
|
||||||
|
use Symfony\Component\ClassLoader\UniversalClassLoader;
|
||||||
|
|
||||||
|
$loader = new UniversalClassLoader();
|
||||||
|
$loader->register();
|
||||||
|
|
||||||
|
Then, register some namespaces with the `registerNamespace()` method:
|
||||||
|
|
||||||
|
$loader->registerNamespace('Symfony', __DIR__.'/src');
|
||||||
|
$loader->registerNamespace('Monolog', __DIR__.'/vendor/monolog/src');
|
||||||
|
|
||||||
|
The `registerNamespace()` method takes a namespace prefix and a path where to
|
||||||
|
look for the classes as arguments.
|
||||||
|
|
||||||
|
You can also register a sub-namespaces:
|
||||||
|
|
||||||
|
$loader->registerNamespace('Doctrine\\Common', __DIR__.'/vendor/doctrine-common/lib');
|
||||||
|
|
||||||
|
The order of registration is significant and the first registered namespace
|
||||||
|
takes precedence over later registered one.
|
||||||
|
|
||||||
|
You can also register more than one path for a given namespace:
|
||||||
|
|
||||||
|
$loader->registerNamespace('Symfony', array(__DIR__.'/src', __DIR__.'/symfony/src'));
|
||||||
|
|
||||||
|
Alternatively, you can use the `registerNamespaces()` method to register more
|
||||||
|
than one namespace at once:
|
||||||
|
|
||||||
|
$loader->registerNamespaces(array(
|
||||||
|
'Symfony' => array(__DIR__.'/src', __DIR__.'/symfony/src'),
|
||||||
|
'Doctrine\\Common' => __DIR__.'/vendor/doctrine-common/lib',
|
||||||
|
'Doctrine' => __DIR__.'/vendor/doctrine/lib',
|
||||||
|
'Monolog' => __DIR__.'/vendor/monolog/src',
|
||||||
|
));
|
||||||
|
|
||||||
|
For better performance, you can use the APC based version of the universal
|
||||||
|
class loader:
|
||||||
|
|
||||||
|
require_once __DIR__.'/src/Symfony/Component/ClassLoader/UniversalClassLoader.php';
|
||||||
|
require_once __DIR__.'/src/Symfony/Component/ClassLoader/ApcUniversalClassLoader.php';
|
||||||
|
|
||||||
|
use Symfony\Component\ClassLoader\ApcUniversalClassLoader;
|
||||||
|
|
||||||
|
$loader = new ApcUniversalClassLoader('apc.prefix.');
|
||||||
|
|
||||||
|
Furthermore, the component provides tools to aggregate classes into a single
|
||||||
|
file, which is especially useful to improve performance on servers that do not
|
||||||
|
provide byte caches.
|
||||||
|
|
||||||
|
Resources
|
||||||
|
---------
|
||||||
|
|
||||||
|
You can run the unit tests with the following command:
|
||||||
|
|
||||||
|
phpunit
|
||||||
|
|
||||||
|
If you also want to run the unit tests that depend on other Symfony
|
||||||
|
Components, install dev dependencies before running PHPUnit:
|
||||||
|
|
||||||
|
php composer.phar install --dev
|
||||||
192
core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/ApcUniversalClassLoaderTest.php
vendored
Normal file
192
core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/ApcUniversalClassLoaderTest.php
vendored
Normal file
@@ -0,0 +1,192 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien@symfony.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Symfony\Component\ClassLoader\Tests;
|
||||||
|
|
||||||
|
use Symfony\Component\ClassLoader\ApcUniversalClassLoader;
|
||||||
|
|
||||||
|
class ApcUniversalClassLoaderTest extends \PHPUnit_Framework_TestCase
|
||||||
|
{
|
||||||
|
protected function setUp()
|
||||||
|
{
|
||||||
|
if (!extension_loaded('apc')) {
|
||||||
|
$this->markTestSkipped('The apc extension is not available.');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(ini_get('apc.enabled') && ini_get('apc.enable_cli'))) {
|
||||||
|
$this->markTestSkipped('The apc extension is available, but not enabled.');
|
||||||
|
} else {
|
||||||
|
apc_clear_cache('user');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function tearDown()
|
||||||
|
{
|
||||||
|
if (ini_get('apc.enabled') && ini_get('apc.enable_cli')) {
|
||||||
|
apc_clear_cache('user');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testConstructor()
|
||||||
|
{
|
||||||
|
$loader = new ApcUniversalClassLoader('test.prefix.');
|
||||||
|
$loader->registerNamespace('Apc\Namespaced', __DIR__.DIRECTORY_SEPARATOR.'Fixtures');
|
||||||
|
|
||||||
|
$this->assertEquals($loader->findFile('\Apc\Namespaced\FooBar'), apc_fetch('test.prefix.\Apc\Namespaced\FooBar'), '__construct() takes a prefix as its first argument');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider getLoadClassTests
|
||||||
|
*/
|
||||||
|
public function testLoadClass($className, $testClassName, $message)
|
||||||
|
{
|
||||||
|
$loader = new ApcUniversalClassLoader('test.prefix.');
|
||||||
|
$loader->registerNamespace('Apc\Namespaced', __DIR__.DIRECTORY_SEPARATOR.'Fixtures');
|
||||||
|
$loader->registerPrefix('Apc_Pearlike_', __DIR__.DIRECTORY_SEPARATOR.'Fixtures');
|
||||||
|
$loader->loadClass($testClassName);
|
||||||
|
$this->assertTrue(class_exists($className), $message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLoadClassTests()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
array('\\Apc\\Namespaced\\Foo', '\\Apc\\Namespaced\\Foo', '->loadClass() loads Apc\Namespaced\Foo class'),
|
||||||
|
array('Apc_Pearlike_Foo', 'Apc_Pearlike_Foo', '->loadClass() loads Apc_Pearlike_Foo class'),
|
||||||
|
array('\\Apc\\Namespaced\\Bar', '\\Apc\\Namespaced\\Bar', '->loadClass() loads Apc\Namespaced\Bar class with a leading slash'),
|
||||||
|
array('Apc_Pearlike_Bar', '\\Apc_Pearlike_Bar', '->loadClass() loads Apc_Pearlike_Bar class with a leading slash'),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider getLoadClassFromFallbackTests
|
||||||
|
*/
|
||||||
|
public function testLoadClassFromFallback($className, $testClassName, $message)
|
||||||
|
{
|
||||||
|
$loader = new ApcUniversalClassLoader('test.prefix.fallback');
|
||||||
|
$loader->registerNamespace('Apc\Namespaced', __DIR__.DIRECTORY_SEPARATOR.'Fixtures');
|
||||||
|
$loader->registerPrefix('Apc_Pearlike_', __DIR__.DIRECTORY_SEPARATOR.'Fixtures');
|
||||||
|
$loader->registerNamespaceFallbacks(array(__DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/fallback'));
|
||||||
|
$loader->registerPrefixFallbacks(array(__DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/fallback'));
|
||||||
|
$loader->loadClass($testClassName);
|
||||||
|
$this->assertTrue(class_exists($className), $message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLoadClassFromFallbackTests()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
array('\\Apc\\Namespaced\\Baz', '\\Apc\\Namespaced\\Baz', '->loadClass() loads Apc\Namespaced\Baz class'),
|
||||||
|
array('Apc_Pearlike_Baz', 'Apc_Pearlike_Baz', '->loadClass() loads Apc_Pearlike_Baz class'),
|
||||||
|
array('\\Apc\\Namespaced\\FooBar', '\\Apc\\Namespaced\\FooBar', '->loadClass() loads Apc\Namespaced\Baz class from fallback dir'),
|
||||||
|
array('Apc_Pearlike_FooBar', 'Apc_Pearlike_FooBar', '->loadClass() loads Apc_Pearlike_Baz class from fallback dir'),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider getLoadClassNamespaceCollisionTests
|
||||||
|
*/
|
||||||
|
public function testLoadClassNamespaceCollision($namespaces, $className, $message)
|
||||||
|
{
|
||||||
|
$loader = new ApcUniversalClassLoader('test.prefix.collision.');
|
||||||
|
$loader->registerNamespaces($namespaces);
|
||||||
|
|
||||||
|
$loader->loadClass($className);
|
||||||
|
|
||||||
|
$this->assertTrue(class_exists($className), $message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLoadClassNamespaceCollisionTests()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
array(
|
||||||
|
array(
|
||||||
|
'Apc\\NamespaceCollision\\A' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/alpha',
|
||||||
|
'Apc\\NamespaceCollision\\A\\B' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/beta',
|
||||||
|
),
|
||||||
|
'\Apc\NamespaceCollision\A\Foo',
|
||||||
|
'->loadClass() loads NamespaceCollision\A\Foo from alpha.',
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
array(
|
||||||
|
'Apc\\NamespaceCollision\\A\\B' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/beta',
|
||||||
|
'Apc\\NamespaceCollision\\A' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/alpha',
|
||||||
|
),
|
||||||
|
'\Apc\NamespaceCollision\A\Bar',
|
||||||
|
'->loadClass() loads NamespaceCollision\A\Bar from alpha.',
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
array(
|
||||||
|
'Apc\\NamespaceCollision\\A' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/alpha',
|
||||||
|
'Apc\\NamespaceCollision\\A\\B' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/beta',
|
||||||
|
),
|
||||||
|
'\Apc\NamespaceCollision\A\B\Foo',
|
||||||
|
'->loadClass() loads NamespaceCollision\A\B\Foo from beta.',
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
array(
|
||||||
|
'Apc\\NamespaceCollision\\A\\B' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/beta',
|
||||||
|
'Apc\\NamespaceCollision\\A' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/alpha',
|
||||||
|
),
|
||||||
|
'\Apc\NamespaceCollision\A\B\Bar',
|
||||||
|
'->loadClass() loads NamespaceCollision\A\B\Bar from beta.',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider getLoadClassPrefixCollisionTests
|
||||||
|
*/
|
||||||
|
public function testLoadClassPrefixCollision($prefixes, $className, $message)
|
||||||
|
{
|
||||||
|
$loader = new ApcUniversalClassLoader('test.prefix.collision.');
|
||||||
|
$loader->registerPrefixes($prefixes);
|
||||||
|
|
||||||
|
$loader->loadClass($className);
|
||||||
|
$this->assertTrue(class_exists($className), $message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLoadClassPrefixCollisionTests()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
array(
|
||||||
|
array(
|
||||||
|
'ApcPrefixCollision_A_' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/alpha/Apc',
|
||||||
|
'ApcPrefixCollision_A_B_' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/beta/Apc',
|
||||||
|
),
|
||||||
|
'ApcPrefixCollision_A_Foo',
|
||||||
|
'->loadClass() loads ApcPrefixCollision_A_Foo from alpha.',
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
array(
|
||||||
|
'ApcPrefixCollision_A_B_' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/beta/Apc',
|
||||||
|
'ApcPrefixCollision_A_' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/alpha/Apc',
|
||||||
|
),
|
||||||
|
'ApcPrefixCollision_A_Bar',
|
||||||
|
'->loadClass() loads ApcPrefixCollision_A_Bar from alpha.',
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
array(
|
||||||
|
'ApcPrefixCollision_A_' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/alpha/Apc',
|
||||||
|
'ApcPrefixCollision_A_B_' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/beta/Apc',
|
||||||
|
),
|
||||||
|
'ApcPrefixCollision_A_B_Foo',
|
||||||
|
'->loadClass() loads ApcPrefixCollision_A_B_Foo from beta.',
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
array(
|
||||||
|
'ApcPrefixCollision_A_B_' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/beta/Apc',
|
||||||
|
'ApcPrefixCollision_A_' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/alpha/Apc',
|
||||||
|
),
|
||||||
|
'ApcPrefixCollision_A_B_Bar',
|
||||||
|
'->loadClass() loads ApcPrefixCollision_A_B_Bar from beta.',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
182
core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/ClassCollectionLoaderTest.php
vendored
Normal file
182
core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/ClassCollectionLoaderTest.php
vendored
Normal file
@@ -0,0 +1,182 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien@symfony.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Symfony\Component\ClassLoader\Tests;
|
||||||
|
|
||||||
|
use Symfony\Component\ClassLoader\ClassCollectionLoader;
|
||||||
|
|
||||||
|
require_once __DIR__.'/Fixtures/ClassesWithParents/GInterface.php';
|
||||||
|
require_once __DIR__.'/Fixtures/ClassesWithParents/CInterface.php';
|
||||||
|
require_once __DIR__.'/Fixtures/ClassesWithParents/B.php';
|
||||||
|
require_once __DIR__.'/Fixtures/ClassesWithParents/A.php';
|
||||||
|
|
||||||
|
class ClassCollectionLoaderTest extends \PHPUnit_Framework_TestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @dataProvider getDifferentOrders
|
||||||
|
*/
|
||||||
|
public function testClassReordering(array $classes)
|
||||||
|
{
|
||||||
|
$expected = array(
|
||||||
|
'ClassesWithParents\\GInterface',
|
||||||
|
'ClassesWithParents\\CInterface',
|
||||||
|
'ClassesWithParents\\B',
|
||||||
|
'ClassesWithParents\\A',
|
||||||
|
);
|
||||||
|
|
||||||
|
$r = new \ReflectionClass('Symfony\Component\ClassLoader\ClassCollectionLoader');
|
||||||
|
$m = $r->getMethod('getOrderedClasses');
|
||||||
|
$m->setAccessible(true);
|
||||||
|
|
||||||
|
$ordered = $m->invoke('Symfony\Component\ClassLoader\ClassCollectionLoader', $classes);
|
||||||
|
|
||||||
|
$this->assertEquals($expected, array_map(function ($class) { return $class->getName(); }, $ordered));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDifferentOrders()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
array(array(
|
||||||
|
'ClassesWithParents\\A',
|
||||||
|
'ClassesWithParents\\CInterface',
|
||||||
|
'ClassesWithParents\\GInterface',
|
||||||
|
'ClassesWithParents\\B',
|
||||||
|
)),
|
||||||
|
array(array(
|
||||||
|
'ClassesWithParents\\B',
|
||||||
|
'ClassesWithParents\\A',
|
||||||
|
'ClassesWithParents\\CInterface',
|
||||||
|
)),
|
||||||
|
array(array(
|
||||||
|
'ClassesWithParents\\CInterface',
|
||||||
|
'ClassesWithParents\\B',
|
||||||
|
'ClassesWithParents\\A',
|
||||||
|
)),
|
||||||
|
array(array(
|
||||||
|
'ClassesWithParents\\A',
|
||||||
|
)),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider getDifferentOrdersForTraits
|
||||||
|
*/
|
||||||
|
public function testClassWithTraitsReordering(array $classes)
|
||||||
|
{
|
||||||
|
if (version_compare(phpversion(), '5.4.0', '<')) {
|
||||||
|
$this->markTestSkipped('Requires PHP > 5.4.0.');
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
require_once __DIR__.'/Fixtures/ClassesWithParents/ATrait.php';
|
||||||
|
require_once __DIR__.'/Fixtures/ClassesWithParents/BTrait.php';
|
||||||
|
require_once __DIR__.'/Fixtures/ClassesWithParents/CTrait.php';
|
||||||
|
require_once __DIR__.'/Fixtures/ClassesWithParents/D.php';
|
||||||
|
require_once __DIR__.'/Fixtures/ClassesWithParents/E.php';
|
||||||
|
|
||||||
|
$expected = array(
|
||||||
|
'ClassesWithParents\\GInterface',
|
||||||
|
'ClassesWithParents\\CInterface',
|
||||||
|
'ClassesWithParents\\CTrait',
|
||||||
|
'ClassesWithParents\\ATrait',
|
||||||
|
'ClassesWithParents\\BTrait',
|
||||||
|
'ClassesWithParents\\B',
|
||||||
|
'ClassesWithParents\\A',
|
||||||
|
'ClassesWithParents\\D',
|
||||||
|
'ClassesWithParents\\E',
|
||||||
|
);
|
||||||
|
|
||||||
|
$r = new \ReflectionClass('Symfony\Component\ClassLoader\ClassCollectionLoader');
|
||||||
|
$m = $r->getMethod('getOrderedClasses');
|
||||||
|
$m->setAccessible(true);
|
||||||
|
|
||||||
|
$ordered = $m->invoke('Symfony\Component\ClassLoader\ClassCollectionLoader', $classes);
|
||||||
|
|
||||||
|
$this->assertEquals($expected, array_map(function ($class) { return $class->getName(); }, $ordered));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDifferentOrdersForTraits()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
array(array(
|
||||||
|
'ClassesWithParents\\E',
|
||||||
|
'ClassesWithParents\\ATrait',
|
||||||
|
)),
|
||||||
|
array(array(
|
||||||
|
'ClassesWithParents\\E',
|
||||||
|
)),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testFixNamespaceDeclarations()
|
||||||
|
{
|
||||||
|
$source = <<<EOF
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Foo;
|
||||||
|
class Foo {}
|
||||||
|
namespace Bar ;
|
||||||
|
class Foo {}
|
||||||
|
namespace Foo\Bar;
|
||||||
|
class Foo {}
|
||||||
|
namespace Foo\Bar\Bar
|
||||||
|
{
|
||||||
|
class Foo {}
|
||||||
|
}
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
class Foo {}
|
||||||
|
}
|
||||||
|
EOF;
|
||||||
|
|
||||||
|
$expected = <<<EOF
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Foo
|
||||||
|
{
|
||||||
|
class Foo {}
|
||||||
|
}
|
||||||
|
namespace Bar
|
||||||
|
{
|
||||||
|
class Foo {}
|
||||||
|
}
|
||||||
|
namespace Foo\Bar
|
||||||
|
{
|
||||||
|
class Foo {}
|
||||||
|
}
|
||||||
|
namespace Foo\Bar\Bar
|
||||||
|
{
|
||||||
|
class Foo {}
|
||||||
|
}
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
class Foo {}
|
||||||
|
}
|
||||||
|
EOF;
|
||||||
|
|
||||||
|
$this->assertEquals($expected, ClassCollectionLoader::fixNamespaceDeclarations($source));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @expectedException InvalidArgumentException
|
||||||
|
*/
|
||||||
|
public function testUnableToLoadClassException()
|
||||||
|
{
|
||||||
|
ClassCollectionLoader::load(array('SomeNotExistingClass'), '', 'foo', false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testLoadTwiceClass()
|
||||||
|
{
|
||||||
|
ClassCollectionLoader::load(array('Foo'), '', 'foo', false);
|
||||||
|
ClassCollectionLoader::load(array('Foo'), '', 'foo', false);
|
||||||
|
}
|
||||||
|
}
|
||||||
214
core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/ClassLoaderTest.php
vendored
Normal file
214
core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/ClassLoaderTest.php
vendored
Normal file
@@ -0,0 +1,214 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien@symfony.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Symfony\Component\ClassLoader\Tests;
|
||||||
|
|
||||||
|
use Symfony\Component\ClassLoader\ClassLoader;
|
||||||
|
|
||||||
|
class ClassLoaderTest extends \PHPUnit_Framework_TestCase
|
||||||
|
{
|
||||||
|
public function testGetPrefixes()
|
||||||
|
{
|
||||||
|
$loader = new ClassLoader();
|
||||||
|
$loader->addPrefix('Foo', __DIR__.DIRECTORY_SEPARATOR.'Fixtures');
|
||||||
|
$loader->addPrefix('Bar', __DIR__.DIRECTORY_SEPARATOR.'Fixtures');
|
||||||
|
$loader->addPrefix('Bas', __DIR__.DIRECTORY_SEPARATOR.'Fixtures');
|
||||||
|
$prefixes = $loader->getPrefixes();
|
||||||
|
$this->assertArrayHasKey('Foo', $prefixes);
|
||||||
|
$this->assertArrayNotHasKey('Foo1', $prefixes);
|
||||||
|
$this->assertArrayHasKey('Bar', $prefixes);
|
||||||
|
$this->assertArrayHasKey('Bas', $prefixes);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testGetFallbackDirs()
|
||||||
|
{
|
||||||
|
$loader = new ClassLoader();
|
||||||
|
$loader->addPrefix(null, __DIR__.DIRECTORY_SEPARATOR.'Fixtures');
|
||||||
|
$loader->addPrefix(null, __DIR__.DIRECTORY_SEPARATOR.'Fixtures');
|
||||||
|
$fallback_dirs = $loader->getFallbackDirs();
|
||||||
|
$this->assertCount(2, $fallback_dirs);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider getLoadClassTests
|
||||||
|
*/
|
||||||
|
public function testLoadClass($className, $testClassName, $message)
|
||||||
|
{
|
||||||
|
$loader = new ClassLoader();
|
||||||
|
$loader->addPrefix('Namespaced2\\', __DIR__.DIRECTORY_SEPARATOR.'Fixtures');
|
||||||
|
$loader->addPrefix('Pearlike2_', __DIR__.DIRECTORY_SEPARATOR.'Fixtures');
|
||||||
|
$loader->loadClass($testClassName);
|
||||||
|
$this->assertTrue(class_exists($className), $message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLoadClassTests()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
array('\\Namespaced2\\Foo', 'Namespaced2\\Foo', '->loadClass() loads Namespaced2\Foo class'),
|
||||||
|
array('\\Pearlike2_Foo', 'Pearlike2_Foo', '->loadClass() loads Pearlike2_Foo class'),
|
||||||
|
array('\\Namespaced2\\Bar', '\\Namespaced2\\Bar', '->loadClass() loads Namespaced2\Bar class with a leading slash'),
|
||||||
|
array('\\Pearlike2_Bar', '\\Pearlike2_Bar', '->loadClass() loads Pearlike2_Bar class with a leading slash'),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider getLoadNonexistentClassTests
|
||||||
|
*/
|
||||||
|
public function testLoadNonexistentClass($className, $testClassName, $message)
|
||||||
|
{
|
||||||
|
$loader = new ClassLoader();
|
||||||
|
$loader->addPrefix('Namespaced2\\', __DIR__.DIRECTORY_SEPARATOR.'Fixtures');
|
||||||
|
$loader->addPrefix('Pearlike2_', __DIR__.DIRECTORY_SEPARATOR.'Fixtures');
|
||||||
|
$loader->loadClass($testClassName);
|
||||||
|
$this->assertFalse(class_exists($className), $message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLoadNonexistentClassTests()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
array('\\Pearlike3_Bar', '\\Pearlike3_Bar', '->loadClass() loads non exising Pearlike3_Bar class with a leading slash'),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testAddPrefix()
|
||||||
|
{
|
||||||
|
$loader = new ClassLoader();
|
||||||
|
$loader->addPrefix('Foo', __DIR__.DIRECTORY_SEPARATOR.'Fixtures');
|
||||||
|
$loader->addPrefix('Foo', __DIR__.DIRECTORY_SEPARATOR.'Fixtures');
|
||||||
|
$prefixes = $loader->getPrefixes();
|
||||||
|
$this->assertArrayHasKey('Foo', $prefixes);
|
||||||
|
$this->assertCount(2, $prefixes['Foo']);
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider getLoadClassFromFallbackTests
|
||||||
|
*/
|
||||||
|
public function testLoadClassFromFallback($className, $testClassName, $message)
|
||||||
|
{
|
||||||
|
$loader = new ClassLoader();
|
||||||
|
$loader->addPrefix('Namespaced2\\', __DIR__.DIRECTORY_SEPARATOR.'Fixtures');
|
||||||
|
$loader->addPrefix('Pearlike2_', __DIR__.DIRECTORY_SEPARATOR.'Fixtures');
|
||||||
|
$loader->addPrefix('', array(__DIR__.DIRECTORY_SEPARATOR.'Fixtures/fallback'));
|
||||||
|
$loader->loadClass($testClassName);
|
||||||
|
$this->assertTrue(class_exists($className), $message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLoadClassFromFallbackTests()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
array('\\Namespaced2\\Baz', 'Namespaced2\\Baz', '->loadClass() loads Namespaced2\Baz class'),
|
||||||
|
array('\\Pearlike2_Baz', 'Pearlike2_Baz', '->loadClass() loads Pearlike2_Baz class'),
|
||||||
|
array('\\Namespaced2\\FooBar', 'Namespaced2\\FooBar', '->loadClass() loads Namespaced2\Baz class from fallback dir'),
|
||||||
|
array('\\Pearlike2_FooBar', 'Pearlike2_FooBar', '->loadClass() loads Pearlike2_Baz class from fallback dir'),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider getLoadClassNamespaceCollisionTests
|
||||||
|
*/
|
||||||
|
public function testLoadClassNamespaceCollision($namespaces, $className, $message)
|
||||||
|
{
|
||||||
|
$loader = new ClassLoader();
|
||||||
|
$loader->addPrefixes($namespaces);
|
||||||
|
|
||||||
|
$loader->loadClass($className);
|
||||||
|
$this->assertTrue(class_exists($className), $message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLoadClassNamespaceCollisionTests()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
array(
|
||||||
|
array(
|
||||||
|
'NamespaceCollision\\C' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/alpha',
|
||||||
|
'NamespaceCollision\\C\\B' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/beta',
|
||||||
|
),
|
||||||
|
'NamespaceCollision\C\Foo',
|
||||||
|
'->loadClass() loads NamespaceCollision\C\Foo from alpha.',
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
array(
|
||||||
|
'NamespaceCollision\\C\\B' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/beta',
|
||||||
|
'NamespaceCollision\\C' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/alpha',
|
||||||
|
),
|
||||||
|
'NamespaceCollision\C\Bar',
|
||||||
|
'->loadClass() loads NamespaceCollision\C\Bar from alpha.',
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
array(
|
||||||
|
'NamespaceCollision\\C' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/alpha',
|
||||||
|
'NamespaceCollision\\C\\B' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/beta',
|
||||||
|
),
|
||||||
|
'NamespaceCollision\C\B\Foo',
|
||||||
|
'->loadClass() loads NamespaceCollision\C\B\Foo from beta.',
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
array(
|
||||||
|
'NamespaceCollision\\C\\B' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/beta',
|
||||||
|
'NamespaceCollision\\C' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/alpha',
|
||||||
|
),
|
||||||
|
'NamespaceCollision\C\B\Bar',
|
||||||
|
'->loadClass() loads NamespaceCollision\C\B\Bar from beta.',
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
array(
|
||||||
|
'PrefixCollision_C_' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/alpha',
|
||||||
|
'PrefixCollision_C_B_' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/beta',
|
||||||
|
),
|
||||||
|
'PrefixCollision_C_Foo',
|
||||||
|
'->loadClass() loads PrefixCollision_C_Foo from alpha.',
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
array(
|
||||||
|
'PrefixCollision_C_B_' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/beta',
|
||||||
|
'PrefixCollision_C_' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/alpha',
|
||||||
|
),
|
||||||
|
'PrefixCollision_C_Bar',
|
||||||
|
'->loadClass() loads PrefixCollision_C_Bar from alpha.',
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
array(
|
||||||
|
'PrefixCollision_C_' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/alpha',
|
||||||
|
'PrefixCollision_C_B_' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/beta',
|
||||||
|
),
|
||||||
|
'PrefixCollision_C_B_Foo',
|
||||||
|
'->loadClass() loads PrefixCollision_C_B_Foo from beta.',
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
array(
|
||||||
|
'PrefixCollision_C_B_' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/beta',
|
||||||
|
'PrefixCollision_C_' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/alpha',
|
||||||
|
),
|
||||||
|
'PrefixCollision_C_B_Bar',
|
||||||
|
'->loadClass() loads PrefixCollision_C_B_Bar from beta.',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
146
core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/ClassMapGeneratorTest.php
vendored
Normal file
146
core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/ClassMapGeneratorTest.php
vendored
Normal file
@@ -0,0 +1,146 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien@symfony.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Symfony\Component\ClassLoader\Tests;
|
||||||
|
|
||||||
|
use Symfony\Component\ClassLoader\ClassMapGenerator;
|
||||||
|
|
||||||
|
class ClassMapGeneratorTest extends \PHPUnit_Framework_TestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var string $workspace
|
||||||
|
*/
|
||||||
|
private $workspace = null;
|
||||||
|
|
||||||
|
public function prepare_workspace()
|
||||||
|
{
|
||||||
|
$this->workspace = rtrim(sys_get_temp_dir(), DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.time().rand(0, 1000);
|
||||||
|
mkdir($this->workspace, 0777, true);
|
||||||
|
$this->workspace = realpath($this->workspace);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $file
|
||||||
|
*/
|
||||||
|
private function clean($file)
|
||||||
|
{
|
||||||
|
if (is_dir($file) && !is_link($file)) {
|
||||||
|
$dir = new \FilesystemIterator($file);
|
||||||
|
foreach ($dir as $childFile) {
|
||||||
|
$this->clean($childFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
rmdir($file);
|
||||||
|
} else {
|
||||||
|
unlink($file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider getTestCreateMapTests
|
||||||
|
*/
|
||||||
|
public function testDump($directory, $expected)
|
||||||
|
{
|
||||||
|
$this->prepare_workspace();
|
||||||
|
|
||||||
|
$file = $this->workspace.'/file';
|
||||||
|
|
||||||
|
$generator = new ClassMapGenerator();
|
||||||
|
$generator->dump($directory, $file);
|
||||||
|
$this->assertFileExists($file);
|
||||||
|
|
||||||
|
$this->clean($this->workspace);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider getTestCreateMapTests
|
||||||
|
*/
|
||||||
|
public function testCreateMap($directory, $expected)
|
||||||
|
{
|
||||||
|
$this->assertEqualsNormalized($expected, ClassMapGenerator::createMap($directory));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTestCreateMapTests()
|
||||||
|
{
|
||||||
|
$data = array(
|
||||||
|
array(__DIR__.'/Fixtures/Namespaced', array(
|
||||||
|
'Namespaced\\Bar' => realpath(__DIR__).'/Fixtures/Namespaced/Bar.php',
|
||||||
|
'Namespaced\\Foo' => realpath(__DIR__).'/Fixtures/Namespaced/Foo.php',
|
||||||
|
'Namespaced\\Baz' => realpath(__DIR__).'/Fixtures/Namespaced/Baz.php',
|
||||||
|
)
|
||||||
|
),
|
||||||
|
array(__DIR__.'/Fixtures/beta/NamespaceCollision', array(
|
||||||
|
'NamespaceCollision\\A\\B\\Bar' => realpath(__DIR__).'/Fixtures/beta/NamespaceCollision/A/B/Bar.php',
|
||||||
|
'NamespaceCollision\\A\\B\\Foo' => realpath(__DIR__).'/Fixtures/beta/NamespaceCollision/A/B/Foo.php',
|
||||||
|
'NamespaceCollision\\C\\B\\Bar' => realpath(__DIR__).'/Fixtures/beta/NamespaceCollision/C/B/Bar.php',
|
||||||
|
'NamespaceCollision\\C\\B\\Foo' => realpath(__DIR__).'/Fixtures/beta/NamespaceCollision/C/B/Foo.php',
|
||||||
|
)),
|
||||||
|
array(__DIR__.'/Fixtures/Pearlike', array(
|
||||||
|
'Pearlike_Foo' => realpath(__DIR__).'/Fixtures/Pearlike/Foo.php',
|
||||||
|
'Pearlike_Bar' => realpath(__DIR__).'/Fixtures/Pearlike/Bar.php',
|
||||||
|
'Pearlike_Baz' => realpath(__DIR__).'/Fixtures/Pearlike/Baz.php',
|
||||||
|
)),
|
||||||
|
array(__DIR__.'/Fixtures/classmap', array(
|
||||||
|
'Foo\\Bar\\A' => realpath(__DIR__).'/Fixtures/classmap/sameNsMultipleClasses.php',
|
||||||
|
'Foo\\Bar\\B' => realpath(__DIR__).'/Fixtures/classmap/sameNsMultipleClasses.php',
|
||||||
|
'A' => realpath(__DIR__).'/Fixtures/classmap/multipleNs.php',
|
||||||
|
'Alpha\\A' => realpath(__DIR__).'/Fixtures/classmap/multipleNs.php',
|
||||||
|
'Alpha\\B' => realpath(__DIR__).'/Fixtures/classmap/multipleNs.php',
|
||||||
|
'Beta\\A' => realpath(__DIR__).'/Fixtures/classmap/multipleNs.php',
|
||||||
|
'Beta\\B' => realpath(__DIR__).'/Fixtures/classmap/multipleNs.php',
|
||||||
|
'ClassMap\\SomeInterface' => realpath(__DIR__).'/Fixtures/classmap/SomeInterface.php',
|
||||||
|
'ClassMap\\SomeParent' => realpath(__DIR__).'/Fixtures/classmap/SomeParent.php',
|
||||||
|
'ClassMap\\SomeClass' => realpath(__DIR__).'/Fixtures/classmap/SomeClass.php',
|
||||||
|
)),
|
||||||
|
);
|
||||||
|
|
||||||
|
if (version_compare(PHP_VERSION, '5.4', '>=')) {
|
||||||
|
$data[] = array(__DIR__.'/Fixtures/php5.4', array(
|
||||||
|
'TFoo' => __DIR__.'/Fixtures/php5.4/traits.php',
|
||||||
|
'CFoo' => __DIR__.'/Fixtures/php5.4/traits.php',
|
||||||
|
'Foo\\TBar' => __DIR__.'/Fixtures/php5.4/traits.php',
|
||||||
|
'Foo\\IBar' => __DIR__.'/Fixtures/php5.4/traits.php',
|
||||||
|
'Foo\\TFooBar' => __DIR__.'/Fixtures/php5.4/traits.php',
|
||||||
|
'Foo\\CBar' => __DIR__.'/Fixtures/php5.4/traits.php',
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testCreateMapFinderSupport()
|
||||||
|
{
|
||||||
|
if (!class_exists('Symfony\\Component\\Finder\\Finder')) {
|
||||||
|
$this->markTestSkipped('Finder component is not available');
|
||||||
|
}
|
||||||
|
|
||||||
|
$finder = new \Symfony\Component\Finder\Finder();
|
||||||
|
$finder->files()->in(__DIR__ . '/Fixtures/beta/NamespaceCollision');
|
||||||
|
|
||||||
|
$this->assertEqualsNormalized(array(
|
||||||
|
'NamespaceCollision\\A\\B\\Bar' => realpath(__DIR__).'/Fixtures/beta/NamespaceCollision/A/B/Bar.php',
|
||||||
|
'NamespaceCollision\\A\\B\\Foo' => realpath(__DIR__).'/Fixtures/beta/NamespaceCollision/A/B/Foo.php',
|
||||||
|
'NamespaceCollision\\C\\B\\Bar' => realpath(__DIR__).'/Fixtures/beta/NamespaceCollision/C/B/Bar.php',
|
||||||
|
'NamespaceCollision\\C\\B\\Foo' => realpath(__DIR__).'/Fixtures/beta/NamespaceCollision/C/B/Foo.php',
|
||||||
|
), ClassMapGenerator::createMap($finder));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function assertEqualsNormalized($expected, $actual, $message = null)
|
||||||
|
{
|
||||||
|
foreach ($expected as $ns => $path) {
|
||||||
|
$expected[$ns] = strtr($path, '\\', '/');
|
||||||
|
}
|
||||||
|
foreach ($actual as $ns => $path) {
|
||||||
|
$actual[$ns] = strtr($path, '\\', '/');
|
||||||
|
}
|
||||||
|
$this->assertEquals($expected, $actual, $message);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien@symfony.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Apc\Namespaced;
|
||||||
|
|
||||||
|
class Bar
|
||||||
|
{
|
||||||
|
public static $loaded = true;
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien@symfony.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Apc\Namespaced;
|
||||||
|
|
||||||
|
class Baz
|
||||||
|
{
|
||||||
|
public static $loaded = true;
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien@symfony.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Apc\Namespaced;
|
||||||
|
|
||||||
|
class Foo
|
||||||
|
{
|
||||||
|
public static $loaded = true;
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien@symfony.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Apc\Namespaced;
|
||||||
|
|
||||||
|
class FooBar
|
||||||
|
{
|
||||||
|
public static $loaded = true;
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class Apc_Pearlike_Bar
|
||||||
|
{
|
||||||
|
public static $loaded = true;
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class Apc_Pearlike_Baz
|
||||||
|
{
|
||||||
|
public static $loaded = true;
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class Apc_Pearlike_Foo
|
||||||
|
{
|
||||||
|
public static $loaded = true;
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class ApcPrefixCollision_A_Bar
|
||||||
|
{
|
||||||
|
public static $loaded = true;
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class ApcPrefixCollision_A_Foo
|
||||||
|
{
|
||||||
|
public static $loaded = true;
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien@symfony.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Apc\NamespaceCollision\A;
|
||||||
|
|
||||||
|
class Bar
|
||||||
|
{
|
||||||
|
public static $loaded = true;
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien@symfony.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Apc\NamespaceCollision\A;
|
||||||
|
|
||||||
|
class Foo
|
||||||
|
{
|
||||||
|
public static $loaded = true;
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class ApcPrefixCollision_A_B_Bar
|
||||||
|
{
|
||||||
|
public static $loaded = true;
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class ApcPrefixCollision_A_B_Foo
|
||||||
|
{
|
||||||
|
public static $loaded = true;
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien@symfony.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Apc\NamespaceCollision\A\B;
|
||||||
|
|
||||||
|
class Bar
|
||||||
|
{
|
||||||
|
public static $loaded = true;
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien@symfony.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Apc\NamespaceCollision\A\B;
|
||||||
|
|
||||||
|
class Foo
|
||||||
|
{
|
||||||
|
public static $loaded = true;
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class Apc_Pearlike_FooBar
|
||||||
|
{
|
||||||
|
public static $loaded = true;
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien@symfony.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Apc\Namespaced;
|
||||||
|
|
||||||
|
class FooBar
|
||||||
|
{
|
||||||
|
public static $loaded = true;
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace ClassesWithParents;
|
||||||
|
|
||||||
|
class A extends B {}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace ClassesWithParents;
|
||||||
|
|
||||||
|
trait ATrait
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace ClassesWithParents;
|
||||||
|
|
||||||
|
class B implements CInterface {}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace ClassesWithParents;
|
||||||
|
|
||||||
|
trait BTrait
|
||||||
|
{
|
||||||
|
use ATrait;
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace ClassesWithParents;
|
||||||
|
|
||||||
|
interface CInterface extends GInterface
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace ClassesWithParents;
|
||||||
|
|
||||||
|
trait CTrait
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace ClassesWithParents;
|
||||||
|
|
||||||
|
class D extends A
|
||||||
|
{
|
||||||
|
use BTrait;
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace ClassesWithParents;
|
||||||
|
|
||||||
|
class E extends D
|
||||||
|
{
|
||||||
|
use CTrait;
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace ClassesWithParents;
|
||||||
|
|
||||||
|
interface GInterface
|
||||||
|
{
|
||||||
|
}
|
||||||
17
core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/Namespaced/Bar.php
vendored
Normal file
17
core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/Namespaced/Bar.php
vendored
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien@symfony.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Namespaced;
|
||||||
|
|
||||||
|
class Bar
|
||||||
|
{
|
||||||
|
public static $loaded = true;
|
||||||
|
}
|
||||||
17
core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/Namespaced/Baz.php
vendored
Normal file
17
core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/Namespaced/Baz.php
vendored
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien@symfony.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Namespaced;
|
||||||
|
|
||||||
|
class Baz
|
||||||
|
{
|
||||||
|
public static $loaded = true;
|
||||||
|
}
|
||||||
17
core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/Namespaced/Foo.php
vendored
Normal file
17
core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/Namespaced/Foo.php
vendored
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien@symfony.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Namespaced;
|
||||||
|
|
||||||
|
class Foo
|
||||||
|
{
|
||||||
|
public static $loaded = true;
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Namespaced2;
|
||||||
|
|
||||||
|
class Bar
|
||||||
|
{
|
||||||
|
public static $loaded = true;
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Namespaced2;
|
||||||
|
|
||||||
|
class Baz
|
||||||
|
{
|
||||||
|
public static $loaded = true;
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Namespaced2;
|
||||||
|
|
||||||
|
class Foo
|
||||||
|
{
|
||||||
|
public static $loaded = true;
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class Pearlike_Bar
|
||||||
|
{
|
||||||
|
public static $loaded = true;
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class Pearlike_Baz
|
||||||
|
{
|
||||||
|
public static $loaded = true;
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class Pearlike_Foo
|
||||||
|
{
|
||||||
|
public static $loaded = true;
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class Pearlike2_Bar
|
||||||
|
{
|
||||||
|
public static $loaded = true;
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class Pearlike2_Baz
|
||||||
|
{
|
||||||
|
public static $loaded = true;
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class Pearlike2_Foo
|
||||||
|
{
|
||||||
|
public static $loaded = true;
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien@symfony.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace NamespaceCollision\A;
|
||||||
|
|
||||||
|
class Bar
|
||||||
|
{
|
||||||
|
public static $loaded = true;
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien@symfony.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace NamespaceCollision\A;
|
||||||
|
|
||||||
|
class Foo
|
||||||
|
{
|
||||||
|
public static $loaded = true;
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace NamespaceCollision\C;
|
||||||
|
|
||||||
|
class Bar
|
||||||
|
{
|
||||||
|
public static $loaded = true;
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace NamespaceCollision\C;
|
||||||
|
|
||||||
|
class Foo
|
||||||
|
{
|
||||||
|
public static $loaded = true;
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class PrefixCollision_A_Bar
|
||||||
|
{
|
||||||
|
public static $loaded = true;
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class PrefixCollision_A_Foo
|
||||||
|
{
|
||||||
|
public static $loaded = true;
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class PrefixCollision_C_Bar
|
||||||
|
{
|
||||||
|
public static $loaded = true;
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class PrefixCollision_C_Foo
|
||||||
|
{
|
||||||
|
public static $loaded = true;
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien@symfony.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace NamespaceCollision\A\B;
|
||||||
|
|
||||||
|
class Bar
|
||||||
|
{
|
||||||
|
public static $loaded = true;
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien@symfony.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace NamespaceCollision\A\B;
|
||||||
|
|
||||||
|
class Foo
|
||||||
|
{
|
||||||
|
public static $loaded = true;
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace NamespaceCollision\C\B;
|
||||||
|
|
||||||
|
class Bar
|
||||||
|
{
|
||||||
|
public static $loaded = true;
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace NamespaceCollision\C\B;
|
||||||
|
|
||||||
|
class Foo
|
||||||
|
{
|
||||||
|
public static $loaded = true;
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class PrefixCollision_A_B_Bar
|
||||||
|
{
|
||||||
|
public static $loaded = true;
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class PrefixCollision_A_B_Foo
|
||||||
|
{
|
||||||
|
public static $loaded = true;
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class PrefixCollision_C_B_Bar
|
||||||
|
{
|
||||||
|
public static $loaded = true;
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class PrefixCollision_C_B_Foo
|
||||||
|
{
|
||||||
|
public static $loaded = true;
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien@symfony.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace ClassMap;
|
||||||
|
|
||||||
|
class SomeClass extends SomeParent implements SomeInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien@symfony.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace ClassMap;
|
||||||
|
|
||||||
|
interface SomeInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien@symfony.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace ClassMap;
|
||||||
|
|
||||||
|
abstract class SomeParent
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
<?php
|
||||||
|
namespace {
|
||||||
|
class A {}
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace Alpha {
|
||||||
|
class A {}
|
||||||
|
class B {}
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace Beta {
|
||||||
|
class A {}
|
||||||
|
class B {}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
$a = new stdClass();
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
This file should be skipped.
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien@symfony.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Foo\Bar;
|
||||||
|
|
||||||
|
class A {}
|
||||||
|
class B {}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien@symfony.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Namespaced;
|
||||||
|
|
||||||
|
class FooBar
|
||||||
|
{
|
||||||
|
public static $loaded = true;
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Namespaced2;
|
||||||
|
|
||||||
|
class FooBar
|
||||||
|
{
|
||||||
|
public static $loaded = true;
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class Pearlike_FooBar
|
||||||
|
{
|
||||||
|
public static $loaded = true;
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class Pearlike2_FooBar
|
||||||
|
{
|
||||||
|
public static $loaded = true;
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class Foo
|
||||||
|
{
|
||||||
|
}
|
||||||
30
core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/php5.4/traits.php
vendored
Normal file
30
core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/php5.4/traits.php
vendored
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
namespace {
|
||||||
|
trait TFoo
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
class CFoo
|
||||||
|
{
|
||||||
|
use TFoo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace Foo {
|
||||||
|
trait TBar
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IBar
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
trait TFooBar
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
class CBar implements IBar
|
||||||
|
{
|
||||||
|
use TBar, TFooBar;
|
||||||
|
}
|
||||||
|
}
|
||||||
222
core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/UniversalClassLoaderTest.php
vendored
Normal file
222
core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/UniversalClassLoaderTest.php
vendored
Normal file
@@ -0,0 +1,222 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien@symfony.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Symfony\Component\ClassLoader\Tests;
|
||||||
|
|
||||||
|
use Symfony\Component\ClassLoader\UniversalClassLoader;
|
||||||
|
|
||||||
|
class UniversalClassLoaderTest extends \PHPUnit_Framework_TestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @dataProvider getLoadClassTests
|
||||||
|
*/
|
||||||
|
public function testLoadClass($className, $testClassName, $message)
|
||||||
|
{
|
||||||
|
$loader = new UniversalClassLoader();
|
||||||
|
$loader->registerNamespace('Namespaced', __DIR__.DIRECTORY_SEPARATOR.'Fixtures');
|
||||||
|
$loader->registerPrefix('Pearlike_', __DIR__.DIRECTORY_SEPARATOR.'Fixtures');
|
||||||
|
$loader->loadClass($testClassName);
|
||||||
|
$this->assertTrue(class_exists($className), $message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLoadClassTests()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
array('\\Namespaced\\Foo', 'Namespaced\\Foo', '->loadClass() loads Namespaced\Foo class'),
|
||||||
|
array('\\Pearlike_Foo', 'Pearlike_Foo', '->loadClass() loads Pearlike_Foo class'),
|
||||||
|
array('\\Namespaced\\Bar', '\\Namespaced\\Bar', '->loadClass() loads Namespaced\Bar class with a leading slash'),
|
||||||
|
array('\\Pearlike_Bar', '\\Pearlike_Bar', '->loadClass() loads Pearlike_Bar class with a leading slash'),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testUseIncludePath()
|
||||||
|
{
|
||||||
|
$loader = new UniversalClassLoader();
|
||||||
|
$this->assertFalse($loader->getUseIncludePath());
|
||||||
|
|
||||||
|
$this->assertNull($loader->findFile('Foo'));
|
||||||
|
|
||||||
|
$includePath = get_include_path();
|
||||||
|
|
||||||
|
$loader->useIncludePath(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);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testGetNamespaces()
|
||||||
|
{
|
||||||
|
$loader = new UniversalClassLoader();
|
||||||
|
$loader->registerNamespace('Foo', __DIR__.DIRECTORY_SEPARATOR.'Fixtures');
|
||||||
|
$loader->registerNamespace('Bar', __DIR__.DIRECTORY_SEPARATOR.'Fixtures');
|
||||||
|
$loader->registerNamespace('Bas', __DIR__.DIRECTORY_SEPARATOR.'Fixtures');
|
||||||
|
$namespaces = $loader->getNamespaces();
|
||||||
|
$this->assertArrayHasKey('Foo', $namespaces);
|
||||||
|
$this->assertArrayNotHasKey('Foo1', $namespaces);
|
||||||
|
$this->assertArrayHasKey('Bar', $namespaces);
|
||||||
|
$this->assertArrayHasKey('Bas', $namespaces);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testGetPrefixes()
|
||||||
|
{
|
||||||
|
$loader = new UniversalClassLoader();
|
||||||
|
$loader->registerPrefix('Foo', __DIR__.DIRECTORY_SEPARATOR.'Fixtures');
|
||||||
|
$loader->registerPrefix('Bar', __DIR__.DIRECTORY_SEPARATOR.'Fixtures');
|
||||||
|
$loader->registerPrefix('Bas', __DIR__.DIRECTORY_SEPARATOR.'Fixtures');
|
||||||
|
$prefixes = $loader->getPrefixes();
|
||||||
|
$this->assertArrayHasKey('Foo', $prefixes);
|
||||||
|
$this->assertArrayNotHasKey('Foo1', $prefixes);
|
||||||
|
$this->assertArrayHasKey('Bar', $prefixes);
|
||||||
|
$this->assertArrayHasKey('Bas', $prefixes);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider getLoadClassFromFallbackTests
|
||||||
|
*/
|
||||||
|
public function testLoadClassFromFallback($className, $testClassName, $message)
|
||||||
|
{
|
||||||
|
$loader = new UniversalClassLoader();
|
||||||
|
$loader->registerNamespace('Namespaced', __DIR__.DIRECTORY_SEPARATOR.'Fixtures');
|
||||||
|
$loader->registerPrefix('Pearlike_', __DIR__.DIRECTORY_SEPARATOR.'Fixtures');
|
||||||
|
$loader->registerNamespaceFallbacks(array(__DIR__.DIRECTORY_SEPARATOR.'Fixtures/fallback'));
|
||||||
|
$loader->registerPrefixFallbacks(array(__DIR__.DIRECTORY_SEPARATOR.'Fixtures/fallback'));
|
||||||
|
$loader->loadClass($testClassName);
|
||||||
|
$this->assertTrue(class_exists($className), $message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLoadClassFromFallbackTests()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
array('\\Namespaced\\Baz', 'Namespaced\\Baz', '->loadClass() loads Namespaced\Baz class'),
|
||||||
|
array('\\Pearlike_Baz', 'Pearlike_Baz', '->loadClass() loads Pearlike_Baz class'),
|
||||||
|
array('\\Namespaced\\FooBar', 'Namespaced\\FooBar', '->loadClass() loads Namespaced\Baz class from fallback dir'),
|
||||||
|
array('\\Pearlike_FooBar', 'Pearlike_FooBar', '->loadClass() loads Pearlike_Baz class from fallback dir'),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testRegisterPrefixFallback()
|
||||||
|
{
|
||||||
|
$loader = new UniversalClassLoader();
|
||||||
|
$loader->registerPrefixFallback(__DIR__.DIRECTORY_SEPARATOR.'Fixtures/fallback');
|
||||||
|
$this->assertEquals(array(__DIR__.DIRECTORY_SEPARATOR.'Fixtures/fallback'), $loader->getPrefixFallbacks());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testRegisterNamespaceFallback()
|
||||||
|
{
|
||||||
|
$loader = new UniversalClassLoader();
|
||||||
|
$loader->registerNamespaceFallback(__DIR__.DIRECTORY_SEPARATOR.'Fixtures/Namespaced/fallback');
|
||||||
|
$this->assertEquals(array(__DIR__.DIRECTORY_SEPARATOR.'Fixtures/Namespaced/fallback'), $loader->getNamespaceFallbacks());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider getLoadClassNamespaceCollisionTests
|
||||||
|
*/
|
||||||
|
public function testLoadClassNamespaceCollision($namespaces, $className, $message)
|
||||||
|
{
|
||||||
|
$loader = new UniversalClassLoader();
|
||||||
|
$loader->registerNamespaces($namespaces);
|
||||||
|
|
||||||
|
$loader->loadClass($className);
|
||||||
|
$this->assertTrue(class_exists($className), $message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLoadClassNamespaceCollisionTests()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
array(
|
||||||
|
array(
|
||||||
|
'NamespaceCollision\\A' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/alpha',
|
||||||
|
'NamespaceCollision\\A\\B' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/beta',
|
||||||
|
),
|
||||||
|
'NamespaceCollision\A\Foo',
|
||||||
|
'->loadClass() loads NamespaceCollision\A\Foo from alpha.',
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
array(
|
||||||
|
'NamespaceCollision\\A\\B' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/beta',
|
||||||
|
'NamespaceCollision\\A' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/alpha',
|
||||||
|
),
|
||||||
|
'NamespaceCollision\A\Bar',
|
||||||
|
'->loadClass() loads NamespaceCollision\A\Bar from alpha.',
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
array(
|
||||||
|
'NamespaceCollision\\A' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/alpha',
|
||||||
|
'NamespaceCollision\\A\\B' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/beta',
|
||||||
|
),
|
||||||
|
'NamespaceCollision\A\B\Foo',
|
||||||
|
'->loadClass() loads NamespaceCollision\A\B\Foo from beta.',
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
array(
|
||||||
|
'NamespaceCollision\\A\\B' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/beta',
|
||||||
|
'NamespaceCollision\\A' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/alpha',
|
||||||
|
),
|
||||||
|
'NamespaceCollision\A\B\Bar',
|
||||||
|
'->loadClass() loads NamespaceCollision\A\B\Bar from beta.',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider getLoadClassPrefixCollisionTests
|
||||||
|
*/
|
||||||
|
public function testLoadClassPrefixCollision($prefixes, $className, $message)
|
||||||
|
{
|
||||||
|
$loader = new UniversalClassLoader();
|
||||||
|
$loader->registerPrefixes($prefixes);
|
||||||
|
|
||||||
|
$loader->loadClass($className);
|
||||||
|
$this->assertTrue(class_exists($className), $message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLoadClassPrefixCollisionTests()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
array(
|
||||||
|
array(
|
||||||
|
'PrefixCollision_A_' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/alpha',
|
||||||
|
'PrefixCollision_A_B_' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/beta',
|
||||||
|
),
|
||||||
|
'PrefixCollision_A_Foo',
|
||||||
|
'->loadClass() loads PrefixCollision_A_Foo from alpha.',
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
array(
|
||||||
|
'PrefixCollision_A_B_' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/beta',
|
||||||
|
'PrefixCollision_A_' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/alpha',
|
||||||
|
),
|
||||||
|
'PrefixCollision_A_Bar',
|
||||||
|
'->loadClass() loads PrefixCollision_A_Bar from alpha.',
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
array(
|
||||||
|
'PrefixCollision_A_' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/alpha',
|
||||||
|
'PrefixCollision_A_B_' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/beta',
|
||||||
|
),
|
||||||
|
'PrefixCollision_A_B_Foo',
|
||||||
|
'->loadClass() loads PrefixCollision_A_B_Foo from beta.',
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
array(
|
||||||
|
'PrefixCollision_A_B_' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/beta',
|
||||||
|
'PrefixCollision_A_' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/alpha',
|
||||||
|
),
|
||||||
|
'PrefixCollision_A_B_Bar',
|
||||||
|
'->loadClass() loads PrefixCollision_A_B_Bar from beta.',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
22
core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/bootstrap.php
vendored
Normal file
22
core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/bootstrap.php
vendored
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien@symfony.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
spl_autoload_register(function ($class) {
|
||||||
|
if (0 === strpos(ltrim($class, '/'), 'Symfony\Component\ClassLoader')) {
|
||||||
|
if (file_exists($file = __DIR__.'/../'.substr(str_replace('\\', '/', $class), strlen('Symfony\Component\ClassLoader')).'.php')) {
|
||||||
|
require_once $file;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (file_exists($loader = __DIR__.'/../vendor/autoload.php')) {
|
||||||
|
require_once $loader;
|
||||||
|
}
|
||||||
319
core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/UniversalClassLoader.php
vendored
Normal file
319
core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/UniversalClassLoader.php
vendored
Normal file
@@ -0,0 +1,319 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien@symfony.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Symfony\Component\ClassLoader;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* UniversalClassLoader implements a "universal" autoloader for PHP 5.3.
|
||||||
|
*
|
||||||
|
* It is able to load classes that use either:
|
||||||
|
*
|
||||||
|
* * The technical interoperability standards for PHP 5.3 namespaces and
|
||||||
|
* class names (https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md);
|
||||||
|
*
|
||||||
|
* * The PEAR naming convention for classes (http://pear.php.net/).
|
||||||
|
*
|
||||||
|
* Classes from a sub-namespace or a sub-hierarchy of PEAR classes can be
|
||||||
|
* looked for in a list of locations to ease the vendoring of a sub-set of
|
||||||
|
* classes for large projects.
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
*
|
||||||
|
* $loader = new UniversalClassLoader();
|
||||||
|
*
|
||||||
|
* // register classes with namespaces
|
||||||
|
* $loader->registerNamespaces(array(
|
||||||
|
* 'Symfony\Component' => __DIR__.'/component',
|
||||||
|
* 'Symfony' => __DIR__.'/framework',
|
||||||
|
* 'Sensio' => array(__DIR__.'/src', __DIR__.'/vendor'),
|
||||||
|
* ));
|
||||||
|
*
|
||||||
|
* // register a library using the PEAR naming convention
|
||||||
|
* $loader->registerPrefixes(array(
|
||||||
|
* 'Swift_' => __DIR__.'/Swift',
|
||||||
|
* ));
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* // to enable searching the include path (e.g. for PEAR packages)
|
||||||
|
* $loader->useIncludePath(true);
|
||||||
|
*
|
||||||
|
* // activate the autoloader
|
||||||
|
* $loader->register();
|
||||||
|
*
|
||||||
|
* In this example, if you try to use a class in the Symfony\Component
|
||||||
|
* namespace or one of its children (Symfony\Component\Console for instance),
|
||||||
|
* the autoloader will first look for the class under the component/
|
||||||
|
* directory, and it will then fallback to the framework/ directory if not
|
||||||
|
* found before giving up.
|
||||||
|
*
|
||||||
|
* @author Fabien Potencier <fabien@symfony.com>
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
class UniversalClassLoader
|
||||||
|
{
|
||||||
|
private $namespaces = array();
|
||||||
|
private $prefixes = array();
|
||||||
|
private $namespaceFallbacks = array();
|
||||||
|
private $prefixFallbacks = array();
|
||||||
|
private $useIncludePath = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Turns on searching the include for class files. Allows easy loading
|
||||||
|
* of installed PEAR packages
|
||||||
|
*
|
||||||
|
* @param Boolean $useIncludePath
|
||||||
|
*/
|
||||||
|
public function useIncludePath($useIncludePath)
|
||||||
|
{
|
||||||
|
$this->useIncludePath = $useIncludePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Can be used to check if the autoloader uses the include path to check
|
||||||
|
* for classes.
|
||||||
|
*
|
||||||
|
* @return Boolean
|
||||||
|
*/
|
||||||
|
public function getUseIncludePath()
|
||||||
|
{
|
||||||
|
return $this->useIncludePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the configured namespaces.
|
||||||
|
*
|
||||||
|
* @return array A hash with namespaces as keys and directories as values
|
||||||
|
*/
|
||||||
|
public function getNamespaces()
|
||||||
|
{
|
||||||
|
return $this->namespaces;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the configured class prefixes.
|
||||||
|
*
|
||||||
|
* @return array A hash with class prefixes as keys and directories as values
|
||||||
|
*/
|
||||||
|
public function getPrefixes()
|
||||||
|
{
|
||||||
|
return $this->prefixes;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the directory(ies) to use as a fallback for namespaces.
|
||||||
|
*
|
||||||
|
* @return array An array of directories
|
||||||
|
*/
|
||||||
|
public function getNamespaceFallbacks()
|
||||||
|
{
|
||||||
|
return $this->namespaceFallbacks;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the directory(ies) to use as a fallback for class prefixes.
|
||||||
|
*
|
||||||
|
* @return array An array of directories
|
||||||
|
*/
|
||||||
|
public function getPrefixFallbacks()
|
||||||
|
{
|
||||||
|
return $this->prefixFallbacks;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers the directory to use as a fallback for namespaces.
|
||||||
|
*
|
||||||
|
* @param array $dirs An array of directories
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
public function registerNamespaceFallbacks(array $dirs)
|
||||||
|
{
|
||||||
|
$this->namespaceFallbacks = $dirs;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers a directory to use as a fallback for namespaces.
|
||||||
|
*
|
||||||
|
* @param string $dir A directory
|
||||||
|
*/
|
||||||
|
public function registerNamespaceFallback($dir)
|
||||||
|
{
|
||||||
|
$this->namespaceFallbacks[] = $dir;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers directories to use as a fallback for class prefixes.
|
||||||
|
*
|
||||||
|
* @param array $dirs An array of directories
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
public function registerPrefixFallbacks(array $dirs)
|
||||||
|
{
|
||||||
|
$this->prefixFallbacks = $dirs;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers a directory to use as a fallback for class prefixes.
|
||||||
|
*
|
||||||
|
* @param string $dir A directory
|
||||||
|
*/
|
||||||
|
public function registerPrefixFallback($dir)
|
||||||
|
{
|
||||||
|
$this->prefixFallbacks[] = $dir;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers an array of namespaces
|
||||||
|
*
|
||||||
|
* @param array $namespaces An array of namespaces (namespaces as keys and locations as values)
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
public function registerNamespaces(array $namespaces)
|
||||||
|
{
|
||||||
|
foreach ($namespaces as $namespace => $locations) {
|
||||||
|
$this->namespaces[$namespace] = (array) $locations;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers a namespace.
|
||||||
|
*
|
||||||
|
* @param string $namespace The namespace
|
||||||
|
* @param array|string $paths The location(s) of the namespace
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
public function registerNamespace($namespace, $paths)
|
||||||
|
{
|
||||||
|
$this->namespaces[$namespace] = (array) $paths;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers an array of classes using the PEAR naming convention.
|
||||||
|
*
|
||||||
|
* @param array $classes An array of classes (prefixes as keys and locations as values)
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
public function registerPrefixes(array $classes)
|
||||||
|
{
|
||||||
|
foreach ($classes as $prefix => $locations) {
|
||||||
|
$this->prefixes[$prefix] = (array) $locations;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers a set of classes using the PEAR naming convention.
|
||||||
|
*
|
||||||
|
* @param string $prefix The classes prefix
|
||||||
|
* @param array|string $paths The location(s) of the classes
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
public function registerPrefix($prefix, $paths)
|
||||||
|
{
|
||||||
|
$this->prefixes[$prefix] = (array) $paths;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers this instance as an autoloader.
|
||||||
|
*
|
||||||
|
* @param Boolean $prepend Whether to prepend the autoloader or not
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
public function register($prepend = false)
|
||||||
|
{
|
||||||
|
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads the given class or interface.
|
||||||
|
*
|
||||||
|
* @param string $class The name of the class
|
||||||
|
*/
|
||||||
|
public function loadClass($class)
|
||||||
|
{
|
||||||
|
if ($file = $this->findFile($class)) {
|
||||||
|
require $file;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds the path to the file where the class is defined.
|
||||||
|
*
|
||||||
|
* @param string $class The name of the class
|
||||||
|
*
|
||||||
|
* @return string|null The path, if found
|
||||||
|
*/
|
||||||
|
public function findFile($class)
|
||||||
|
{
|
||||||
|
if ('\\' == $class[0]) {
|
||||||
|
$class = substr($class, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (false !== $pos = strrpos($class, '\\')) {
|
||||||
|
// namespaced class name
|
||||||
|
$namespace = substr($class, 0, $pos);
|
||||||
|
$className = substr($class, $pos + 1);
|
||||||
|
$normalizedClass = str_replace('\\', DIRECTORY_SEPARATOR, $namespace).DIRECTORY_SEPARATOR.str_replace('_', DIRECTORY_SEPARATOR, $className).'.php';
|
||||||
|
foreach ($this->namespaces as $ns => $dirs) {
|
||||||
|
if (0 !== strpos($namespace, $ns)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($dirs as $dir) {
|
||||||
|
$file = $dir.DIRECTORY_SEPARATOR.$normalizedClass;
|
||||||
|
if (is_file($file)) {
|
||||||
|
return $file;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($this->namespaceFallbacks as $dir) {
|
||||||
|
$file = $dir.DIRECTORY_SEPARATOR.$normalizedClass;
|
||||||
|
if (is_file($file)) {
|
||||||
|
return $file;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// PEAR-like class name
|
||||||
|
$normalizedClass = str_replace('_', DIRECTORY_SEPARATOR, $class).'.php';
|
||||||
|
foreach ($this->prefixes as $prefix => $dirs) {
|
||||||
|
if (0 !== strpos($class, $prefix)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($dirs as $dir) {
|
||||||
|
$file = $dir.DIRECTORY_SEPARATOR.$normalizedClass;
|
||||||
|
if (is_file($file)) {
|
||||||
|
return $file;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($this->prefixFallbacks as $dir) {
|
||||||
|
$file = $dir.DIRECTORY_SEPARATOR.$normalizedClass;
|
||||||
|
if (is_file($file)) {
|
||||||
|
return $file;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->useIncludePath && $file = stream_resolve_include_path($normalizedClass)) {
|
||||||
|
return $file;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
121
core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/XcacheClassLoader.php
vendored
Normal file
121
core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/XcacheClassLoader.php
vendored
Normal file
@@ -0,0 +1,121 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien@symfony.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Symfony\Component\ClassLoader;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* XcacheClassLoader implements a wrapping autoloader cached in Xcache for PHP 5.3.
|
||||||
|
*
|
||||||
|
* It expects an object implementing a findFile method to find the file. This
|
||||||
|
* allows using it as a wrapper around the other loaders of the component (the
|
||||||
|
* ClassLoader and the UniversalClassLoader for instance) but also around any
|
||||||
|
* other autoloader following this convention (the Composer one for instance)
|
||||||
|
*
|
||||||
|
* $loader = new ClassLoader();
|
||||||
|
*
|
||||||
|
* // register classes with namespaces
|
||||||
|
* $loader->add('Symfony\Component', __DIR__.'/component');
|
||||||
|
* $loader->add('Symfony', __DIR__.'/framework');
|
||||||
|
*
|
||||||
|
* $cachedLoader = new XcacheClassLoader('my_prefix', $loader);
|
||||||
|
*
|
||||||
|
* // activate the cached autoloader
|
||||||
|
* $cachedLoader->register();
|
||||||
|
*
|
||||||
|
* // eventually deactivate the non-cached loader if it was registered previously
|
||||||
|
* // to be sure to use the cached one.
|
||||||
|
* $loader->unregister();
|
||||||
|
*
|
||||||
|
* @author Fabien Potencier <fabien@symfony.com>
|
||||||
|
* @author Kris Wallsmith <kris@symfony.com>
|
||||||
|
* @author Kim Hemsø Rasmussen <kimhemsoe@gmail.com>
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
class XcacheClassLoader
|
||||||
|
{
|
||||||
|
private $prefix;
|
||||||
|
private $classFinder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param string $prefix A prefix to create a namespace in Xcache
|
||||||
|
* @param object $classFinder An object that implements findFile() method.
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
public function __construct($prefix, $classFinder)
|
||||||
|
{
|
||||||
|
if (!extension_loaded('Xcache')) {
|
||||||
|
throw new \RuntimeException('Unable to use XcacheClassLoader as Xcache is not enabled.');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!method_exists($classFinder, 'findFile')) {
|
||||||
|
throw new \InvalidArgumentException('The class finder must implement a "findFile" method.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->prefix = $prefix;
|
||||||
|
$this->classFinder = $classFinder;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers this instance as an autoloader.
|
||||||
|
*
|
||||||
|
* @param Boolean $prepend Whether to prepend the autoloader or not
|
||||||
|
*/
|
||||||
|
public function register($prepend = false)
|
||||||
|
{
|
||||||
|
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unregisters this instance as an autoloader.
|
||||||
|
*/
|
||||||
|
public function unregister()
|
||||||
|
{
|
||||||
|
spl_autoload_unregister(array($this, 'loadClass'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads the given class or interface.
|
||||||
|
*
|
||||||
|
* @param string $class The name of the class
|
||||||
|
*
|
||||||
|
* @return Boolean|null True, if loaded
|
||||||
|
*/
|
||||||
|
public function loadClass($class)
|
||||||
|
{
|
||||||
|
if ($file = $this->findFile($class)) {
|
||||||
|
require $file;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds a file by class name while caching lookups to Xcache.
|
||||||
|
*
|
||||||
|
* @param string $class A class name to resolve to file
|
||||||
|
*
|
||||||
|
* @return string|null
|
||||||
|
*/
|
||||||
|
public function findFile($class)
|
||||||
|
{
|
||||||
|
if (xcache_isset($this->prefix.$class)) {
|
||||||
|
$file = xcache_get($this->prefix.$class);
|
||||||
|
} else {
|
||||||
|
xcache_set($this->prefix.$class, $file = $this->classFinder->findFile($class));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $file;
|
||||||
|
}
|
||||||
|
}
|
||||||
35
core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/composer.json
vendored
Normal file
35
core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/composer.json
vendored
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
{
|
||||||
|
"name": "symfony/class-loader",
|
||||||
|
"type": "library",
|
||||||
|
"description": "Symfony ClassLoader Component",
|
||||||
|
"keywords": [],
|
||||||
|
"homepage": "http://symfony.com",
|
||||||
|
"license": "MIT",
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Fabien Potencier",
|
||||||
|
"email": "fabien@symfony.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Symfony Community",
|
||||||
|
"homepage": "http://symfony.com/contributors"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"minimum-stability": "dev",
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.3.3"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"symfony/finder": "2.1.*"
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-0": { "Symfony\\Component\\ClassLoader": "" }
|
||||||
|
},
|
||||||
|
"target-dir": "Symfony/Component/ClassLoader",
|
||||||
|
"minimum-stability": "dev",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "2.1-dev"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
30
core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/phpunit.xml.dist
vendored
Normal file
30
core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/phpunit.xml.dist
vendored
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<phpunit backupGlobals="false"
|
||||||
|
backupStaticAttributes="false"
|
||||||
|
colors="true"
|
||||||
|
convertErrorsToExceptions="true"
|
||||||
|
convertNoticesToExceptions="true"
|
||||||
|
convertWarningsToExceptions="true"
|
||||||
|
processIsolation="false"
|
||||||
|
stopOnFailure="false"
|
||||||
|
syntaxCheck="false"
|
||||||
|
bootstrap="Tests/bootstrap.php"
|
||||||
|
>
|
||||||
|
<testsuites>
|
||||||
|
<testsuite name="Symfony ClassLoader Component Test Suite">
|
||||||
|
<directory>./Tests/</directory>
|
||||||
|
</testsuite>
|
||||||
|
</testsuites>
|
||||||
|
|
||||||
|
<filter>
|
||||||
|
<whitelist>
|
||||||
|
<directory>./</directory>
|
||||||
|
<exclude>
|
||||||
|
<directory>./Resources</directory>
|
||||||
|
<directory>./Tests</directory>
|
||||||
|
<directory>./vendor</directory>
|
||||||
|
</exclude>
|
||||||
|
</whitelist>
|
||||||
|
</filter>
|
||||||
|
</phpunit>
|
||||||
10
core/vendor/symfony/config/Symfony/Component/Config/CHANGELOG.md
vendored
Normal file
10
core/vendor/symfony/config/Symfony/Component/Config/CHANGELOG.md
vendored
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
CHANGELOG
|
||||||
|
=========
|
||||||
|
|
||||||
|
2.1.0
|
||||||
|
-----
|
||||||
|
|
||||||
|
* added a way to add documentation on configuration
|
||||||
|
* implemented `Serializable` on resources
|
||||||
|
* LoaderResolverInterface is now used instead of LoaderResolver for type
|
||||||
|
hinting
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user