Fixed namepsaces and added requirement theseer\DirectoryScanner for theseer\Autoload
This commit is contained in:
parent
210e918fb2
commit
b77beb5e00
36 changed files with 749 additions and 195 deletions
69
LICENSE
69
LICENSE
|
@ -202,3 +202,72 @@ 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.
|
||||
|
||||
------------------------
|
||||
theseer - Autoload
|
||||
|
||||
Autoload Builder
|
||||
|
||||
Copyright (c) 2010-2016 Arne Blankerts <arne@blankerts.de> and Contributors
|
||||
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 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 Arne Blankerts nor the names of contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT * NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER ORCONTRIBUTORS
|
||||
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
------------------------
|
||||
theseer - DirectoryScanner
|
||||
|
||||
DirectoryScanner
|
||||
|
||||
Copyright (c) 2009-2014 Arne Blankerts <arne@blankerts.de>
|
||||
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 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 Arne Blankerts nor the names of contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT * NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER ORCONTRIBUTORS
|
||||
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
|
9
Makefile
9
Makefile
|
@ -1,5 +1,5 @@
|
|||
PHPCC=/usr/bin/php
|
||||
$(PHPAB)=$(PHPAB)
|
||||
PHPAB=phpab
|
||||
|
||||
autoload:
|
||||
# Generates/creates all the autoloader files
|
||||
|
@ -11,6 +11,7 @@ autoload:
|
|||
make src/ncc/ThirdParty/Symfony/Filesystem/autoload_spl.php
|
||||
make src/ncc/ThirdParty/Symfony/Yaml/autoload_spl.php
|
||||
make src/ncc/ThirdParty/theseer/Autoload/autoload_spl.php
|
||||
make src/ncc/ThirdParty/theseer/DirectoryScanner/autoload_spl.php
|
||||
make src/ncc/autoload_spl.php
|
||||
cp src/autoload/autoload.php src/ncc/autoload.php
|
||||
|
||||
|
@ -46,6 +47,10 @@ src/ncc/ThirdParty/theseer/Autoload/autoload_spl.php:
|
|||
$(PHPCC) $(PHPAB) --output src/ncc/ThirdParty/theseer/Autoload/autoload_spl.php \
|
||||
src/ncc/ThirdParty/theseer/Autoload
|
||||
|
||||
src/ncc/ThirdParty/theseer/DirectoryScanner/autoload_spl.php:
|
||||
$(PHPCC) $(PHPAB) --output src/ncc/ThirdParty/theseer/DirectoryScanner/autoload_spl.php \
|
||||
src/ncc/ThirdParty/theseer/DirectoryScanner
|
||||
|
||||
src/ncc/autoload_spl.php:
|
||||
$(PHPCC) $(PHPAB) --output src/ncc/autoload_spl.php \
|
||||
src/ncc/Abstracts \
|
||||
|
@ -86,3 +91,5 @@ clean:
|
|||
rm -f src/ncc/ThirdParty/Symfony/Uid/autoload_spl.php
|
||||
rm -f src/ncc/ThirdParty/Symfony/Filesystem/autoload_spl.php
|
||||
rm -f src/ncc/ThirdParty/Symfony/Yaml/autoload_spl.php
|
||||
rm -f src/ncc/ThirdParty/theseer/Autoload/autoload_spl.php
|
||||
rm -f src/ncc/ThirdParty/theseer/DirectoryScanner/autoload_spl.php
|
||||
|
|
26
src/ncc/Classes/AutoloaderGenerator.php
Normal file
26
src/ncc/Classes/AutoloaderGenerator.php
Normal file
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
namespace ncc\Classes;
|
||||
|
||||
use ncc\Objects\ProjectConfiguration;
|
||||
|
||||
class AutoloaderGenerator
|
||||
{
|
||||
/**
|
||||
* @var ProjectConfiguration
|
||||
*/
|
||||
private ProjectConfiguration $project;
|
||||
|
||||
/**
|
||||
* @param ProjectConfiguration $project
|
||||
*/
|
||||
public function __construct(ProjectConfiguration $project)
|
||||
{
|
||||
$this->project = $project;
|
||||
}
|
||||
|
||||
public function generateAutoload(string $src, string $output, bool $static=false)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
|
@ -35,7 +35,7 @@
|
|||
* @license BSD License
|
||||
*
|
||||
*/
|
||||
namespace TheSeer\Autoload {
|
||||
namespace ncc\ThirdParty\theseer\Autoload {
|
||||
|
||||
class Application {
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
* @license BSD License
|
||||
*/
|
||||
|
||||
namespace TheSeer\Autoload {
|
||||
namespace ncc\ThirdParty\theseer\Autoload {
|
||||
|
||||
/**
|
||||
* Builds spl based autoload code for inclusion into projects
|
||||
|
|
4
src/ncc/ThirdParty/theseer/Autoload/CLI.php
vendored
4
src/ncc/ThirdParty/theseer/Autoload/CLI.php
vendored
|
@ -36,7 +36,7 @@
|
|||
* @license BSD License
|
||||
*/
|
||||
|
||||
namespace TheSeer\Autoload {
|
||||
namespace ncc\ThirdParty\theseer\Autoload {
|
||||
|
||||
/**
|
||||
* CLI interface to AutoloadRenderer / StaticRenderer
|
||||
|
@ -138,7 +138,7 @@ namespace TheSeer\Autoload {
|
|||
/**
|
||||
* @param \ezcConsoleInput $input
|
||||
*
|
||||
* @return \TheSeer\Autoload\Config
|
||||
* @return \ncc\ThirdParty\theseer\Autoload\Config
|
||||
*/
|
||||
private function configure(\ezcConsoleInput $input) {
|
||||
$config = new Config($input->getArguments());
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
namespace TheSeer\Autoload {
|
||||
|
||||
namespace ncc\ThirdParty\theseer\Autoload {
|
||||
|
||||
class Cache {
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
namespace TheSeer\Autoload {
|
||||
namespace ncc\ThirdParty\theseer\Autoload {
|
||||
|
||||
class CacheEntry {
|
||||
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
<?php
|
||||
namespace TheSeer\Autoload;
|
||||
namespace ncc\ThirdParty\theseer\Autoload;
|
||||
|
||||
use ncc\ThirdParty\theseer\Autoload\StaticListRenderer;
|
||||
|
||||
class CacheWarmingListRenderer implements StaticListRenderer {
|
||||
/**
|
||||
* @var boo
|
||||
* @var bool
|
||||
*/
|
||||
private $addReset;
|
||||
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
<?php
|
||||
namespace TheSeer\Autoload {
|
||||
|
||||
namespace ncc\ThirdParty\theseer\Autoload {
|
||||
|
||||
use ncc\ThirdParty\theseer\Autoload\ParserInterface;
|
||||
|
||||
class CachingParser implements ParserInterface {
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
namespace TheSeer\Autoload {
|
||||
namespace ncc\ThirdParty\theseer\Autoload {
|
||||
|
||||
use TheSeer\DirectoryScanner\PHPFilterIterator;
|
||||
use ncc\ThirdParty\theseer\DirectoryScanner\PHPFilterIterator;
|
||||
|
||||
class Collector {
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
namespace TheSeer\Autoload {
|
||||
namespace ncc\ThirdParty\theseer\Autoload {
|
||||
|
||||
class CollectorResult {
|
||||
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
<?php
|
||||
namespace TheSeer\Autoload {
|
||||
namespace ncc\ThirdParty\theseer\Autoload {
|
||||
|
||||
class ComposerIterator implements \Iterator {
|
||||
use Exception;
|
||||
use Iterator;
|
||||
use ReturnTypeWillChange;
|
||||
use SplFileInfo;
|
||||
|
||||
class ComposerIterator implements Iterator {
|
||||
|
||||
/**
|
||||
* @var array
|
||||
|
@ -12,7 +17,7 @@ namespace TheSeer\Autoload {
|
|||
|
||||
private $pos = 0;
|
||||
|
||||
public function __construct(\SplFileInfo $composerFile) {
|
||||
public function __construct(SplFileInfo $composerFile) {
|
||||
if (!$composerFile->isFile() || !$composerFile->isReadable()) {
|
||||
throw new ComposerIteratorException(
|
||||
sprintf('Composer file "%s" not found or not readable', $composerFile->getPathname()),
|
||||
|
@ -115,7 +120,7 @@ namespace TheSeer\Autoload {
|
|||
* @link http://php.net/manual/en/iterator.current.php
|
||||
* @return mixed Can return any type.
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
#[ReturnTypeWillChange]
|
||||
public function current() {
|
||||
return $this->directories[$this->pos];
|
||||
}
|
||||
|
@ -127,7 +132,7 @@ namespace TheSeer\Autoload {
|
|||
* @link http://php.net/manual/en/iterator.next.php
|
||||
* @return void Any returned value is ignored.
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
#[ReturnTypeWillChange]
|
||||
public function next() {
|
||||
$this->pos++;
|
||||
}
|
||||
|
@ -139,7 +144,7 @@ namespace TheSeer\Autoload {
|
|||
* @link http://php.net/manual/en/iterator.key.php
|
||||
* @return mixed scalar on success, or null on failure.
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
#[ReturnTypeWillChange]
|
||||
public function key() {
|
||||
return $this->pos;
|
||||
}
|
||||
|
@ -152,7 +157,7 @@ namespace TheSeer\Autoload {
|
|||
* @return boolean The return value will be casted to boolean and then evaluated.
|
||||
* Returns true on success or false on failure.
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
#[ReturnTypeWillChange]
|
||||
public function valid() {
|
||||
return $this->pos < count($this->directories);
|
||||
}
|
||||
|
@ -164,14 +169,14 @@ namespace TheSeer\Autoload {
|
|||
* @link http://php.net/manual/en/iterator.rewind.php
|
||||
* @return void Any returned value is ignored.
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
#[ReturnTypeWillChange]
|
||||
public function rewind() {
|
||||
$this->pos = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class ComposerIteratorException extends \Exception {
|
||||
class ComposerIteratorException extends Exception {
|
||||
const InvalidComposerJsonFile = 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
* @license BSD License
|
||||
*
|
||||
*/
|
||||
namespace TheSeer\Autoload {
|
||||
namespace ncc\ThirdParty\theseer\Autoload {
|
||||
|
||||
class Config {
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
* @license BSD License
|
||||
*/
|
||||
|
||||
namespace TheSeer\Autoload {
|
||||
namespace ncc\ThirdParty\theseer\Autoload {
|
||||
|
||||
/**
|
||||
* Sorting classes by depdendency for static requires
|
||||
|
|
10
src/ncc/ThirdParty/theseer/Autoload/Factory.php
vendored
10
src/ncc/ThirdParty/theseer/Autoload/Factory.php
vendored
|
@ -35,10 +35,10 @@
|
|||
* @license BSD License
|
||||
*
|
||||
*/
|
||||
namespace TheSeer\Autoload {
|
||||
namespace ncc\ThirdParty\theseer\Autoload {
|
||||
|
||||
use TheSeer\DirectoryScanner\DirectoryScanner;
|
||||
use TheSeer\DirectoryScanner\IncludeExcludeFilterIterator;
|
||||
use ncc\ThirdParty\theseer\DirectoryScanner\DirectoryScanner;
|
||||
use ncc\ThirdParty\theseer\DirectoryScanner\IncludeExcludeFilterIterator;
|
||||
|
||||
class Factory {
|
||||
|
||||
|
@ -53,7 +53,7 @@ namespace TheSeer\Autoload {
|
|||
private $cache;
|
||||
|
||||
/**
|
||||
* @param \TheSeer\Autoload\Config $config
|
||||
* @param \ncc\ThirdParty\theseer\Autoload\Config $config
|
||||
*/
|
||||
public function setConfig(Config $config) {
|
||||
$this->config = $config;
|
||||
|
@ -163,8 +163,8 @@ namespace TheSeer\Autoload {
|
|||
*
|
||||
* @param CollectorResult $result
|
||||
*
|
||||
* @return \ncc\ThirdParty\theseer\Autoload\AutoloadRenderer|\ncc\ThirdParty\theseer\Autoload\StaticRenderer
|
||||
* @throws \RuntimeException
|
||||
* @return \TheSeer\Autoload\AutoloadRenderer|\TheSeer\Autoload\StaticRenderer
|
||||
*/
|
||||
public function getRenderer(CollectorResult $result) {
|
||||
$isStatic = $this->config->isStaticMode();
|
||||
|
|
31
src/ncc/ThirdParty/theseer/Autoload/LICENSE
vendored
Normal file
31
src/ncc/ThirdParty/theseer/Autoload/LICENSE
vendored
Normal file
|
@ -0,0 +1,31 @@
|
|||
Autoload Builder
|
||||
|
||||
Copyright (c) 2010-2016 Arne Blankerts <arne@blankerts.de> and Contributors
|
||||
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 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 Arne Blankerts nor the names of contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT * NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER ORCONTRIBUTORS
|
||||
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
|
@ -35,7 +35,7 @@
|
|||
* @license BSD License
|
||||
*
|
||||
*/
|
||||
namespace TheSeer\Autoload {
|
||||
namespace ncc\ThirdParty\theseer\Autoload {
|
||||
|
||||
class Logger {
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
namespace TheSeer\Autoload {
|
||||
namespace ncc\ThirdParty\theseer\Autoload {
|
||||
|
||||
class ParseResult {
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
* @license BSD License
|
||||
*/
|
||||
|
||||
namespace TheSeer\Autoload {
|
||||
namespace ncc\ThirdParty\theseer\Autoload {
|
||||
|
||||
// PHP 5.3 compat
|
||||
define('T_TRAIT_53', 10355);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
namespace TheSeer\Autoload;
|
||||
namespace ncc\ThirdParty\theseer\Autoload;
|
||||
|
||||
/**
|
||||
* Namespace aware parser to find and extract defined classes within php source files
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
namespace TheSeer\Autoload {
|
||||
namespace ncc\ThirdParty\theseer\Autoload {
|
||||
|
||||
class PathComparator {
|
||||
|
||||
|
|
|
@ -35,9 +35,9 @@
|
|||
* @license BSD License
|
||||
*
|
||||
*/
|
||||
namespace TheSeer\Autoload {
|
||||
namespace ncc\ThirdParty\theseer\Autoload {
|
||||
|
||||
use TheSeer\DirectoryScanner\DirectoryScanner;
|
||||
use ncc\ThirdParty\theseer\DirectoryScanner\DirectoryScanner;
|
||||
|
||||
class PharBuilder {
|
||||
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
<?php
|
||||
namespace TheSeer\Autoload {
|
||||
namespace ncc\ThirdParty\theseer\Autoload {
|
||||
|
||||
class SourceFile extends \SplFileInfo {
|
||||
use SplFileInfo;
|
||||
|
||||
class SourceFile extends SplFileInfo {
|
||||
|
||||
public function getTokens() {
|
||||
return token_get_all(file_get_contents($this->getRealPath()));
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
namespace TheSeer\Autoload;
|
||||
namespace ncc\ThirdParty\theseer\Autoload;
|
||||
|
||||
interface StaticListRenderer {
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
* @license BSD License
|
||||
*/
|
||||
|
||||
namespace TheSeer\Autoload {
|
||||
namespace ncc\ThirdParty\theseer\Autoload {
|
||||
|
||||
/**
|
||||
* Builds static require list for inclusion into projects
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
namespace TheSeer\Autoload;
|
||||
namespace ncc\ThirdParty\theseer\Autoload;
|
||||
|
||||
class StaticRequireListRenderer implements StaticListRenderer {
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
* @license BSD License
|
||||
*
|
||||
*/
|
||||
namespace TheSeer\Autoload {
|
||||
namespace ncc\ThirdParty\theseer\Autoload {
|
||||
|
||||
class Version {
|
||||
|
||||
|
|
153
src/ncc/ThirdParty/theseer/Autoload/autoload.php
vendored
153
src/ncc/ThirdParty/theseer/Autoload/autoload.php
vendored
|
@ -1,153 +0,0 @@
|
|||
<?php
|
||||
// @codingStandardsIgnoreFile
|
||||
// @codeCoverageIgnoreStart
|
||||
// this is an autogenerated file - do not edit
|
||||
spl_autoload_register(
|
||||
function($class) {
|
||||
static $classes = null;
|
||||
if ($classes === null) {
|
||||
$classes = array(
|
||||
'ezcbase' => '/../vendor/zetacomponents/base/src/base.php',
|
||||
'ezcbaseautoloadexception' => '/../vendor/zetacomponents/base/src/exceptions/autoload.php',
|
||||
'ezcbaseautoloadoptions' => '/../vendor/zetacomponents/base/src/options/autoload.php',
|
||||
'ezcbaseconfigurationinitializer' => '/../vendor/zetacomponents/base/src/interfaces/configuration_initializer.php',
|
||||
'ezcbasedoubleclassrepositoryprefixexception' => '/../vendor/zetacomponents/base/src/exceptions/double_class_repository_prefix.php',
|
||||
'ezcbaseexception' => '/../vendor/zetacomponents/base/src/exceptions/exception.php',
|
||||
'ezcbaseexportable' => '/../vendor/zetacomponents/base/src/interfaces/exportable.php',
|
||||
'ezcbaseextensionnotfoundexception' => '/../vendor/zetacomponents/base/src/exceptions/extension_not_found.php',
|
||||
'ezcbasefeatures' => '/../vendor/zetacomponents/base/src/features.php',
|
||||
'ezcbasefile' => '/../vendor/zetacomponents/base/src/file.php',
|
||||
'ezcbasefileexception' => '/../vendor/zetacomponents/base/src/exceptions/file_exception.php',
|
||||
'ezcbasefilefindcontext' => '/../vendor/zetacomponents/base/src/structs/file_find_context.php',
|
||||
'ezcbasefileioexception' => '/../vendor/zetacomponents/base/src/exceptions/file_io.php',
|
||||
'ezcbasefilenotfoundexception' => '/../vendor/zetacomponents/base/src/exceptions/file_not_found.php',
|
||||
'ezcbasefilepermissionexception' => '/../vendor/zetacomponents/base/src/exceptions/file_permission.php',
|
||||
'ezcbasefunctionalitynotsupportedexception' => '/../vendor/zetacomponents/base/src/exceptions/functionality_not_supported.php',
|
||||
'ezcbaseinit' => '/../vendor/zetacomponents/base/src/init.php',
|
||||
'ezcbaseinitcallbackconfiguredexception' => '/../vendor/zetacomponents/base/src/exceptions/init_callback_configured.php',
|
||||
'ezcbaseinitinvalidcallbackclassexception' => '/../vendor/zetacomponents/base/src/exceptions/invalid_callback_class.php',
|
||||
'ezcbaseinvalidparentclassexception' => '/../vendor/zetacomponents/base/src/exceptions/invalid_parent_class.php',
|
||||
'ezcbasemetadata' => '/../vendor/zetacomponents/base/src/metadata.php',
|
||||
'ezcbasemetadatapearreader' => '/../vendor/zetacomponents/base/src/metadata/pear.php',
|
||||
'ezcbasemetadatatarballreader' => '/../vendor/zetacomponents/base/src/metadata/tarball.php',
|
||||
'ezcbaseoptions' => '/../vendor/zetacomponents/base/src/options.php',
|
||||
'ezcbasepersistable' => '/../vendor/zetacomponents/base/src/interfaces/persistable.php',
|
||||
'ezcbasepropertynotfoundexception' => '/../vendor/zetacomponents/base/src/exceptions/property_not_found.php',
|
||||
'ezcbasepropertypermissionexception' => '/../vendor/zetacomponents/base/src/exceptions/property_permission.php',
|
||||
'ezcbaserepositorydirectory' => '/../vendor/zetacomponents/base/src/structs/repository_directory.php',
|
||||
'ezcbasesettingnotfoundexception' => '/../vendor/zetacomponents/base/src/exceptions/setting_not_found.php',
|
||||
'ezcbasesettingvalueexception' => '/../vendor/zetacomponents/base/src/exceptions/setting_value.php',
|
||||
'ezcbasestruct' => '/../vendor/zetacomponents/base/src/struct.php',
|
||||
'ezcbasevalueexception' => '/../vendor/zetacomponents/base/src/exceptions/value.php',
|
||||
'ezcbasewhateverexception' => '/../vendor/zetacomponents/base/src/exceptions/whatever.php',
|
||||
'ezcconsoleargument' => '/../vendor/zetacomponents/console-tools/src/input/argument.php',
|
||||
'ezcconsoleargumentalreadyregisteredexception' => '/../vendor/zetacomponents/console-tools/src/exceptions/argument_already_registered.php',
|
||||
'ezcconsoleargumentexception' => '/../vendor/zetacomponents/console-tools/src/exceptions/argument.php',
|
||||
'ezcconsoleargumentmandatoryviolationexception' => '/../vendor/zetacomponents/console-tools/src/exceptions/argument_mandatory_violation.php',
|
||||
'ezcconsolearguments' => '/../vendor/zetacomponents/console-tools/src/input/arguments.php',
|
||||
'ezcconsoleargumenttypeviolationexception' => '/../vendor/zetacomponents/console-tools/src/exceptions/argument_type_violation.php',
|
||||
'ezcconsoledialog' => '/../vendor/zetacomponents/console-tools/src/interfaces/dialog.php',
|
||||
'ezcconsoledialogabortexception' => '/../vendor/zetacomponents/console-tools/src/exceptions/dialog_abort.php',
|
||||
'ezcconsoledialogoptions' => '/../vendor/zetacomponents/console-tools/src/options/dialog.php',
|
||||
'ezcconsoledialogvalidator' => '/../vendor/zetacomponents/console-tools/src/interfaces/dialog_validator.php',
|
||||
'ezcconsoledialogviewer' => '/../vendor/zetacomponents/console-tools/src/dialog_viewer.php',
|
||||
'ezcconsoleexception' => '/../vendor/zetacomponents/console-tools/src/exceptions/exception.php',
|
||||
'ezcconsoleinput' => '/../vendor/zetacomponents/console-tools/src/input.php',
|
||||
'ezcconsoleinputhelpgenerator' => '/../vendor/zetacomponents/console-tools/src/interfaces/input_help_generator.php',
|
||||
'ezcconsoleinputstandardhelpgenerator' => '/../vendor/zetacomponents/console-tools/src/input/help_generators/standard.php',
|
||||
'ezcconsoleinputvalidator' => '/../vendor/zetacomponents/console-tools/src/interfaces/input_validator.php',
|
||||
'ezcconsoleinvalidoptionnameexception' => '/../vendor/zetacomponents/console-tools/src/exceptions/invalid_option_name.php',
|
||||
'ezcconsoleinvalidoutputtargetexception' => '/../vendor/zetacomponents/console-tools/src/exceptions/invalid_output_target.php',
|
||||
'ezcconsolemenudialog' => '/../vendor/zetacomponents/console-tools/src/dialog/menu_dialog.php',
|
||||
'ezcconsolemenudialogdefaultvalidator' => '/../vendor/zetacomponents/console-tools/src/dialog/validators/menu_dialog_default.php',
|
||||
'ezcconsolemenudialogoptions' => '/../vendor/zetacomponents/console-tools/src/options/menu_dialog.php',
|
||||
'ezcconsolemenudialogvalidator' => '/../vendor/zetacomponents/console-tools/src/interfaces/menu_dialog_validator.php',
|
||||
'ezcconsolenopositionstoredexception' => '/../vendor/zetacomponents/console-tools/src/exceptions/no_position_stored.php',
|
||||
'ezcconsolenovaliddialogresultexception' => '/../vendor/zetacomponents/console-tools/src/exceptions/no_valid_dialog_result.php',
|
||||
'ezcconsoleoption' => '/../vendor/zetacomponents/console-tools/src/input/option.php',
|
||||
'ezcconsoleoptionalreadyregisteredexception' => '/../vendor/zetacomponents/console-tools/src/exceptions/option_already_registered.php',
|
||||
'ezcconsoleoptionargumentsviolationexception' => '/../vendor/zetacomponents/console-tools/src/exceptions/option_arguments_violation.php',
|
||||
'ezcconsoleoptiondependencyviolationexception' => '/../vendor/zetacomponents/console-tools/src/exceptions/option_dependency_violation.php',
|
||||
'ezcconsoleoptionexception' => '/../vendor/zetacomponents/console-tools/src/exceptions/option.php',
|
||||
'ezcconsoleoptionexclusionviolationexception' => '/../vendor/zetacomponents/console-tools/src/exceptions/option_exclusion_violation.php',
|
||||
'ezcconsoleoptionmandatoryviolationexception' => '/../vendor/zetacomponents/console-tools/src/exceptions/option_mandatory_violation.php',
|
||||
'ezcconsoleoptionmissingvalueexception' => '/../vendor/zetacomponents/console-tools/src/exceptions/option_missing_value.php',
|
||||
'ezcconsoleoptionnoaliasexception' => '/../vendor/zetacomponents/console-tools/src/exceptions/option_no_alias.php',
|
||||
'ezcconsoleoptionnotexistsexception' => '/../vendor/zetacomponents/console-tools/src/exceptions/option_not_exists.php',
|
||||
'ezcconsoleoptionrule' => '/../vendor/zetacomponents/console-tools/src/structs/option_rule.php',
|
||||
'ezcconsoleoptionstringnotwellformedexception' => '/../vendor/zetacomponents/console-tools/src/exceptions/option_string_not_wellformed.php',
|
||||
'ezcconsoleoptiontoomanyvaluesexception' => '/../vendor/zetacomponents/console-tools/src/exceptions/option_too_many_values.php',
|
||||
'ezcconsoleoptiontypeviolationexception' => '/../vendor/zetacomponents/console-tools/src/exceptions/option_type_violation.php',
|
||||
'ezcconsoleoutput' => '/../vendor/zetacomponents/console-tools/src/output.php',
|
||||
'ezcconsoleoutputformat' => '/../vendor/zetacomponents/console-tools/src/structs/output_format.php',
|
||||
'ezcconsoleoutputformats' => '/../vendor/zetacomponents/console-tools/src/structs/output_formats.php',
|
||||
'ezcconsoleoutputoptions' => '/../vendor/zetacomponents/console-tools/src/options/output.php',
|
||||
'ezcconsoleprogressbar' => '/../vendor/zetacomponents/console-tools/src/progressbar.php',
|
||||
'ezcconsoleprogressbaroptions' => '/../vendor/zetacomponents/console-tools/src/options/progressbar.php',
|
||||
'ezcconsoleprogressmonitor' => '/../vendor/zetacomponents/console-tools/src/progressmonitor.php',
|
||||
'ezcconsoleprogressmonitoroptions' => '/../vendor/zetacomponents/console-tools/src/options/progressmonitor.php',
|
||||
'ezcconsolequestiondialog' => '/../vendor/zetacomponents/console-tools/src/dialog/question_dialog.php',
|
||||
'ezcconsolequestiondialogcollectionvalidator' => '/../vendor/zetacomponents/console-tools/src/dialog/validators/question_dialog_collection.php',
|
||||
'ezcconsolequestiondialogmappingvalidator' => '/../vendor/zetacomponents/console-tools/src/dialog/validators/question_dialog_mapping.php',
|
||||
'ezcconsolequestiondialogoptions' => '/../vendor/zetacomponents/console-tools/src/options/question_dialog.php',
|
||||
'ezcconsolequestiondialogregexvalidator' => '/../vendor/zetacomponents/console-tools/src/dialog/validators/question_dialog_regex.php',
|
||||
'ezcconsolequestiondialogtypevalidator' => '/../vendor/zetacomponents/console-tools/src/dialog/validators/question_dialog_type.php',
|
||||
'ezcconsolequestiondialogvalidator' => '/../vendor/zetacomponents/console-tools/src/interfaces/question_dialog_validator.php',
|
||||
'ezcconsolestandardinputvalidator' => '/../vendor/zetacomponents/console-tools/src/input/validators/standard.php',
|
||||
'ezcconsolestatusbar' => '/../vendor/zetacomponents/console-tools/src/statusbar.php',
|
||||
'ezcconsolestatusbaroptions' => '/../vendor/zetacomponents/console-tools/src/options/statusbar.php',
|
||||
'ezcconsolestringtool' => '/../vendor/zetacomponents/console-tools/src/tools/string.php',
|
||||
'ezcconsoletable' => '/../vendor/zetacomponents/console-tools/src/table.php',
|
||||
'ezcconsoletablecell' => '/../vendor/zetacomponents/console-tools/src/table/cell.php',
|
||||
'ezcconsoletableoptions' => '/../vendor/zetacomponents/console-tools/src/options/table.php',
|
||||
'ezcconsoletablerow' => '/../vendor/zetacomponents/console-tools/src/table/row.php',
|
||||
'ezcconsoletoomanyargumentsexception' => '/../vendor/zetacomponents/console-tools/src/exceptions/argument_too_many.php',
|
||||
'theseer\\autoload\\application' => '/Application.php',
|
||||
'theseer\\autoload\\applicationexception' => '/Application.php',
|
||||
'theseer\\autoload\\autoloadbuilderexception' => '/AutoloadRenderer.php',
|
||||
'theseer\\autoload\\autoloadrenderer' => '/AutoloadRenderer.php',
|
||||
'theseer\\autoload\\cache' => '/Cache.php',
|
||||
'theseer\\autoload\\cacheentry' => '/CacheEntry.php',
|
||||
'theseer\\autoload\\cacheexception' => '/Cache.php',
|
||||
'theseer\\autoload\\cachewarminglistrenderer' => '/CacheWarmingListRenderer.php',
|
||||
'theseer\\autoload\\cachingparser' => '/CachingParser.php',
|
||||
'theseer\\autoload\\classdependencysorter' => '/DependencySorter.php',
|
||||
'theseer\\autoload\\classdependencysorterexception' => '/DependencySorter.php',
|
||||
'theseer\\autoload\\cli' => '/CLI.php',
|
||||
'theseer\\autoload\\clienvironmentexception' => '/CLI.php',
|
||||
'theseer\\autoload\\collector' => '/Collector.php',
|
||||
'theseer\\autoload\\collectorexception' => '/Collector.php',
|
||||
'theseer\\autoload\\collectorresult' => '/CollectorResult.php',
|
||||
'theseer\\autoload\\collectorresultexception' => '/CollectorResult.php',
|
||||
'theseer\\autoload\\composeriterator' => '/ComposerIterator.php',
|
||||
'theseer\\autoload\\composeriteratorexception' => '/ComposerIterator.php',
|
||||
'theseer\\autoload\\config' => '/Config.php',
|
||||
'theseer\\autoload\\factory' => '/Factory.php',
|
||||
'theseer\\autoload\\logger' => '/Logger.php',
|
||||
'theseer\\autoload\\parser' => '/Parser.php',
|
||||
'theseer\\autoload\\parseresult' => '/ParseResult.php',
|
||||
'theseer\\autoload\\parserexception' => '/Parser.php',
|
||||
'theseer\\autoload\\parserinterface' => '/ParserInterface.php',
|
||||
'theseer\\autoload\\pathcomparator' => '/PathComparator.php',
|
||||
'theseer\\autoload\\pharbuilder' => '/PharBuilder.php',
|
||||
'theseer\\autoload\\sourcefile' => '/SourceFile.php',
|
||||
'theseer\\autoload\\staticlistrenderer' => '/StaticListRenderer.php',
|
||||
'theseer\\autoload\\staticrenderer' => '/StaticRenderer.php',
|
||||
'theseer\\autoload\\staticrequirelistrenderer' => '/StaticRequireListRenderer.php',
|
||||
'theseer\\autoload\\version' => '/Version.php',
|
||||
'theseer\\directoryscanner\\directoryscanner' => '/../vendor/theseer/directoryscanner/src/directoryscanner.php',
|
||||
'theseer\\directoryscanner\\exception' => '/../vendor/theseer/directoryscanner/src/directoryscanner.php',
|
||||
'theseer\\directoryscanner\\filesonlyfilteriterator' => '/../vendor/theseer/directoryscanner/src/filesonlyfilter.php',
|
||||
'theseer\\directoryscanner\\includeexcludefilteriterator' => '/../vendor/theseer/directoryscanner/src/includeexcludefilter.php',
|
||||
'theseer\\directoryscanner\\phpfilteriterator' => '/../vendor/theseer/directoryscanner/src/phpfilter.php'
|
||||
);
|
||||
}
|
||||
$cn = strtolower($class);
|
||||
if (isset($classes[$cn])) {
|
||||
require __DIR__ . $classes[$cn];
|
||||
}
|
||||
},
|
||||
true,
|
||||
false
|
||||
);
|
||||
// @codeCoverageIgnoreEnd
|
273
src/ncc/ThirdParty/theseer/DirectoryScanner/DirectoryScanner.php
vendored
Normal file
273
src/ncc/ThirdParty/theseer/DirectoryScanner/DirectoryScanner.php
vendored
Normal file
|
@ -0,0 +1,273 @@
|
|||
<?php
|
||||
/**
|
||||
* Copyright (c) 2009-2014 Arne Blankerts <arne@blankerts.de>
|
||||
* 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 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 Arne Blankerts nor the names of contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT * NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER ORCONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @package DirectoryScanner
|
||||
* @author Arne Blankerts <arne@blankerts.de>
|
||||
* @copyright Arne Blankerts <arne@blankerts.de>, All rights reserved.
|
||||
* @license BSD License
|
||||
* @link http://github.com/theseer/DirectoryScanner
|
||||
*/
|
||||
|
||||
namespace ncc\ThirdParty\theseer\DirectoryScanner {
|
||||
|
||||
/**
|
||||
* Recursive scanner for files on given filesystem path with the ability to filter
|
||||
* results based on include and exclude patterns
|
||||
*
|
||||
* @author Arne Blankerts <arne@blankerts.de>
|
||||
* @copyright Arne Blankerts <arne@blankerts.de>, All rights reserved.
|
||||
* @version Release: %version%
|
||||
*/
|
||||
class DirectoryScanner {
|
||||
|
||||
/**
|
||||
* List of filter for include shell patterns
|
||||
*
|
||||
* @var Array
|
||||
*/
|
||||
protected $include = array();
|
||||
|
||||
/**
|
||||
* List of filter for exclude shell patterns
|
||||
*
|
||||
* @var Array
|
||||
*/
|
||||
protected $exclude = array();
|
||||
|
||||
/**
|
||||
* Flags to pass on to RecursiveDirectoryIterator on construction
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $flags = 0;
|
||||
|
||||
/**
|
||||
* Add a new pattern to the include array
|
||||
*
|
||||
* @param string $inc Pattern to add
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addInclude($inc) {
|
||||
$this->include[] = $inc;
|
||||
}
|
||||
|
||||
/**
|
||||
* set the include pattern array
|
||||
*
|
||||
* @param Array $inc Array of include pattern strings
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setIncludes(array $inc = array()) {
|
||||
$this->include = $inc;
|
||||
}
|
||||
|
||||
/**
|
||||
* get array of current include patterns
|
||||
*
|
||||
* @return Array
|
||||
*/
|
||||
public function getIncludes() {
|
||||
return $this->include;
|
||||
}
|
||||
|
||||
public function setFlag($flag) {
|
||||
if (!$this->isValidFlag($flag)) {
|
||||
throw new Exception("Invalid flag specified", Exception::InvalidFlag);
|
||||
}
|
||||
$this->flags = $this->flags | $flag;
|
||||
}
|
||||
|
||||
|
||||
public function unsetFlag($flag) {
|
||||
if (!$this->isValidFlag($flag)) {
|
||||
throw new Exception("Invalid flag specified", Exception::InvalidFlag);
|
||||
}
|
||||
$this->flags = $this->flags & ~$flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param boolean $followSymlinks
|
||||
*
|
||||
* @deprecated Use setFlag / unsetFlag with \FilesystemIterator::FOLLOW_SYMLINKS
|
||||
* @return void
|
||||
*/
|
||||
public function setFollowSymlinks($followSymlinks) {
|
||||
if ($followSymlinks == true) {
|
||||
$this->setFlag(\FilesystemIterator::FOLLOW_SYMLINKS);
|
||||
return;
|
||||
}
|
||||
$this->unsetFlag(\FilesystemIterator::FOLLOW_SYMLINKS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Public function, so it can be tested properly
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isFollowSymlinks() {
|
||||
return ($this->flags & \FilesystemIterator::FOLLOW_SYMLINKS) == \FilesystemIterator::FOLLOW_SYMLINKS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new pattern to the exclude array
|
||||
*
|
||||
* @param string $exc Pattern to add
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addExclude($exc) {
|
||||
$this->exclude[] = $exc;
|
||||
}
|
||||
|
||||
/**
|
||||
* set the exclude pattern array
|
||||
*
|
||||
* @param Array $exc Array of exclude pattern strings
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setExcludes(array $exc = array()) {
|
||||
$this->exclude = $exc;
|
||||
}
|
||||
|
||||
/**
|
||||
* get array of current exclude patterns
|
||||
*
|
||||
* @return Array
|
||||
*/
|
||||
public function getExcludes() {
|
||||
return $this->exclude;
|
||||
}
|
||||
|
||||
/**
|
||||
* get an array of splFileObjects from given path matching the
|
||||
* include/exclude patterns
|
||||
*
|
||||
* @param string $path Path to work on
|
||||
* @param boolean $recursive Scan recursivly or not
|
||||
*
|
||||
* @return Array of splFileInfo Objects
|
||||
*/
|
||||
public function getFiles($path, $recursive = true) {
|
||||
$res = array();
|
||||
foreach($this->getIterator($path, $recursive) as $entry) {
|
||||
$res[] = $entry;
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Magic invoker method to use object in foreach-alike constructs as iterator,
|
||||
* delegating work to getIterator() method
|
||||
*
|
||||
* @see getIterator
|
||||
*
|
||||
* @param string $path Path to work on
|
||||
* @param boolean $recursive Scan recursivly or not
|
||||
*
|
||||
* @return \Iterator
|
||||
*/
|
||||
public function __invoke($path, $recursive = true) {
|
||||
return $this->getIterator($path, $recursive);
|
||||
}
|
||||
|
||||
/**
|
||||
* Scan given directory for files, returning splFileObjects matching the include/exclude patterns
|
||||
*
|
||||
* @param string $path Path to work on
|
||||
* @param boolean $recursive Scan recursively or not
|
||||
*
|
||||
* @throws Exception
|
||||
* @return \Iterator
|
||||
*/
|
||||
public function getIterator($path, $recursive = true) {
|
||||
if (!file_exists($path)) {
|
||||
throw new Exception("Path '$path' does not exist.", Exception::NotFound);
|
||||
}
|
||||
if ($recursive) {
|
||||
$worker = new \RecursiveIteratorIterator(
|
||||
new \RecursiveDirectoryIterator(
|
||||
$path, $this->flags
|
||||
)
|
||||
);
|
||||
} else {
|
||||
$worker = new \DirectoryIterator($path);
|
||||
}
|
||||
$filter = new IncludeExcludeFilterIterator( new FilesOnlyFilterIterator($worker) );
|
||||
$filter->setInclude( count($this->include) ? $this->include : array('*'));
|
||||
$filter->setExclude($this->exclude);
|
||||
return $filter;
|
||||
}
|
||||
|
||||
protected function isValidFlag($flag) {
|
||||
return in_array($flag, array(
|
||||
\FilesystemIterator::CURRENT_AS_PATHNAME,
|
||||
\FilesystemIterator::CURRENT_AS_FILEINFO,
|
||||
\FilesystemIterator::CURRENT_AS_SELF,
|
||||
\FilesystemIterator::CURRENT_MODE_MASK,
|
||||
\FilesystemIterator::KEY_AS_PATHNAME,
|
||||
\FilesystemIterator::KEY_AS_FILENAME,
|
||||
\FilesystemIterator::FOLLOW_SYMLINKS,
|
||||
\FilesystemIterator::KEY_MODE_MASK,
|
||||
\FilesystemIterator::NEW_CURRENT_AND_KEY,
|
||||
\FilesystemIterator::SKIP_DOTS,
|
||||
\FilesystemIterator::UNIX_PATHS
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* DirectoryScanner Exception class
|
||||
*
|
||||
* @author Arne Blankerts <arne@blankerts.de>
|
||||
* @copyright Arne Blankerts <arne@blankerts.de>, All rights reserved.
|
||||
*/
|
||||
class Exception extends \Exception {
|
||||
|
||||
/**
|
||||
* Error constant for "notFound" condition
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
const NotFound = 1;
|
||||
|
||||
/**
|
||||
* Error condition for invalid flag passed to setFlag/unsetFlag method
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
const InvalidFlag = 2;
|
||||
}
|
||||
|
||||
}
|
74
src/ncc/ThirdParty/theseer/DirectoryScanner/FilesOnlyFilterIterator.php
vendored
Normal file
74
src/ncc/ThirdParty/theseer/DirectoryScanner/FilesOnlyFilterIterator.php
vendored
Normal file
|
@ -0,0 +1,74 @@
|
|||
<?php
|
||||
/**
|
||||
* Copyright (c) 2009-2014 Arne Blankerts <arne@blankerts.de>
|
||||
* 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 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 Arne Blankerts nor the names of contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT * NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER ORCONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @package DirectoryScanner
|
||||
* @author Arne Blankerts <arne@blankerts.de>
|
||||
* @copyright Arne Blankerts <arne@blankerts.de>, All rights reserved.
|
||||
* @license BSD License
|
||||
*/
|
||||
|
||||
namespace ncc\ThirdParty\theseer\DirectoryScanner {
|
||||
|
||||
use ReturnTypeWillChange;
|
||||
|
||||
/**
|
||||
* FilterIterator to accept on files from a directory iterator
|
||||
*
|
||||
* @author Arne Blankerts <arne@blankerts.de>
|
||||
* @copyright Arne Blankerts <arne@blankerts.de>, All rights reserved.
|
||||
* @version Release: %version%
|
||||
*/
|
||||
class FilesOnlyFilterIterator extends \FilterIterator {
|
||||
|
||||
/**
|
||||
* FilterIterator Method to decide whether or not to include
|
||||
* the current item into the list
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function accept() {
|
||||
switch($this->current()->getType()) {
|
||||
case 'file': {
|
||||
return true;
|
||||
}
|
||||
case 'link': {
|
||||
return is_file(realpath($this->current()->getPathname()));
|
||||
}
|
||||
default: {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
114
src/ncc/ThirdParty/theseer/DirectoryScanner/IncludeExcludeFilterIterator.php
vendored
Normal file
114
src/ncc/ThirdParty/theseer/DirectoryScanner/IncludeExcludeFilterIterator.php
vendored
Normal file
|
@ -0,0 +1,114 @@
|
|||
<?php
|
||||
/**
|
||||
* Copyright (c) 2009-2014 Arne Blankerts <arne@blankerts.de>
|
||||
* 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 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 Arne Blankerts nor the names of contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT * NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER ORCONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @package DirectoryScanner
|
||||
* @author Arne Blankerts <arne@blankerts.de>
|
||||
* @copyright Arne Blankerts <arne@blankerts.de>, All rights reserved.
|
||||
* @license BSD License
|
||||
*/
|
||||
|
||||
namespace ncc\ThirdParty\theseer\DirectoryScanner {
|
||||
|
||||
use ReturnTypeWillChange;
|
||||
|
||||
/**
|
||||
* FilterIterator to accept Items based on include/exclude conditions
|
||||
*
|
||||
* @author Arne Blankerts <arne@blankerts.de>
|
||||
* @copyright Arne Blankerts <arne@blankerts.de>, All rights reserved.
|
||||
* @version Release: %version%
|
||||
*/
|
||||
class IncludeExcludeFilterIterator extends \FilterIterator {
|
||||
|
||||
/**
|
||||
* List of filter for include shell patterns
|
||||
*
|
||||
* @var Array
|
||||
*/
|
||||
protected $include;
|
||||
|
||||
/**
|
||||
* List of filter for exclude shell patterns
|
||||
*
|
||||
* @var Array
|
||||
*/
|
||||
protected $exclude;
|
||||
|
||||
/**
|
||||
* Set and by that overwrite the include filter array
|
||||
*
|
||||
* @param Array $inc Array of include pattern strings
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setInclude(array $inc = array()) {
|
||||
$this->include = $inc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set and by that overwrite the exclude filter array
|
||||
*
|
||||
* @param Array $exc Array of exclude pattern strings
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setExclude(array $exc = array()) {
|
||||
$this->exclude = $exc;
|
||||
}
|
||||
|
||||
/**
|
||||
* FilterIterator Method to decide whether or not to include
|
||||
* the current item into the list
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function accept() {
|
||||
$pathname = $this->current()->getPathname();
|
||||
|
||||
foreach($this->exclude as $out) {
|
||||
if (fnmatch($out, $pathname)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
foreach($this->include as $in) {
|
||||
if (fnmatch($in, $pathname)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
30
src/ncc/ThirdParty/theseer/DirectoryScanner/LICENSE
vendored
Normal file
30
src/ncc/ThirdParty/theseer/DirectoryScanner/LICENSE
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
DirectoryScanner
|
||||
|
||||
Copyright (c) 2009-2014 Arne Blankerts <arne@blankerts.de>
|
||||
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 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 Arne Blankerts nor the names of contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT * NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER ORCONTRIBUTORS
|
||||
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
65
src/ncc/ThirdParty/theseer/DirectoryScanner/PHPFilterIterator.php
vendored
Normal file
65
src/ncc/ThirdParty/theseer/DirectoryScanner/PHPFilterIterator.php
vendored
Normal file
|
@ -0,0 +1,65 @@
|
|||
<?php
|
||||
/**
|
||||
* Copyright (c) 2009-2014 Arne Blankerts <arne@blankerts.de>
|
||||
* 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 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 Arne Blankerts nor the names of contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT * NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER ORCONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @package Autoload
|
||||
* @author Arne Blankerts <arne@blankerts.de>
|
||||
* @copyright Arne Blankerts <arne@blankerts.de>, All rights reserved.
|
||||
* @license BSD License
|
||||
*/
|
||||
|
||||
namespace ncc\ThirdParty\theseer\DirectoryScanner {
|
||||
|
||||
use ReturnTypeWillChange;
|
||||
|
||||
/**
|
||||
* FilterIterator to accept only php source files based on content
|
||||
*
|
||||
* @author Arne Blankerts <arne@blankerts.de>
|
||||
* @copyright Arne Blankerts <arne@blankerts.de>, All rights reserved.
|
||||
* @version Release: %version%
|
||||
*/
|
||||
class PHPFilterIterator extends \FilterIterator {
|
||||
|
||||
/**
|
||||
* FilterIterator Method to decide whether or not to include
|
||||
* the current item into the list
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function accept() {
|
||||
$finfo = new \finfo(FILEINFO_MIME);
|
||||
return strpos($finfo->file($this->current()->getPathname()), 'text/x-php') === 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
1
src/ncc/ThirdParty/theseer/DirectoryScanner/VERSION
vendored
Normal file
1
src/ncc/ThirdParty/theseer/DirectoryScanner/VERSION
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
1.3.3
|
|
@ -34,6 +34,10 @@
|
|||
{
|
||||
"vendor": "theseer",
|
||||
"package_name": "Autoload"
|
||||
},
|
||||
{
|
||||
"vendor": "theseer",
|
||||
"package_name": "DirectoryScanner"
|
||||
}
|
||||
],
|
||||
"update_source": null
|
||||
|
|
Loading…
Add table
Reference in a new issue