This repository has been archived by the owner on Jan 30, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of git://github.com/zendframework/zf2
- Loading branch information
103 parents
f9b5c15
+
e2bbd4d
+
e5f8174
+
769fae9
+
2b12a57
+
42b1c42
+
1157fa6
+
c68cdbd
+
0fa0204
+
1056804
+
995c2bb
+
51b6af9
+
50b36fa
+
29afdbc
+
8463d72
+
425fd03
+
f76a179
+
3f29cc1
+
d9777e1
+
f9dc85c
+
68b55fa
+
3d000b9
+
e8d5cdc
+
29971c4
+
a2bca08
+
f3a9a9f
+
a263e41
+
7803695
+
0bc1e16
+
873907a
+
b452ee7
+
2ab789f
+
da5d5ef
+
05526b7
+
56278de
+
ae00fd6
+
b8d20ea
+
4fb9db5
+
3915c88
+
0928d39
+
6186985
+
26666c9
+
c993e85
+
4e037a4
+
965637a
+
64de913
+
b400e6b
+
526722c
+
f7defb5
+
1f1e802
+
aba79e7
+
954d53b
+
a91f023
+
d06db6c
+
e87681c
+
1ca0c28
+
e6d7081
+
82e6165
+
fab8e06
+
08acc4a
+
d45c674
+
10e96e0
+
130189c
+
2584b20
+
2164aec
+
53debab
+
665f9b1
+
807ed70
+
87a4d3e
+
ee217fc
+
6c89c61
+
4b3038c
+
ec2ac23
+
f0d3906
+
2653df0
+
0878a3d
+
1ccad87
+
3afba81
+
9a2f295
+
c7219cf
+
6edc133
+
445272d
+
e64a6fc
+
cbf5e6c
+
cc74d49
+
0bcfae1
+
af74564
+
af230b7
+
aa20ac0
+
ef6dc8b
+
3143b63
+
84cabf6
+
4daeba0
+
660eb19
+
587b0dd
+
13e8cbe
+
7100033
+
50b1c92
+
94eb741
+
1ca385c
+
86e6515
+
58c378d
+
061dbfa
commit 897f6bf
Showing
72 changed files
with
435 additions
and
3,604 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,24 @@ | ||
<?php | ||
/** | ||
* Zend Framework | ||
* Zend Framework (http://framework.zend.com/) | ||
* | ||
* LICENSE | ||
* | ||
* This source file is subject to the new BSD license that is bundled | ||
* with this package in the file LICENSE.txt. | ||
* It is also available through the world-wide-web at this URL: | ||
* http://framework.zend.com/license/new-bsd | ||
* If you did not receive a copy of the license and are unable to | ||
* obtain it through the world-wide-web, please send an email | ||
* to [email protected] so we can send you a copy immediately. | ||
* | ||
* @category Zend | ||
* @package Zend_Loader | ||
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
* @link http://github.com/zendframework/zf2 for the canonical source repository | ||
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
* @package Zend_Loader | ||
*/ | ||
|
||
|
||
namespace Zend\Loader; | ||
|
||
use ReflectionClass; | ||
|
||
require_once __DIR__ . '/SplAutoloader.php'; | ||
|
||
if (class_exists('Zend\Loader\AutoloaderFactory')) return; | ||
|
||
/** | ||
* @category Zend | ||
* @package Zend_Loader | ||
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
*/ | ||
abstract class AutoloaderFactory | ||
{ | ||
|
@@ -102,15 +91,11 @@ public static function factory($options = null) | |
); | ||
} | ||
|
||
// unfortunately is_subclass_of is broken on some 5.3 versions | ||
// additionally instanceof is also broken for this use case | ||
if (version_compare(PHP_VERSION, '5.3.7', '>=')) { | ||
if (!is_subclass_of($class, 'Zend\Loader\SplAutoloader')) { | ||
require_once 'Exception/InvalidArgumentException.php'; | ||
throw new Exception\InvalidArgumentException( | ||
sprintf('Autoloader class %s must implement Zend\\Loader\\SplAutoloader', $class) | ||
); | ||
} | ||
if (!self::isSubclassOf($class, 'Zend\Loader\SplAutoloader')) { | ||
require_once 'Exception/InvalidArgumentException.php'; | ||
throw new Exception\InvalidArgumentException( | ||
sprintf('Autoloader class %s must implement Zend\\Loader\\SplAutoloader', $class) | ||
); | ||
} | ||
|
||
if ($class === static::STANDARD_AUTOLOADER) { | ||
|
@@ -200,7 +185,7 @@ protected static function getStandardAutoloader() | |
if (null !== static::$standardAutoloader) { | ||
return static::$standardAutoloader; | ||
} | ||
|
||
// Extract the filename from the classname | ||
$stdAutoloader = substr(strrchr(static::STANDARD_AUTOLOADER, '\\'), 1); | ||
|
||
|
@@ -211,4 +196,28 @@ protected static function getStandardAutoloader() | |
static::$standardAutoloader = $loader; | ||
return static::$standardAutoloader; | ||
} | ||
|
||
/** | ||
* Checks if the object has this class as one of its parents | ||
* | ||
* @see https://bugs.php.net/bug.php?id=53727 | ||
* @see https://github.com/zendframework/zf2/pull/1807 | ||
* | ||
* @param string $className | ||
* @param string $type | ||
*/ | ||
protected static function isSubclassOf($className, $type) | ||
{ | ||
if (is_subclass_of($className, $type)) { | ||
return true; | ||
} | ||
if (version_compare(PHP_VERSION, '5.3.7', '>=')) { | ||
return false; | ||
} | ||
if (!interface_exists($type)) { | ||
return false; | ||
} | ||
$r = new ReflectionClass($className); | ||
return $r->implementsInterface($type); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,11 @@ | ||
<?php | ||
/** | ||
* Zend Framework | ||
* Zend Framework (http://framework.zend.com/) | ||
* | ||
* LICENSE | ||
* | ||
* This source file is subject to the new BSD license that is bundled | ||
* with this package in the file LICENSE.txt. | ||
* It is also available through the world-wide-web at this URL: | ||
* http://framework.zend.com/license/new-bsd | ||
* If you did not receive a copy of the license and are unable to | ||
* obtain it through the world-wide-web, please send an email | ||
* to [email protected] so we can send you a copy immediately. | ||
* | ||
* @category Zend | ||
* @package Zend_Loader | ||
* @subpackage Exception | ||
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
* @link http://github.com/zendframework/zf2 for the canonical source repository | ||
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
* @package Zend_Loader | ||
*/ | ||
|
||
namespace Zend\Loader; | ||
|
@@ -28,11 +17,9 @@ | |
* Class-map autoloader | ||
* | ||
* Utilizes class-map files to lookup classfile locations. | ||
* | ||
* | ||
* @catebory Zend | ||
* @package Zend_Loader | ||
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license New BSD {@link http://framework.zend.com/license/new-bsd} | ||
*/ | ||
class ClassMapAutoloader implements SplAutoloader | ||
{ | ||
|
@@ -52,7 +39,7 @@ class ClassMapAutoloader implements SplAutoloader | |
* Constructor | ||
* | ||
* Create a new instance, and optionally configure the autoloader. | ||
* | ||
* | ||
* @param null|array|\Traversable $options | ||
*/ | ||
public function __construct($options = null) | ||
|
@@ -66,8 +53,8 @@ public function __construct($options = null) | |
* Configure the autoloader | ||
* | ||
* Proxies to {@link registerAutoloadMaps()}. | ||
* | ||
* @param array|Traversable $options | ||
* | ||
* @param array|Traversable $options | ||
* @return ClassMapAutoloader | ||
*/ | ||
public function setOptions($options) | ||
|
@@ -82,10 +69,10 @@ public function setOptions($options) | |
* An autoload map may be either an associative array, or a file returning | ||
* an associative array. | ||
* | ||
* An autoload map should be an associative array containing | ||
* An autoload map should be an associative array containing | ||
* classname/file pairs. | ||
* | ||
* @param string|array $map | ||
* | ||
* @param string|array $map | ||
* @return ClassMapAutoloader | ||
*/ | ||
public function registerAutoloadMap($map) | ||
|
@@ -116,8 +103,8 @@ public function registerAutoloadMap($map) | |
|
||
/** | ||
* Register many autoload maps at once | ||
* | ||
* @param array $locations | ||
* | ||
* @param array $locations | ||
* @return ClassMapAutoloader | ||
*/ | ||
public function registerAutoloadMaps($locations) | ||
|
@@ -134,7 +121,7 @@ public function registerAutoloadMaps($locations) | |
|
||
/** | ||
* Retrieve current autoload map | ||
* | ||
* | ||
* @return array | ||
*/ | ||
public function getAutoloadMap() | ||
|
@@ -144,8 +131,8 @@ public function getAutoloadMap() | |
|
||
/** | ||
* Defined by Autoloadable | ||
* | ||
* @param string $class | ||
* | ||
* @param string $class | ||
* @return void | ||
*/ | ||
public function autoload($class) | ||
|
@@ -157,7 +144,7 @@ public function autoload($class) | |
|
||
/** | ||
* Register the autoloader with spl_autoload registry | ||
* | ||
* | ||
* @return void | ||
*/ | ||
public function register() | ||
|
@@ -171,8 +158,8 @@ public function register() | |
* If the map has been previously loaded, returns the current instance; | ||
* otherwise, returns whatever was returned by calling include() on the | ||
* location. | ||
* | ||
* @param string $location | ||
* | ||
* @param string $location | ||
* @return ClassMapAutoloader|mixed | ||
* @throws Exception\InvalidArgumentException for nonexistent locations | ||
*/ | ||
|
@@ -203,16 +190,16 @@ protected function loadMapFromFile($location) | |
/** | ||
* Resolve the real_path() to a file within a phar. | ||
* | ||
* @see https://bugs.php.net/bug.php?id=52769 | ||
* @param string $path | ||
* @see https://bugs.php.net/bug.php?id=52769 | ||
* @param string $path | ||
* @return string | ||
*/ | ||
public static function realPharPath($path) | ||
{ | ||
if (strpos($path, 'phar:///') !== 0) { | ||
return; | ||
} | ||
|
||
$parts = explode('/', str_replace(array('/','\\'), '/', substr($path, 8))); | ||
$parts = array_values(array_filter($parts, function($p) { return ($p !== '' && $p !== '.'); })); | ||
|
||
|
Oops, something went wrong.