Laravel version update

Laravel version update
This commit is contained in:
Manish Verma
2018-08-06 18:48:58 +05:30
parent d143048413
commit 126fbb0255
13678 changed files with 1031482 additions and 778530 deletions

View File

@@ -1,10 +1,8 @@
<?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @see https://github.com/zendframework/zend-loader for the canonical source repository
* @copyright Copyright (c) 2005-2018 Zend Technologies USA Inc. (https://www.zend.com)
* @license https://github.com/zendframework/zend-loader/blob/master/LICENSE.md New BSD License
*/
namespace Zend\Loader;
@@ -22,7 +20,7 @@ abstract class AutoloaderFactory
/**
* @var array All autoloaders registered using the factory
*/
protected static $loaders = array();
protected static $loaders = [];
/**
* @var StandardAutoloader StandardAutoloader instance for resolving
@@ -59,7 +57,7 @@ abstract class AutoloaderFactory
public static function factory($options = null)
{
if (null === $options) {
if (!isset(static::$loaders[static::STANDARD_AUTOLOADER])) {
if (! isset(static::$loaders[static::STANDARD_AUTOLOADER])) {
$autoloader = static::getStandardAutoloader();
$autoloader->register();
static::$loaders[static::STANDARD_AUTOLOADER] = $autoloader;
@@ -69,7 +67,7 @@ abstract class AutoloaderFactory
return;
}
if (!is_array($options) && !($options instanceof Traversable)) {
if (! is_array($options) && ! ($options instanceof Traversable)) {
require_once __DIR__ . '/Exception/InvalidArgumentException.php';
throw new Exception\InvalidArgumentException(
'Options provided must be an array or Traversable'
@@ -77,16 +75,16 @@ abstract class AutoloaderFactory
}
foreach ($options as $class => $autoloaderOptions) {
if (!isset(static::$loaders[$class])) {
if (! isset(static::$loaders[$class])) {
$autoloader = static::getStandardAutoloader();
if (!class_exists($class) && !$autoloader->autoload($class)) {
if (! class_exists($class) && ! $autoloader->autoload($class)) {
require_once 'Exception/InvalidArgumentException.php';
throw new Exception\InvalidArgumentException(
sprintf('Autoloader class "%s" not loaded', $class)
);
}
if (!is_subclass_of($class, 'Zend\Loader\SplAutoloader')) {
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)
@@ -127,7 +125,7 @@ abstract class AutoloaderFactory
*/
public static function getRegisteredAutoloader($class)
{
if (!isset(static::$loaders[$class])) {
if (! isset(static::$loaders[$class])) {
require_once 'Exception/InvalidArgumentException.php';
throw new Exception\InvalidArgumentException(sprintf('Autoloader class "%s" not loaded', $class));
}
@@ -143,7 +141,7 @@ abstract class AutoloaderFactory
public static function unregisterAutoloaders()
{
foreach (static::getRegisteredAutoloaders() as $class => $autoloader) {
spl_autoload_unregister(array($autoloader, 'autoload'));
spl_autoload_unregister([$autoloader, 'autoload']);
unset(static::$loaders[$class]);
}
}
@@ -156,12 +154,12 @@ abstract class AutoloaderFactory
*/
public static function unregisterAutoloader($autoloaderClass)
{
if (!isset(static::$loaders[$autoloaderClass])) {
if (! isset(static::$loaders[$autoloaderClass])) {
return false;
}
$autoloader = static::$loaders[$autoloaderClass];
spl_autoload_unregister(array($autoloader, 'autoload'));
spl_autoload_unregister([$autoloader, 'autoload']);
unset(static::$loaders[$autoloaderClass]);
return true;
}
@@ -182,7 +180,7 @@ abstract class AutoloaderFactory
}
if (!class_exists(static::STANDARD_AUTOLOADER)) {
if (! class_exists(static::STANDARD_AUTOLOADER)) {
// Extract the filename from the classname
$stdAutoloader = substr(strrchr(static::STANDARD_AUTOLOADER, '\\'), 1);
require_once __DIR__ . "/$stdAutoloader.php";

View File

@@ -1,10 +1,8 @@
<?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @see https://github.com/zendframework/zend-loader for the canonical source repository
* @copyright Copyright (c) 2005-2018 Zend Technologies USA Inc. (https://www.zend.com)
* @license https://github.com/zendframework/zend-loader/blob/master/LICENSE.md New BSD License
*/
namespace Zend\Loader;
@@ -25,13 +23,13 @@ class ClassMapAutoloader implements SplAutoloader
* Registry of map files that have already been loaded
* @var array
*/
protected $mapsLoaded = array();
protected $mapsLoaded = [];
/**
* Class name/filename map
* @var array
*/
protected $map = array();
protected $map = [];
/**
* Constructor
@@ -83,7 +81,7 @@ class ClassMapAutoloader implements SplAutoloader
}
}
if (!is_array($map)) {
if (! is_array($map)) {
require_once __DIR__ . '/Exception/InvalidArgumentException.php';
throw new Exception\InvalidArgumentException(sprintf(
'Map file provided does not return a map. Map file: "%s"',
@@ -109,7 +107,7 @@ class ClassMapAutoloader implements SplAutoloader
*/
public function registerAutoloadMaps($locations)
{
if (!is_array($locations) && !($locations instanceof Traversable)) {
if (! is_array($locations) && ! ($locations instanceof Traversable)) {
require_once __DIR__ . '/Exception/InvalidArgumentException.php';
throw new Exception\InvalidArgumentException('Map list must be an array or implement Traversable');
}
@@ -150,7 +148,7 @@ class ClassMapAutoloader implements SplAutoloader
*/
public function register()
{
spl_autoload_register(array($this, 'autoload'), true, true);
spl_autoload_register([$this, 'autoload'], true, true);
}
/**
@@ -166,7 +164,7 @@ class ClassMapAutoloader implements SplAutoloader
*/
protected function loadMapFromFile($location)
{
if (!file_exists($location)) {
if (! file_exists($location)) {
require_once __DIR__ . '/Exception/InvalidArgumentException.php';
throw new Exception\InvalidArgumentException(sprintf(
'Map file provided does not exist. Map file: "%s"',
@@ -174,7 +172,7 @@ class ClassMapAutoloader implements SplAutoloader
));
}
if (!$path = static::realPharPath($location)) {
if (! $path = static::realPharPath($location)) {
$path = realpath($location);
}
@@ -197,19 +195,19 @@ class ClassMapAutoloader implements SplAutoloader
*/
public static function realPharPath($path)
{
if (!preg_match('|^phar:(/{2,3})|', $path, $match)) {
if (! preg_match('|^phar:(/{2,3})|', $path, $match)) {
return;
}
$prefixLength = 5 + strlen($match[1]);
$parts = explode('/', str_replace(array('/', '\\'), '/', substr($path, $prefixLength)));
$parts = explode('/', str_replace(['/', '\\'], '/', substr($path, $prefixLength)));
$parts = array_values(array_filter($parts, function ($p) {
return ($p !== '' && $p !== '.');
}));
array_walk($parts, function ($value, $key) use (&$parts) {
if ($value === '..') {
unset($parts[$key], $parts[$key-1]);
unset($parts[$key], $parts[$key - 1]);
$parts = array_values($parts);
}
});

View File

@@ -1,10 +1,8 @@
<?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @see https://github.com/zendframework/zend-loader for the canonical source repository
* @copyright Copyright (c) 2005-2018 Zend Technologies USA Inc. (https://www.zend.com)
* @license https://github.com/zendframework/zend-loader/blob/master/LICENSE.md New BSD License
*/
namespace Zend\Loader\Exception;

View File

@@ -1,10 +1,8 @@
<?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @see https://github.com/zendframework/zend-loader for the canonical source repository
* @copyright Copyright (c) 2005-2018 Zend Technologies USA Inc. (https://www.zend.com)
* @license https://github.com/zendframework/zend-loader/blob/master/LICENSE.md New BSD License
*/
namespace Zend\Loader\Exception;

View File

@@ -1,10 +1,8 @@
<?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @see https://github.com/zendframework/zend-loader for the canonical source repository
* @copyright Copyright (c) 2005-2018 Zend Technologies USA Inc. (https://www.zend.com)
* @license https://github.com/zendframework/zend-loader/blob/master/LICENSE.md New BSD License
*/
namespace Zend\Loader\Exception;

View File

@@ -1,10 +1,8 @@
<?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @see https://github.com/zendframework/zend-loader for the canonical source repository
* @copyright Copyright (c) 2005-2018 Zend Technologies USA Inc. (https://www.zend.com)
* @license https://github.com/zendframework/zend-loader/blob/master/LICENSE.md New BSD License
*/
namespace Zend\Loader\Exception;

View File

@@ -1,10 +1,8 @@
<?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @see https://github.com/zendframework/zend-loader for the canonical source repository
* @copyright Copyright (c) 2005-2018 Zend Technologies USA Inc. (https://www.zend.com)
* @license https://github.com/zendframework/zend-loader/blob/master/LICENSE.md New BSD License
*/
namespace Zend\Loader\Exception;

View File

@@ -1,10 +1,8 @@
<?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @see https://github.com/zendframework/zend-loader for the canonical source repository
* @copyright Copyright (c) 2005-2018 Zend Technologies USA Inc. (https://www.zend.com)
* @license https://github.com/zendframework/zend-loader/blob/master/LICENSE.md New BSD License
*/
namespace Zend\Loader\Exception;

View File

@@ -1,10 +1,8 @@
<?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @see https://github.com/zendframework/zend-loader for the canonical source repository
* @copyright Copyright (c) 2005-2018 Zend Technologies USA Inc. (https://www.zend.com)
* @license https://github.com/zendframework/zend-loader/blob/master/LICENSE.md New BSD License
*/
namespace Zend\Loader\Exception;

View File

@@ -1,10 +1,8 @@
<?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @see https://github.com/zendframework/zend-loader for the canonical source repository
* @copyright Copyright (c) 2005-2018 Zend Technologies USA Inc. (https://www.zend.com)
* @license https://github.com/zendframework/zend-loader/blob/master/LICENSE.md New BSD License
*/
namespace Zend\Loader\Exception;

View File

@@ -1,10 +1,8 @@
<?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @see https://github.com/zendframework/zend-loader for the canonical source repository
* @copyright Copyright (c) 2005-2018 Zend Technologies USA Inc. (https://www.zend.com)
* @license https://github.com/zendframework/zend-loader/blob/master/LICENSE.md New BSD License
*/
namespace Zend\Loader\Exception;

View File

@@ -1,10 +1,8 @@
<?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @see https://github.com/zendframework/zend-loader for the canonical source repository
* @copyright Copyright (c) 2005-2018 Zend Technologies USA Inc. (https://www.zend.com)
* @license https://github.com/zendframework/zend-loader/blob/master/LICENSE.md New BSD License
*/
namespace Zend\Loader;
@@ -23,17 +21,17 @@ class ModuleAutoloader implements SplAutoloader
/**
* @var array An array of module paths to scan
*/
protected $paths = array();
protected $paths = [];
/**
* @var array An array of modulename => path
*/
protected $explicitPaths = array();
protected $explicitPaths = [];
/**
* @var array An array of namespaceName => namespacePath
*/
protected $namespacedPaths = array();
protected $namespacedPaths = [];
/**
* @var string Will contain the absolute phar:// path to the executable when packaged as phar file
@@ -43,12 +41,12 @@ class ModuleAutoloader implements SplAutoloader
/**
* @var array An array of supported phar extensions (filled on constructor)
*/
protected $pharExtensions = array();
protected $pharExtensions = [];
/**
* @var array An array of module classes to their containing files
*/
protected $moduleClassMap = array();
protected $moduleClassMap = [];
/**
* Constructor
@@ -61,11 +59,11 @@ class ModuleAutoloader implements SplAutoloader
{
if (extension_loaded('phar')) {
$this->pharBasePath = Phar::running(true);
$this->pharExtensions = array(
$this->pharExtensions = [
'phar',
'phar.tar',
'tar',
);
];
// ext/zlib enabled -> phar can read gzip & zip compressed files
if (extension_loaded('zlib')) {
@@ -193,7 +191,7 @@ class ModuleAutoloader implements SplAutoloader
$path = $path . $moduleClassPath;
if ($path == '.' || substr($path, 0, 2) == './' || substr($path, 0, 2) == '.\\') {
if (!$basePath = $this->pharBasePath) {
if (! $basePath = $this->pharBasePath) {
$basePath = realpath('.');
}
@@ -216,7 +214,7 @@ class ModuleAutoloader implements SplAutoloader
continue;
}
if (!preg_match('#.+\.' . $pharSuffixPattern . '$#', $entry->getPathname())) {
if (! preg_match('#.+\.' . $pharSuffixPattern . '$#', $entry->getPathname())) {
continue;
}
@@ -274,7 +272,7 @@ class ModuleAutoloader implements SplAutoloader
{
$pharPath = static::normalizePath($pharPath, false);
$file = new SplFileInfo($pharPath);
if (!$file->isReadable() || !$file->isFile()) {
if (! $file->isReadable() || ! $file->isFile()) {
return false;
}
@@ -325,7 +323,7 @@ class ModuleAutoloader implements SplAutoloader
*/
public function register()
{
spl_autoload_register(array($this, 'autoload'));
spl_autoload_register([$this, 'autoload']);
}
/**
@@ -335,7 +333,7 @@ class ModuleAutoloader implements SplAutoloader
*/
public function unregister()
{
spl_autoload_unregister(array($this, 'autoload'));
spl_autoload_unregister([$this, 'autoload']);
}
/**
@@ -347,7 +345,7 @@ class ModuleAutoloader implements SplAutoloader
*/
public function registerPaths($paths)
{
if (!is_array($paths) && !$paths instanceof Traversable) {
if (! is_array($paths) && ! $paths instanceof Traversable) {
require_once __DIR__ . '/Exception/InvalidArgumentException.php';
throw new Exception\InvalidArgumentException(
'Parameter to \\Zend\\Loader\\ModuleAutoloader\'s '
@@ -377,7 +375,7 @@ class ModuleAutoloader implements SplAutoloader
*/
public function registerPath($path, $moduleName = false)
{
if (!is_string($path)) {
if (! is_string($path)) {
require_once __DIR__ . '/Exception/InvalidArgumentException.php';
throw new Exception\InvalidArgumentException(sprintf(
'Invalid path provided; must be a string, received %s',
@@ -385,7 +383,7 @@ class ModuleAutoloader implements SplAutoloader
));
}
if ($moduleName) {
if (in_array(substr($moduleName, -2), array('\\*', '\\%'))) {
if (in_array(substr($moduleName, -2), ['\\*', '\\%'])) {
$this->namespacedPaths[substr($moduleName, 0, -2)] = static::normalizePath($path);
} else {
$this->explicitPaths[$moduleName] = static::normalizePath($path);

View File

@@ -1,10 +1,8 @@
<?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @see https://github.com/zendframework/zend-loader for the canonical source repository
* @copyright Copyright (c) 2005-2018 Zend Technologies USA Inc. (https://www.zend.com)
* @license https://github.com/zendframework/zend-loader/blob/master/LICENSE.md New BSD License
*/
namespace Zend\Loader;
@@ -22,13 +20,13 @@ class PluginClassLoader implements PluginClassLocator
* List of plugin name => class name pairs
* @var array
*/
protected $plugins = array();
protected $plugins = [];
/**
* Static map allow global seeding of plugin loader
* @var array
*/
protected static $staticMap = array();
protected static $staticMap = [];
/**
* Constructor
@@ -38,7 +36,7 @@ class PluginClassLoader implements PluginClassLocator
public function __construct($map = null)
{
// Merge in static overrides
if (!empty(static::$staticMap)) {
if (! empty(static::$staticMap)) {
$this->registerPlugins(static::$staticMap);
}
@@ -60,11 +58,11 @@ class PluginClassLoader implements PluginClassLocator
public static function addStaticMap($map)
{
if (null === $map) {
static::$staticMap = array();
static::$staticMap = [];
return;
}
if (!is_array($map) && !$map instanceof Traversable) {
if (! is_array($map) && ! $map instanceof Traversable) {
throw new Exception\InvalidArgumentException('Expects an array or Traversable object');
}
foreach ($map as $key => $value) {
@@ -105,7 +103,7 @@ class PluginClassLoader implements PluginClassLocator
public function registerPlugins($map)
{
if (is_string($map)) {
if (!class_exists($map)) {
if (! class_exists($map)) {
throw new Exception\InvalidArgumentException('Map class provided is invalid');
}
$map = new $map;
@@ -113,7 +111,7 @@ class PluginClassLoader implements PluginClassLocator
if (is_array($map)) {
$map = new ArrayIterator($map);
}
if (!$map instanceof Traversable) {
if (! $map instanceof Traversable) {
throw new Exception\InvalidArgumentException('Map provided is invalid; must be traversable');
}
@@ -124,7 +122,7 @@ class PluginClassLoader implements PluginClassLocator
foreach ($map as $name => $class) {
if (is_int($name) || is_numeric($name)) {
if (!is_object($class) && class_exists($class)) {
if (! is_object($class) && class_exists($class)) {
$class = new $class();
}
@@ -196,7 +194,7 @@ class PluginClassLoader implements PluginClassLocator
*/
public function load($name)
{
if (!$this->isLoaded($name)) {
if (! $this->isLoaded($name)) {
return false;
}
return $this->plugins[strtolower($name)];

View File

@@ -1,10 +1,8 @@
<?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @see https://github.com/zendframework/zend-loader for the canonical source repository
* @copyright Copyright (c) 2005-2018 Zend Technologies USA Inc. (https://www.zend.com)
* @license https://github.com/zendframework/zend-loader/blob/master/LICENSE.md New BSD License
*/
namespace Zend\Loader;

View File

@@ -1,10 +1,8 @@
<?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @see https://github.com/zendframework/zend-loader for the canonical source repository
* @copyright Copyright (c) 2005-2018 Zend Technologies USA Inc. (https://www.zend.com)
* @license https://github.com/zendframework/zend-loader/blob/master/LICENSE.md New BSD License
*/
namespace Zend\Loader;

View File

@@ -1,10 +1,8 @@
<?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @see https://github.com/zendframework/zend-loader for the canonical source repository
* @copyright Copyright (c) 2005-2018 Zend Technologies USA Inc. (https://www.zend.com)
* @license https://github.com/zendframework/zend-loader/blob/master/LICENSE.md New BSD License
*/
namespace Zend\Loader;

View File

@@ -1,10 +1,8 @@
<?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @see https://github.com/zendframework/zend-loader for the canonical source repository
* @copyright Copyright (c) 2005-2018 Zend Technologies USA Inc. (https://www.zend.com)
* @license https://github.com/zendframework/zend-loader/blob/master/LICENSE.md New BSD License
*/
namespace Zend\Loader;
@@ -31,12 +29,12 @@ class StandardAutoloader implements SplAutoloader
/**
* @var array Namespace/directory pairs to search; ZF library added by default
*/
protected $namespaces = array();
protected $namespaces = [];
/**
* @var array Prefix/directory pairs to search
*/
protected $prefixes = array();
protected $prefixes = [];
/**
* @var bool Whether or not the autoloader should also act as a fallback autoloader
@@ -79,7 +77,7 @@ class StandardAutoloader implements SplAutoloader
*/
public function setOptions($options)
{
if (!is_array($options) && !($options instanceof \Traversable)) {
if (! is_array($options) && ! ($options instanceof \Traversable)) {
require_once __DIR__ . '/Exception/InvalidArgumentException.php';
throw new Exception\InvalidArgumentException('Options must be either an array or Traversable');
}
@@ -89,7 +87,10 @@ class StandardAutoloader implements SplAutoloader
case self::AUTOREGISTER_ZF:
if ($pairs) {
$this->registerNamespace('Zend', dirname(__DIR__));
$this->registerNamespace('ZendXml', dirname(dirname((__DIR__))) . DIRECTORY_SEPARATOR . 'ZendXml');
$this->registerNamespace(
'ZendXml',
dirname(dirname((__DIR__))) . DIRECTORY_SEPARATOR . 'ZendXml'
);
}
break;
case self::LOAD_NS:
@@ -157,7 +158,7 @@ class StandardAutoloader implements SplAutoloader
*/
public function registerNamespaces($namespaces)
{
if (!is_array($namespaces) && !$namespaces instanceof \Traversable) {
if (! is_array($namespaces) && ! $namespaces instanceof \Traversable) {
require_once __DIR__ . '/Exception/InvalidArgumentException.php';
throw new Exception\InvalidArgumentException('Namespace pairs must be either an array or Traversable');
}
@@ -191,7 +192,7 @@ class StandardAutoloader implements SplAutoloader
*/
public function registerPrefixes($prefixes)
{
if (!is_array($prefixes) && !$prefixes instanceof \Traversable) {
if (! is_array($prefixes) && ! $prefixes instanceof \Traversable) {
require_once __DIR__ . '/Exception/InvalidArgumentException.php';
throw new Exception\InvalidArgumentException('Prefix pairs must be either an array or Traversable');
}
@@ -240,7 +241,7 @@ class StandardAutoloader implements SplAutoloader
*/
public function register()
{
spl_autoload_register(array($this, 'autoload'));
spl_autoload_register([$this, 'autoload']);
}
/**
@@ -254,7 +255,7 @@ class StandardAutoloader implements SplAutoloader
{
// $class may contain a namespace portion, in which case we need
// to preserve any underscores in that portion.
$matches = array();
$matches = [];
preg_match('/(?P<namespace>.+\\\)?(?P<class>[^\\\]+$)/', $class, $matches);
$class = (isset($matches['class'])) ? $matches['class'] : '';
@@ -276,7 +277,7 @@ class StandardAutoloader implements SplAutoloader
*/
protected function loadClass($class, $type)
{
if (!in_array($type, array(self::LOAD_NS, self::LOAD_PREFIX, self::ACT_AS_FALLBACK))) {
if (! in_array($type, [self::LOAD_NS, self::LOAD_PREFIX, self::ACT_AS_FALLBACK])) {
require_once __DIR__ . '/Exception/InvalidArgumentException.php';
throw new Exception\InvalidArgumentException();
}
@@ -317,7 +318,7 @@ class StandardAutoloader implements SplAutoloader
protected function normalizeDirectory($directory)
{
$last = $directory[strlen($directory) - 1];
if (in_array($last, array('/', '\\'))) {
if (in_array($last, ['/', '\\'])) {
$directory[strlen($directory) - 1] = DIRECTORY_SEPARATOR;
return $directory;
}