From b77beb5e00220d407584868636cc954d3eee9523 Mon Sep 17 00:00:00 2001 From: Netkas Date: Thu, 22 Sep 2022 17:13:41 -0400 Subject: [PATCH] Fixed namepsaces and added requirement theseer\DirectoryScanner for theseer\Autoload --- LICENSE | 69 +++++ Makefile | 9 +- src/ncc/Classes/AutoloaderGenerator.php | 26 ++ .../theseer/Autoload/Application.php | 2 +- .../theseer/Autoload/AutoloadRenderer.php | 2 +- src/ncc/ThirdParty/theseer/Autoload/CLI.php | 4 +- src/ncc/ThirdParty/theseer/Autoload/Cache.php | 3 +- .../theseer/Autoload/CacheEntry.php | 2 +- .../Autoload/CacheWarmingListRenderer.php | 6 +- .../theseer/Autoload/CachingParser.php | 5 +- .../ThirdParty/theseer/Autoload/Collector.php | 4 +- .../theseer/Autoload/CollectorResult.php | 2 +- .../theseer/Autoload/ComposerIterator.php | 23 +- .../ThirdParty/theseer/Autoload/Config.php | 2 +- .../theseer/Autoload/DependencySorter.php | 2 +- .../ThirdParty/theseer/Autoload/Factory.php | 10 +- src/ncc/ThirdParty/theseer/Autoload/LICENSE | 31 ++ .../ThirdParty/theseer/Autoload/Logger.php | 2 +- .../theseer/Autoload/ParseResult.php | 2 +- .../ThirdParty/theseer/Autoload/Parser.php | 2 +- .../theseer/Autoload/ParserInterface.php | 2 +- .../theseer/Autoload/PathComparator.php | 2 +- .../theseer/Autoload/PharBuilder.php | 4 +- .../theseer/Autoload/SourceFile.php | 6 +- .../theseer/Autoload/StaticListRenderer.php | 2 +- .../theseer/Autoload/StaticRenderer.php | 2 +- .../Autoload/StaticRequireListRenderer.php | 2 +- .../ThirdParty/theseer/Autoload/Version.php | 2 +- .../ThirdParty/theseer/Autoload/autoload.php | 153 ---------- .../DirectoryScanner/DirectoryScanner.php | 273 ++++++++++++++++++ .../FilesOnlyFilterIterator.php | 74 +++++ .../IncludeExcludeFilterIterator.php | 114 ++++++++ .../theseer/DirectoryScanner/LICENSE | 30 ++ .../DirectoryScanner/PHPFilterIterator.php | 65 +++++ .../theseer/DirectoryScanner/VERSION | 1 + src/ncc/version.json | 4 + 36 files changed, 749 insertions(+), 195 deletions(-) create mode 100644 src/ncc/Classes/AutoloaderGenerator.php create mode 100644 src/ncc/ThirdParty/theseer/Autoload/LICENSE delete mode 100644 src/ncc/ThirdParty/theseer/Autoload/autoload.php create mode 100644 src/ncc/ThirdParty/theseer/DirectoryScanner/DirectoryScanner.php create mode 100644 src/ncc/ThirdParty/theseer/DirectoryScanner/FilesOnlyFilterIterator.php create mode 100644 src/ncc/ThirdParty/theseer/DirectoryScanner/IncludeExcludeFilterIterator.php create mode 100644 src/ncc/ThirdParty/theseer/DirectoryScanner/LICENSE create mode 100644 src/ncc/ThirdParty/theseer/DirectoryScanner/PHPFilterIterator.php create mode 100644 src/ncc/ThirdParty/theseer/DirectoryScanner/VERSION diff --git a/LICENSE b/LICENSE index c5d25b7..3490a1e 100644 --- a/LICENSE +++ b/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 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 +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. diff --git a/Makefile b/Makefile index 4d0b112..06411fa 100644 --- a/Makefile +++ b/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 diff --git a/src/ncc/Classes/AutoloaderGenerator.php b/src/ncc/Classes/AutoloaderGenerator.php new file mode 100644 index 0000000..feefbe6 --- /dev/null +++ b/src/ncc/Classes/AutoloaderGenerator.php @@ -0,0 +1,26 @@ +project = $project; + } + + public function generateAutoload(string $src, string $output, bool $static=false) + { + + } + } \ No newline at end of file diff --git a/src/ncc/ThirdParty/theseer/Autoload/Application.php b/src/ncc/ThirdParty/theseer/Autoload/Application.php index 9a2ab99..3c1d863 100644 --- a/src/ncc/ThirdParty/theseer/Autoload/Application.php +++ b/src/ncc/ThirdParty/theseer/Autoload/Application.php @@ -35,7 +35,7 @@ * @license BSD License * */ -namespace TheSeer\Autoload { +namespace ncc\ThirdParty\theseer\Autoload { class Application { diff --git a/src/ncc/ThirdParty/theseer/Autoload/AutoloadRenderer.php b/src/ncc/ThirdParty/theseer/Autoload/AutoloadRenderer.php index 57c9e6c..b0f4487 100644 --- a/src/ncc/ThirdParty/theseer/Autoload/AutoloadRenderer.php +++ b/src/ncc/ThirdParty/theseer/Autoload/AutoloadRenderer.php @@ -35,7 +35,7 @@ * @license BSD License */ -namespace TheSeer\Autoload { +namespace ncc\ThirdParty\theseer\Autoload { /** * Builds spl based autoload code for inclusion into projects diff --git a/src/ncc/ThirdParty/theseer/Autoload/CLI.php b/src/ncc/ThirdParty/theseer/Autoload/CLI.php index 454bc30..b3ee9e2 100644 --- a/src/ncc/ThirdParty/theseer/Autoload/CLI.php +++ b/src/ncc/ThirdParty/theseer/Autoload/CLI.php @@ -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()); diff --git a/src/ncc/ThirdParty/theseer/Autoload/Cache.php b/src/ncc/ThirdParty/theseer/Autoload/Cache.php index 74417b0..e068f9f 100644 --- a/src/ncc/ThirdParty/theseer/Autoload/Cache.php +++ b/src/ncc/ThirdParty/theseer/Autoload/Cache.php @@ -1,5 +1,6 @@ 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; } diff --git a/src/ncc/ThirdParty/theseer/Autoload/Config.php b/src/ncc/ThirdParty/theseer/Autoload/Config.php index ff2735a..ecf6c9a 100644 --- a/src/ncc/ThirdParty/theseer/Autoload/Config.php +++ b/src/ncc/ThirdParty/theseer/Autoload/Config.php @@ -35,7 +35,7 @@ * @license BSD License * */ -namespace TheSeer\Autoload { +namespace ncc\ThirdParty\theseer\Autoload { class Config { diff --git a/src/ncc/ThirdParty/theseer/Autoload/DependencySorter.php b/src/ncc/ThirdParty/theseer/Autoload/DependencySorter.php index a4e49b1..d850c4b 100644 --- a/src/ncc/ThirdParty/theseer/Autoload/DependencySorter.php +++ b/src/ncc/ThirdParty/theseer/Autoload/DependencySorter.php @@ -35,7 +35,7 @@ * @license BSD License */ -namespace TheSeer\Autoload { +namespace ncc\ThirdParty\theseer\Autoload { /** * Sorting classes by depdendency for static requires diff --git a/src/ncc/ThirdParty/theseer/Autoload/Factory.php b/src/ncc/ThirdParty/theseer/Autoload/Factory.php index 2552082..c097f35 100644 --- a/src/ncc/ThirdParty/theseer/Autoload/Factory.php +++ b/src/ncc/ThirdParty/theseer/Autoload/Factory.php @@ -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(); diff --git a/src/ncc/ThirdParty/theseer/Autoload/LICENSE b/src/ncc/ThirdParty/theseer/Autoload/LICENSE new file mode 100644 index 0000000..161e2dc --- /dev/null +++ b/src/ncc/ThirdParty/theseer/Autoload/LICENSE @@ -0,0 +1,31 @@ +Autoload Builder + +Copyright (c) 2010-2016 Arne Blankerts 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. + diff --git a/src/ncc/ThirdParty/theseer/Autoload/Logger.php b/src/ncc/ThirdParty/theseer/Autoload/Logger.php index 9a3637d..49f8255 100644 --- a/src/ncc/ThirdParty/theseer/Autoload/Logger.php +++ b/src/ncc/ThirdParty/theseer/Autoload/Logger.php @@ -35,7 +35,7 @@ * @license BSD License * */ -namespace TheSeer\Autoload { +namespace ncc\ThirdParty\theseer\Autoload { class Logger { diff --git a/src/ncc/ThirdParty/theseer/Autoload/ParseResult.php b/src/ncc/ThirdParty/theseer/Autoload/ParseResult.php index 70e030b..25f7c51 100644 --- a/src/ncc/ThirdParty/theseer/Autoload/ParseResult.php +++ b/src/ncc/ThirdParty/theseer/Autoload/ParseResult.php @@ -1,5 +1,5 @@ getRealPath())); diff --git a/src/ncc/ThirdParty/theseer/Autoload/StaticListRenderer.php b/src/ncc/ThirdParty/theseer/Autoload/StaticListRenderer.php index a026882..ecc7982 100644 --- a/src/ncc/ThirdParty/theseer/Autoload/StaticListRenderer.php +++ b/src/ncc/ThirdParty/theseer/Autoload/StaticListRenderer.php @@ -1,5 +1,5 @@ '/../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 diff --git a/src/ncc/ThirdParty/theseer/DirectoryScanner/DirectoryScanner.php b/src/ncc/ThirdParty/theseer/DirectoryScanner/DirectoryScanner.php new file mode 100644 index 0000000..2d496b2 --- /dev/null +++ b/src/ncc/ThirdParty/theseer/DirectoryScanner/DirectoryScanner.php @@ -0,0 +1,273 @@ + + * 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 + * @copyright Arne Blankerts , 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 + * @copyright Arne Blankerts , 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 + * @copyright Arne Blankerts , 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; + } + +} diff --git a/src/ncc/ThirdParty/theseer/DirectoryScanner/FilesOnlyFilterIterator.php b/src/ncc/ThirdParty/theseer/DirectoryScanner/FilesOnlyFilterIterator.php new file mode 100644 index 0000000..279c44f --- /dev/null +++ b/src/ncc/ThirdParty/theseer/DirectoryScanner/FilesOnlyFilterIterator.php @@ -0,0 +1,74 @@ + + * 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 + * @copyright Arne Blankerts , 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 + * @copyright Arne Blankerts , 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; + } + } + } + + } + +} diff --git a/src/ncc/ThirdParty/theseer/DirectoryScanner/IncludeExcludeFilterIterator.php b/src/ncc/ThirdParty/theseer/DirectoryScanner/IncludeExcludeFilterIterator.php new file mode 100644 index 0000000..0b870fe --- /dev/null +++ b/src/ncc/ThirdParty/theseer/DirectoryScanner/IncludeExcludeFilterIterator.php @@ -0,0 +1,114 @@ + + * 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 + * @copyright Arne Blankerts , 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 + * @copyright Arne Blankerts , 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; + } + + } + +} diff --git a/src/ncc/ThirdParty/theseer/DirectoryScanner/LICENSE b/src/ncc/ThirdParty/theseer/DirectoryScanner/LICENSE new file mode 100644 index 0000000..86e16ae --- /dev/null +++ b/src/ncc/ThirdParty/theseer/DirectoryScanner/LICENSE @@ -0,0 +1,30 @@ +DirectoryScanner + +Copyright (c) 2009-2014 Arne Blankerts +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. diff --git a/src/ncc/ThirdParty/theseer/DirectoryScanner/PHPFilterIterator.php b/src/ncc/ThirdParty/theseer/DirectoryScanner/PHPFilterIterator.php new file mode 100644 index 0000000..64f52fe --- /dev/null +++ b/src/ncc/ThirdParty/theseer/DirectoryScanner/PHPFilterIterator.php @@ -0,0 +1,65 @@ + + * 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 + * @copyright Arne Blankerts , 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 + * @copyright Arne Blankerts , 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; + } + + } + +} diff --git a/src/ncc/ThirdParty/theseer/DirectoryScanner/VERSION b/src/ncc/ThirdParty/theseer/DirectoryScanner/VERSION new file mode 100644 index 0000000..785cda8 --- /dev/null +++ b/src/ncc/ThirdParty/theseer/DirectoryScanner/VERSION @@ -0,0 +1 @@ +1.3.3 \ No newline at end of file diff --git a/src/ncc/version.json b/src/ncc/version.json index 1bf64b5..ca27424 100644 --- a/src/ncc/version.json +++ b/src/ncc/version.json @@ -34,6 +34,10 @@ { "vendor": "theseer", "package_name": "Autoload" + }, + { + "vendor": "theseer", + "package_name": "DirectoryScanner" } ], "update_source": null