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

@@ -0,0 +1,29 @@
# Changelog
All notable changes to this project will be documented in this file, in reverse chronological order by release.
## 2.6.0 - 2018-04-30
### Added
- [#16](https://github.com/zendframework/zend-loader/pull/16) adds support for PHP 7.1 and 7.2.
- [#8](https://github.com/zendframework/zend-loader/pull/8) adds documentation at https://docs.zendframework.com/zend-loader/
### Changed
- Nothing.
### Deprecated
- Nothing.
### Removed
- [#16](https://github.com/zendframework/zend-loader/pull/16) removes support for PHP 5.5.
- [#16](https://github.com/zendframework/zend-loader/pull/16) removes support for HHVM.
### Fixed
- Nothing.

View File

@@ -1,229 +0,0 @@
# CONTRIBUTING
## RESOURCES
If you wish to contribute to Zend Framework, please be sure to
read/subscribe to the following resources:
- [Coding Standards](https://github.com/zendframework/zf2/wiki/Coding-Standards)
- [Contributor's Guide](http://framework.zend.com/participate/contributor-guide)
- ZF Contributor's mailing list:
Archives: http://zend-framework-community.634137.n4.nabble.com/ZF-Contributor-f680267.html
Subscribe: zf-contributors-subscribe@lists.zend.com
- ZF Contributor's IRC channel:
#zftalk.dev on Freenode.net
If you are working on new features or refactoring [create a proposal](https://github.com/zendframework/zend-loader/issues/new).
## Reporting Potential Security Issues
If you have encountered a potential security vulnerability, please **DO NOT** report it on the public
issue tracker: send it to us at [zf-security@zend.com](mailto:zf-security@zend.com) instead.
We will work with you to verify the vulnerability and patch it as soon as possible.
When reporting issues, please provide the following information:
- Component(s) affected
- A description indicating how to reproduce the issue
- A summary of the security vulnerability and impact
We request that you contact us via the email address above and give the project
contributors a chance to resolve the vulnerability and issue a new release prior
to any public exposure; this helps protect users and provides them with a chance
to upgrade and/or update in order to protect their applications.
For sensitive email communications, please use [our PGP key](http://framework.zend.com/zf-security-pgp-key.asc).
## RUNNING TESTS
> ### Note: testing versions prior to 2.4
>
> This component originates with Zend Framework 2. During the lifetime of ZF2,
> testing infrastructure migrated from PHPUnit 3 to PHPUnit 4. In most cases, no
> changes were necessary. However, due to the migration, tests may not run on
> versions < 2.4. As such, you may need to change the PHPUnit dependency if
> attempting a fix on such a version.
To run tests:
- Clone the repository:
```console
$ git clone git@github.com:zendframework/zend-loader.git
$ cd
```
- Install dependencies via composer:
```console
$ curl -sS https://getcomposer.org/installer | php --
$ ./composer.phar install
```
If you don't have `curl` installed, you can also download `composer.phar` from https://getcomposer.org/
- Run the tests via `phpunit` and the provided PHPUnit config, like in this example:
```console
$ ./vendor/bin/phpunit
```
You can turn on conditional tests with the phpunit.xml file.
To do so:
- Copy `phpunit.xml.dist` file to `phpunit.xml`
- Edit `phpunit.xml` to enable any specific functionality you
want to test, as well as to provide test values to utilize.
## Running Coding Standards Checks
This component uses [php-cs-fixer](http://cs.sensiolabs.org/) for coding
standards checks, and provides configuration for our selected checks.
`php-cs-fixer` is installed by default via Composer.
To run checks only:
```console
$ ./vendor/bin/php-cs-fixer fix . -v --diff --dry-run --config-file=.php_cs
```
To have `php-cs-fixer` attempt to fix problems for you, omit the `--dry-run`
flag:
```console
$ ./vendor/bin/php-cs-fixer fix . -v --diff --config-file=.php_cs
```
If you allow php-cs-fixer to fix CS issues, please re-run the tests to ensure
they pass, and make sure you add and commit the changes after verification.
## Recommended Workflow for Contributions
Your first step is to establish a public repository from which we can
pull your work into the master repository. We recommend using
[GitHub](https://github.com), as that is where the component is already hosted.
1. Setup a [GitHub account](http://github.com/), if you haven't yet
2. Fork the repository (http://github.com/zendframework/zend-loader)
3. Clone the canonical repository locally and enter it.
```console
$ git clone git://github.com:zendframework/zend-loader.git
$ cd zend-loader
```
4. Add a remote to your fork; substitute your GitHub username in the command
below.
```console
$ git remote add {username} git@github.com:{username}/zend-loader.git
$ git fetch {username}
```
### Keeping Up-to-Date
Periodically, you should update your fork or personal repository to
match the canonical ZF repository. Assuming you have setup your local repository
per the instructions above, you can do the following:
```console
$ git checkout master
$ git fetch origin
$ git rebase origin/master
# OPTIONALLY, to keep your remote up-to-date -
$ git push {username} master:master
```
If you're tracking other branches -- for example, the "develop" branch, where
new feature development occurs -- you'll want to do the same operations for that
branch; simply substitute "develop" for "master".
### Working on a patch
We recommend you do each new feature or bugfix in a new branch. This simplifies
the task of code review as well as the task of merging your changes into the
canonical repository.
A typical workflow will then consist of the following:
1. Create a new local branch based off either your master or develop branch.
2. Switch to your new local branch. (This step can be combined with the
previous step with the use of `git checkout -b`.)
3. Do some work, commit, repeat as necessary.
4. Push the local branch to your remote repository.
5. Send a pull request.
The mechanics of this process are actually quite trivial. Below, we will
create a branch for fixing an issue in the tracker.
```console
$ git checkout -b hotfix/9295
Switched to a new branch 'hotfix/9295'
```
... do some work ...
```console
$ git commit
```
... write your log message ...
```console
$ git push {username} hotfix/9295:hotfix/9295
Counting objects: 38, done.
Delta compression using up to 2 threads.
Compression objects: 100% (18/18), done.
Writing objects: 100% (20/20), 8.19KiB, done.
Total 20 (delta 12), reused 0 (delta 0)
To ssh://git@github.com/{username}/zend-loader.git
b5583aa..4f51698 HEAD -> master
```
To send a pull request, you have two options.
If using GitHub, you can do the pull request from there. Navigate to
your repository, select the branch you just created, and then select the
"Pull Request" button in the upper right. Select the user/organization
"zendframework" as the recipient.
If using your own repository - or even if using GitHub - you can use `git
format-patch` to create a patchset for us to apply; in fact, this is
**recommended** for security-related patches. If you use `format-patch`, please
send the patches as attachments to:
- zf-devteam@zend.com for patches without security implications
- zf-security@zend.com for security patches
#### What branch to issue the pull request against?
Which branch should you issue a pull request against?
- For fixes against the stable release, issue the pull request against the
"master" branch.
- For new features, or fixes that introduce new elements to the public API (such
as new public methods or properties), issue the pull request against the
"develop" branch.
### Branch Cleanup
As you might imagine, if you are a frequent contributor, you'll start to
get a ton of branches both locally and on your remote.
Once you know that your changes have been accepted to the master
repository, we suggest doing some cleanup of these branches.
- Local branch cleanup
```console
$ git branch -d <branchname>
```
- Remote branch removal
```console
$ git push {username} :<branchname>
```

View File

@@ -1,16 +1,15 @@
Copyright (c) 2005-2015, Zend Technologies USA, Inc.
Copyright (c) 2005-2018, Zend Technologies USA, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
- Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
- Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
- Neither the name of Zend Technologies USA, Inc. nor the names of its
contributors may be used to endorse or promote products derived from this

View File

@@ -1,10 +1,9 @@
# zend-loader
[![Build Status](https://secure.travis-ci.org/zendframework/zend-loader.svg?branch=master)](https://secure.travis-ci.org/zendframework/zend-loader)
[![Coverage Status](https://coveralls.io/repos/zendframework/zend-loader/badge.svg?branch=master)](https://coveralls.io/r/zendframework/zend-loader?branch=master)
`Zend\Loader` provides different strategies for autoloading PHP classes.
[![Coverage Status](https://coveralls.io/repos/github/zendframework/zend-loader/badge.svg?branch=master)](https://coveralls.io/github/zendframework/zend-loader?branch=master)
zend-loader provides different strategies for autoloading PHP classes.
- File issues at https://github.com/zendframework/zend-loader/issues
- Documentation is at http://framework.zend.com/manual/current/en/index.html#zend-loader
- Documentation is at https://docs.zendframework.com/zend-loader/

View File

@@ -1,35 +1,54 @@
{
"name": "zendframework/zend-loader",
"description": " ",
"description": "Autoloading and plugin loading strategies",
"license": "BSD-3-Clause",
"keywords": [
"zf2",
"zf",
"zendframework",
"loader"
],
"homepage": "https://github.com/zendframework/zend-loader",
"support": {
"docs": "https://docs.zendframework.com/zend-loader/",
"issues": "https://github.com/zendframework/zend-loader/issues",
"source": "https://github.com/zendframework/zend-loader",
"rss": "https://github.com/zendframework/zend-loader/releases.atom",
"chat": "https://zendframework-slack.herokuapp.com",
"forum": "https://discourse.zendframework.com/c/questions/components"
},
"require": {
"php": "^5.6 || ^7.0"
},
"require-dev": {
"phpunit/phpunit": "^5.7.27 || ^6.5.8 || ^7.1.4",
"zendframework/zend-coding-standard": "~1.0.0"
},
"autoload": {
"psr-4": {
"Zend\\Loader\\": "src/"
}
},
"require": {
"php": ">=5.3.23"
},
"minimum-stability": "dev",
"prefer-stable": true,
"extra": {
"branch-alias": {
"dev-master": "2.5-dev",
"dev-develop": "2.6-dev"
}
},
"autoload-dev": {
"psr-4": {
"ZendTest\\Loader\\": "test/"
}
},
"require-dev": {
"fabpot/php-cs-fixer": "1.7.*",
"phpunit/PHPUnit": "~4.0"
"config": {
"sort-packages": true
},
"extra": {
"branch-alias": {
"dev-master": "2.6.x-dev",
"dev-develop": "2.7.x-dev"
}
},
"scripts": {
"check": [
"@cs-check",
"@test"
],
"cs-check": "phpcs",
"cs-fix": "phpcbf",
"test": "phpunit --colors=always",
"test-coverage": "phpunit --colors=always --coverage-clover clover.xml"
}
}
}

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;
}