Skip to content

Commit 0860b14

Browse files
author
Igor Karpov
committed
MergeTwoSortedLists
1 parent 758f730 commit 0860b14

File tree

5 files changed

+69
-59
lines changed

5 files changed

+69
-59
lines changed

vendor/composer/ClassLoader.php

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,13 @@
3737
*
3838
* @author Fabien Potencier <[email protected]>
3939
* @author Jordi Boggiano <[email protected]>
40-
* @see http://www.php-fig.org/psr/psr-0/
41-
* @see http://www.php-fig.org/psr/psr-4/
40+
* @see https://www.php-fig.org/psr/psr-0/
41+
* @see https://www.php-fig.org/psr/psr-4/
4242
*/
4343
class ClassLoader
4444
{
45+
private $vendorDir;
46+
4547
// PSR-4
4648
private $prefixLengthsPsr4 = array();
4749
private $prefixDirsPsr4 = array();
@@ -57,10 +59,17 @@ class ClassLoader
5759
private $missingClasses = array();
5860
private $apcuPrefix;
5961

62+
private static $registeredLoaders = array();
63+
64+
public function __construct($vendorDir = null)
65+
{
66+
$this->vendorDir = $vendorDir;
67+
}
68+
6069
public function getPrefixes()
6170
{
6271
if (!empty($this->prefixesPsr0)) {
63-
return call_user_func_array('array_merge', $this->prefixesPsr0);
72+
return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
6473
}
6574

6675
return array();
@@ -279,7 +288,7 @@ public function isClassMapAuthoritative()
279288
*/
280289
public function setApcuPrefix($apcuPrefix)
281290
{
282-
$this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null;
291+
$this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
283292
}
284293

285294
/**
@@ -300,6 +309,17 @@ public function getApcuPrefix()
300309
public function register($prepend = false)
301310
{
302311
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
312+
313+
if (null === $this->vendorDir) {
314+
return;
315+
}
316+
317+
if ($prepend) {
318+
self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
319+
} else {
320+
unset(self::$registeredLoaders[$this->vendorDir]);
321+
self::$registeredLoaders[$this->vendorDir] = $this;
322+
}
303323
}
304324

305325
/**
@@ -308,6 +328,10 @@ public function register($prepend = false)
308328
public function unregister()
309329
{
310330
spl_autoload_unregister(array($this, 'loadClass'));
331+
332+
if (null !== $this->vendorDir) {
333+
unset(self::$registeredLoaders[$this->vendorDir]);
334+
}
311335
}
312336

313337
/**
@@ -367,6 +391,16 @@ public function findFile($class)
367391
return $file;
368392
}
369393

394+
/**
395+
* Returns the currently registered loaders indexed by their corresponding vendor directories.
396+
*
397+
* @return self[]
398+
*/
399+
public static function getRegisteredLoaders()
400+
{
401+
return self::$registeredLoaders;
402+
}
403+
370404
private function findFileWithExtension($class, $ext)
371405
{
372406
// PSR-4 lookup
@@ -377,7 +411,7 @@ private function findFileWithExtension($class, $ext)
377411
$subPath = $class;
378412
while (false !== $lastPos = strrpos($subPath, '\\')) {
379413
$subPath = substr($subPath, 0, $lastPos);
380-
$search = $subPath.'\\';
414+
$search = $subPath . '\\';
381415
if (isset($this->prefixDirsPsr4[$search])) {
382416
$pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
383417
foreach ($this->prefixDirsPsr4[$search] as $dir) {

vendor/composer/LICENSE

Lines changed: 17 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,21 @@
1-
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
2-
Upstream-Name: Composer
3-
Upstream-Contact: Jordi Boggiano <[email protected]>
4-
Source: https://github.com/composer/composer
51

6-
Files: *
7-
Copyright: 2016, Nils Adermann <[email protected]>
8-
2016, Jordi Boggiano <[email protected]>
9-
License: Expat
2+
Copyright (c) Nils Adermann, Jordi Boggiano
103

11-
Files: src/Composer/Util/TlsHelper.php
12-
Copyright: 2016, Nils Adermann <[email protected]>
13-
2016, Jordi Boggiano <[email protected]>
14-
2013, Evan Coury <[email protected]>
15-
License: Expat and BSD-2-Clause
4+
Permission is hereby granted, free of charge, to any person obtaining a copy
5+
of this software and associated documentation files (the "Software"), to deal
6+
in the Software without restriction, including without limitation the rights
7+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
copies of the Software, and to permit persons to whom the Software is furnished
9+
to do so, subject to the following conditions:
1610

17-
License: BSD-2-Clause
18-
Redistribution and use in source and binary forms, with or without modification,
19-
are permitted provided that the following conditions are met:
20-
.
21-
* Redistributions of source code must retain the above copyright notice,
22-
this list of conditions and the following disclaimer.
23-
.
24-
* Redistributions in binary form must reproduce the above copyright notice,
25-
this list of conditions and the following disclaimer in the documentation
26-
and/or other materials provided with the distribution.
27-
.
28-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
29-
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
30-
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
31-
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
32-
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
33-
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
34-
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
35-
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
36-
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
37-
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
11+
The above copyright notice and this permission notice shall be included in all
12+
copies or substantial portions of the Software.
13+
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20+
THE SOFTWARE.
3821

39-
License: Expat
40-
Permission is hereby granted, free of charge, to any person obtaining a copy
41-
of this software and associated documentation files (the "Software"), to deal
42-
in the Software without restriction, including without limitation the rights
43-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
44-
copies of the Software, and to permit persons to whom the Software is furnished
45-
to do so, subject to the following conditions:
46-
.
47-
The above copyright notice and this permission notice shall be included in all
48-
copies or substantial portions of the Software.
49-
.
50-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
51-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
52-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
53-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
54-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
55-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
56-
THE SOFTWARE.

vendor/composer/autoload_classmap.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@
66
$baseDir = dirname($vendorDir);
77

88
return array(
9+
'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
910
);

vendor/composer/autoload_real.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,24 @@ public static function loadClassLoader($class)
1313
}
1414
}
1515

16+
/**
17+
* @return \Composer\Autoload\ClassLoader
18+
*/
1619
public static function getLoader()
1720
{
1821
if (null !== self::$loader) {
1922
return self::$loader;
2023
}
2124

25+
require __DIR__ . '/platform_check.php';
26+
2227
spl_autoload_register(array('ComposerAutoloaderInit0408ec9782c584055204db09a96ee76a', 'loadClassLoader'), true, true);
23-
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
28+
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
2429
spl_autoload_unregister(array('ComposerAutoloaderInit0408ec9782c584055204db09a96ee76a', 'loadClassLoader'));
2530

2631
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
2732
if ($useStaticLoader) {
28-
require_once __DIR__ . '/autoload_static.php';
33+
require __DIR__ . '/autoload_static.php';
2934

3035
call_user_func(\Composer\Autoload\ComposerStaticInit0408ec9782c584055204db09a96ee76a::getInitializer($loader));
3136
} else {

vendor/composer/autoload_static.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,16 @@ class ComposerStaticInit0408ec9782c584055204db09a96ee76a
2020
),
2121
);
2222

23+
public static $classMap = array (
24+
'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
25+
);
26+
2327
public static function getInitializer(ClassLoader $loader)
2428
{
2529
return \Closure::bind(function () use ($loader) {
2630
$loader->prefixLengthsPsr4 = ComposerStaticInit0408ec9782c584055204db09a96ee76a::$prefixLengthsPsr4;
2731
$loader->prefixDirsPsr4 = ComposerStaticInit0408ec9782c584055204db09a96ee76a::$prefixDirsPsr4;
32+
$loader->classMap = ComposerStaticInit0408ec9782c584055204db09a96ee76a::$classMap;
2833

2934
}, null, ClassLoader::class);
3035
}

0 commit comments

Comments
 (0)