PK ]~JL composer.locknu W+A { "_readme": [ "This file locks the dependencies of your project to a known state", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], "hash": "e3c2dd0d4b4daf3d2c9e0bedd344592a", "content-hash": "59c3102c5db7e3c4d78a920d4712790d", "packages": [], "packages-dev": [ { "name": "doctrine/instantiator", "version": "1.0.5", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", "shasum": "" }, "require": { "php": ">=5.3,<8.0-DEV" }, "require-dev": { "athletic/athletic": "~0.1.8", "ext-pdo": "*", "ext-phar": "*", "phpunit/phpunit": "~4.0", "squizlabs/php_codesniffer": "~2.0" }, "type": "library", "extra": { "branch-alias": { "dev-master": "1.0.x-dev" } }, "autoload": { "psr-4": { "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ { "name": "Marco Pivetta", "email": "ocramius@gmail.com", "homepage": "http://ocramius.github.com/" } ], "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", "homepage": "https://github.com/doctrine/instantiator", "keywords": [ "constructor", "instantiate" ], "time": "2015-06-14 21:17:01" }, { "name": "phpdocumentor/reflection-docblock", "version": "2.0.4", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/d68dbdc53dc358a816f00b300704702b2eaff7b8", "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8", "shasum": "" }, "require": { "php": ">=5.3.3" }, "require-dev": { "phpunit/phpunit": "~4.0" }, "suggest": { "dflydev/markdown": "~1.0", "erusev/parsedown": "~1.0" }, "type": "library", "extra": { "branch-alias": { "dev-master": "2.0.x-dev" } }, "autoload": { "psr-0": { "phpDocumentor": [ "src/" ] } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ { "name": "Mike van Riel", "email": "mike.vanriel@naenius.com" } ], "time": "2015-02-03 12:10:50" }, { "name": "phpspec/prophecy", "version": "v1.5.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", "reference": "4745ded9307786b730d7a60df5cb5a6c43cf95f7" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/phpspec/prophecy/zipball/4745ded9307786b730d7a60df5cb5a6c43cf95f7", "reference": "4745ded9307786b730d7a60df5cb5a6c43cf95f7", "shasum": "" }, "require": { "doctrine/instantiator": "^1.0.2", "phpdocumentor/reflection-docblock": "~2.0", "sebastian/comparator": "~1.1" }, "require-dev": { "phpspec/phpspec": "~2.0" }, "type": "library", "extra": { "branch-alias": { "dev-master": "1.4.x-dev" } }, "autoload": { "psr-0": { "Prophecy\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ { "name": "Konstantin Kudryashov", "email": "ever.zet@gmail.com", "homepage": "http://everzet.com" }, { "name": "Marcello Duarte", "email": "marcello.duarte@gmail.com" } ], "description": "Highly opinionated mocking framework for PHP 5.3+", "homepage": "https://github.com/phpspec/prophecy", "keywords": [ "Double", "Dummy", "fake", "mock", "spy", "stub" ], "time": "2015-08-13 10:07:40" }, { "name": "phpunit/php-code-coverage", "version": "2.2.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", "reference": "ef1ca6835468857944d5c3b48fa503d5554cff2f" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ef1ca6835468857944d5c3b48fa503d5554cff2f", "reference": "ef1ca6835468857944d5c3b48fa503d5554cff2f", "shasum": "" }, "require": { "php": ">=5.3.3", "phpunit/php-file-iterator": "~1.3", "phpunit/php-text-template": "~1.2", "phpunit/php-token-stream": "~1.3", "sebastian/environment": "^1.3.2", "sebastian/version": "~1.0" }, "require-dev": { "ext-xdebug": ">=2.1.4", "phpunit/phpunit": "~4" }, "suggest": { "ext-dom": "*", "ext-xdebug": ">=2.2.1", "ext-xmlwriter": "*" }, "type": "library", "extra": { "branch-alias": { "dev-master": "2.2.x-dev" } }, "autoload": { "classmap": [ "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Sebastian Bergmann", "email": "sb@sebastian-bergmann.de", "role": "lead" } ], "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", "homepage": "https://github.com/sebastianbergmann/php-code-coverage", "keywords": [ "coverage", "testing", "xunit" ], "time": "2015-09-14 06:51:16" }, { "name": "phpunit/php-file-iterator", "version": "1.4.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/6150bf2c35d3fc379e50c7602b75caceaa39dbf0", "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0", "shasum": "" }, "require": { "php": ">=5.3.3" }, "type": "library", "extra": { "branch-alias": { "dev-master": "1.4.x-dev" } }, "autoload": { "classmap": [ "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Sebastian Bergmann", "email": "sb@sebastian-bergmann.de", "role": "lead" } ], "description": "FilterIterator implementation that filters files based on a list of suffixes.", "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", "keywords": [ "filesystem", "iterator" ], "time": "2015-06-21 13:08:43" }, { "name": "phpunit/php-text-template", "version": "1.2.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-text-template.git", "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", "shasum": "" }, "require": { "php": ">=5.3.3" }, "type": "library", "autoload": { "classmap": [ "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de", "role": "lead" } ], "description": "Simple template engine.", "homepage": "https://github.com/sebastianbergmann/php-text-template/", "keywords": [ "template" ], "time": "2015-06-21 13:50:34" }, { "name": "phpunit/php-timer", "version": "1.0.7", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3e82f4e9fc92665fafd9157568e4dcb01d014e5b", "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b", "shasum": "" }, "require": { "php": ">=5.3.3" }, "type": "library", "autoload": { "classmap": [ "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Sebastian Bergmann", "email": "sb@sebastian-bergmann.de", "role": "lead" } ], "description": "Utility class for timing", "homepage": "https://github.com/sebastianbergmann/php-timer/", "keywords": [ "timer" ], "time": "2015-06-21 08:01:12" }, { "name": "phpunit/php-token-stream", "version": "1.4.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da", "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da", "shasum": "" }, "require": { "ext-tokenizer": "*", "php": ">=5.3.3" }, "require-dev": { "phpunit/phpunit": "~4.2" }, "type": "library", "extra": { "branch-alias": { "dev-master": "1.4-dev" } }, "autoload": { "classmap": [ "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" } ], "description": "Wrapper around PHP's tokenizer extension.", "homepage": "https://github.com/sebastianbergmann/php-token-stream/", "keywords": [ "tokenizer" ], "time": "2015-09-15 10:49:45" }, { "name": "phpunit/phpunit", "version": "4.8.10", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", "reference": "463163747474815c5ccd4ae12b5b355ec12158e8" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/463163747474815c5ccd4ae12b5b355ec12158e8", "reference": "463163747474815c5ccd4ae12b5b355ec12158e8", "shasum": "" }, "require": { "ext-dom": "*", "ext-json": "*", "ext-pcre": "*", "ext-reflection": "*", "ext-spl": "*", "php": ">=5.3.3", "phpspec/prophecy": "^1.3.1", "phpunit/php-code-coverage": "~2.1", "phpunit/php-file-iterator": "~1.4", "phpunit/php-text-template": "~1.2", "phpunit/php-timer": ">=1.0.6", "phpunit/phpunit-mock-objects": "~2.3", "sebastian/comparator": "~1.1", "sebastian/diff": "~1.2", "sebastian/environment": "~1.3", "sebastian/exporter": "~1.2", "sebastian/global-state": "~1.0", "sebastian/version": "~1.0", "symfony/yaml": "~2.1|~3.0" }, "suggest": { "phpunit/php-invoker": "~1.1" }, "bin": [ "phpunit" ], "type": "library", "extra": { "branch-alias": { "dev-master": "4.8.x-dev" } }, "autoload": { "classmap": [ "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de", "role": "lead" } ], "description": "The PHP Unit Testing framework.", "homepage": "https://phpunit.de/", "keywords": [ "phpunit", "testing", "xunit" ], "time": "2015-10-01 09:14:30" }, { "name": "phpunit/phpunit-mock-objects", "version": "2.3.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/ac8e7a3db35738d56ee9a76e78a4e03d97628983", "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983", "shasum": "" }, "require": { "doctrine/instantiator": "^1.0.2", "php": ">=5.3.3", "phpunit/php-text-template": "~1.2", "sebastian/exporter": "~1.2" }, "require-dev": { "phpunit/phpunit": "~4.4" }, "suggest": { "ext-soap": "*" }, "type": "library", "extra": { "branch-alias": { "dev-master": "2.3.x-dev" } }, "autoload": { "classmap": [ "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Sebastian Bergmann", "email": "sb@sebastian-bergmann.de", "role": "lead" } ], "description": "Mock Object library for PHPUnit", "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", "keywords": [ "mock", "xunit" ], "time": "2015-10-02 06:51:40" }, { "name": "sebastian/comparator", "version": "1.2.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", "reference": "937efb279bd37a375bcadf584dec0726f84dbf22" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/937efb279bd37a375bcadf584dec0726f84dbf22", "reference": "937efb279bd37a375bcadf584dec0726f84dbf22", "shasum": "" }, "require": { "php": ">=5.3.3", "sebastian/diff": "~1.2", "sebastian/exporter": "~1.2" }, "require-dev": { "phpunit/phpunit": "~4.4" }, "type": "library", "extra": { "branch-alias": { "dev-master": "1.2.x-dev" } }, "autoload": { "classmap": [ "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Jeff Welch", "email": "whatthejeff@gmail.com" }, { "name": "Volker Dusch", "email": "github@wallbash.com" }, { "name": "Bernhard Schussek", "email": "bschussek@2bepublished.at" }, { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" } ], "description": "Provides the functionality to compare PHP values for equality", "homepage": "http://www.github.com/sebastianbergmann/comparator", "keywords": [ "comparator", "compare", "equality" ], "time": "2015-07-26 15:48:44" }, { "name": "sebastian/diff", "version": "1.3.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", "reference": "863df9687835c62aa423a22412d26fa2ebde3fd3" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/863df9687835c62aa423a22412d26fa2ebde3fd3", "reference": "863df9687835c62aa423a22412d26fa2ebde3fd3", "shasum": "" }, "require": { "php": ">=5.3.3" }, "require-dev": { "phpunit/phpunit": "~4.2" }, "type": "library", "extra": { "branch-alias": { "dev-master": "1.3-dev" } }, "autoload": { "classmap": [ "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Kore Nordmann", "email": "mail@kore-nordmann.de" }, { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" } ], "description": "Diff implementation", "homepage": "http://www.github.com/sebastianbergmann/diff", "keywords": [ "diff" ], "time": "2015-02-22 15:13:53" }, { "name": "sebastian/environment", "version": "1.3.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", "reference": "6324c907ce7a52478eeeaede764f48733ef5ae44" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/6324c907ce7a52478eeeaede764f48733ef5ae44", "reference": "6324c907ce7a52478eeeaede764f48733ef5ae44", "shasum": "" }, "require": { "php": ">=5.3.3" }, "require-dev": { "phpunit/phpunit": "~4.4" }, "type": "library", "extra": { "branch-alias": { "dev-master": "1.3.x-dev" } }, "autoload": { "classmap": [ "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" } ], "description": "Provides functionality to handle HHVM/PHP environments", "homepage": "http://www.github.com/sebastianbergmann/environment", "keywords": [ "Xdebug", "environment", "hhvm" ], "time": "2015-08-03 06:14:51" }, { "name": "sebastian/exporter", "version": "1.2.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", "reference": "7ae5513327cb536431847bcc0c10edba2701064e" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/7ae5513327cb536431847bcc0c10edba2701064e", "reference": "7ae5513327cb536431847bcc0c10edba2701064e", "shasum": "" }, "require": { "php": ">=5.3.3", "sebastian/recursion-context": "~1.0" }, "require-dev": { "phpunit/phpunit": "~4.4" }, "type": "library", "extra": { "branch-alias": { "dev-master": "1.2.x-dev" } }, "autoload": { "classmap": [ "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Jeff Welch", "email": "whatthejeff@gmail.com" }, { "name": "Volker Dusch", "email": "github@wallbash.com" }, { "name": "Bernhard Schussek", "email": "bschussek@2bepublished.at" }, { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" }, { "name": "Adam Harvey", "email": "aharvey@php.net" } ], "description": "Provides the functionality to export PHP variables for visualization", "homepage": "http://www.github.com/sebastianbergmann/exporter", "keywords": [ "export", "exporter" ], "time": "2015-06-21 07:55:53" }, { "name": "sebastian/global-state", "version": "1.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", "reference": "c7428acdb62ece0a45e6306f1ae85e1c05b09c01" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/c7428acdb62ece0a45e6306f1ae85e1c05b09c01", "reference": "c7428acdb62ece0a45e6306f1ae85e1c05b09c01", "shasum": "" }, "require": { "php": ">=5.3.3" }, "require-dev": { "phpunit/phpunit": "~4.2" }, "suggest": { "ext-uopz": "*" }, "type": "library", "extra": { "branch-alias": { "dev-master": "1.0-dev" } }, "autoload": { "classmap": [ "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" } ], "description": "Snapshotting of global state", "homepage": "http://www.github.com/sebastianbergmann/global-state", "keywords": [ "global state" ], "time": "2014-10-06 09:23:50" }, { "name": "sebastian/recursion-context", "version": "1.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", "reference": "994d4a811bafe801fb06dccbee797863ba2792ba" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/994d4a811bafe801fb06dccbee797863ba2792ba", "reference": "994d4a811bafe801fb06dccbee797863ba2792ba", "shasum": "" }, "require": { "php": ">=5.3.3" }, "require-dev": { "phpunit/phpunit": "~4.4" }, "type": "library", "extra": { "branch-alias": { "dev-master": "1.0.x-dev" } }, "autoload": { "classmap": [ "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Jeff Welch", "email": "whatthejeff@gmail.com" }, { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" }, { "name": "Adam Harvey", "email": "aharvey@php.net" } ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", "time": "2015-06-21 08:04:50" }, { "name": "sebastian/version", "version": "1.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/version.git", "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", "shasum": "" }, "type": "library", "autoload": { "classmap": [ "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de", "role": "lead" } ], "description": "Library that helps with managing the version number of Git-hosted PHP projects", "homepage": "https://github.com/sebastianbergmann/version", "time": "2015-06-21 13:59:46" }, { "name": "symfony/yaml", "version": "v2.7.5", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", "reference": "31cb2ad0155c95b88ee55fe12bc7ff92232c1770" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/symfony/yaml/zipball/31cb2ad0155c95b88ee55fe12bc7ff92232c1770", "reference": "31cb2ad0155c95b88ee55fe12bc7ff92232c1770", "shasum": "" }, "require": { "php": ">=5.3.9" }, "require-dev": { "symfony/phpunit-bridge": "~2.7" }, "type": "library", "extra": { "branch-alias": { "dev-master": "2.7-dev" } }, "autoload": { "psr-4": { "Symfony\\Component\\Yaml\\": "" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ { "name": "Fabien Potencier", "email": "fabien@symfony.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", "time": "2015-09-14 14:14:09" } ], "aliases": [], "minimum-stability": "stable", "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, "platform": { "php": ">=5.3.0" }, "platform-dev": [] } PK ]~J^n n README.mdnu W+A You can find documentation in the [wiki](https://github.com/mikey179/vfsStream/wiki). Also you might want to check [vfsStream examples](https://github.com/mikey179/vfsStream-examples). [![Build Status](https://secure.travis-ci.org/mikey179/vfsStream.png)](http://travis-ci.org/mikey179/vfsStream) [![Build Status Windows](https://ci.appveyor.com/api/projects/status/6whqgluyeggspjp1/branch/master?svg=true)](https://ci.appveyor.com/project/mikey179/vfsstream) [![Coverage Status](https://coveralls.io/repos/mikey179/vfsStream/badge.png?branch=master)](https://coveralls.io/r/mikey179/vfsStream?branch=master) [![Latest Stable Version](https://poser.pugx.org/mikey179/vfsStream/version.png)](https://packagist.org/packages/mikey179/vfsStream) [![Latest Unstable Version](https://poser.pugx.org/mikey179/vfsStream/v/unstable.png)](//packagist.org/packages/mikey179/vfsStream) PK ]~JoUZ Z 2 src/main/php/org/bovigo/vfs/vfsStreamDirectory.phpnu W+A type = vfsStreamContent::TYPE_DIR; parent::__construct($name, $permissions); } /** * returns default permissions for concrete implementation * * @return int * @since 0.8.0 */ protected function getDefaultPermissions() { return 0777; } /** * returns size of directory * * The size of a directory is always 0 bytes. To calculate the summarized * size of all children in the directory use sizeSummarized(). * * @return int */ public function size() { return 0; } /** * returns summarized size of directory and its children * * @return int */ public function sizeSummarized() { $size = 0; foreach ($this->children as $child) { if ($child->getType() === vfsStreamContent::TYPE_DIR) { $size += $child->sizeSummarized(); } else { $size += $child->size(); } } return $size; } /** * renames the content * * @param string $newName * @throws vfsStreamException */ public function rename($newName) { if (strstr($newName, '/') !== false) { throw new vfsStreamException('Directory name can not contain /.'); } parent::rename($newName); } /** * sets parent path * * @param string $parentPath * @internal only to be set by parent * @since 1.2.0 */ public function setParentPath($parentPath) { parent::setParentPath($parentPath); foreach ($this->children as $child) { $child->setParentPath($this->path()); } } /** * adds child to the directory * * @param vfsStreamContent $child */ public function addChild(vfsStreamContent $child) { $child->setParentPath($this->path()); $this->children[$child->getName()] = $child; $this->updateModifications(); } /** * removes child from the directory * * @param string $name * @return bool */ public function removeChild($name) { foreach ($this->children as $key => $child) { if ($child->appliesTo($name)) { $child->setParentPath(null); unset($this->children[$key]); $this->updateModifications(); return true; } } return false; } /** * updates internal timestamps */ protected function updateModifications() { $time = time(); $this->lastAttributeModified = $time; $this->lastModified = $time; } /** * checks whether the container contains a child with the given name * * @param string $name * @return bool */ public function hasChild($name) { return ($this->getChild($name) !== null); } /** * returns the child with the given name * * @param string $name * @return vfsStreamContent */ public function getChild($name) { $childName = $this->getRealChildName($name); foreach ($this->children as $child) { if ($child->getName() === $childName) { return $child; } if ($child->appliesTo($childName) === true && $child->hasChild($childName) === true) { return $child->getChild($childName); } } return null; } /** * helper method to detect the real child name * * @param string $name * @return string */ protected function getRealChildName($name) { if ($this->appliesTo($name) === true) { return self::getChildName($name, $this->name); } return $name; } /** * helper method to calculate the child name * * @param string $name * @param string $ownName * @return string */ protected static function getChildName($name, $ownName) { if ($name === $ownName) { return $name; } return substr($name, strlen($ownName) + 1); } /** * checks whether directory contains any children * * @return bool * @since 0.10.0 */ public function hasChildren() { return (count($this->children) > 0); } /** * returns a list of children for this directory * * @return vfsStreamContent[] */ public function getChildren() { return array_values($this->children); } /** * returns iterator for the children * * @return vfsStreamContainerIterator */ public function getIterator() { return new vfsStreamContainerIterator($this->children); } /** * checks whether dir is a dot dir * * @return bool */ public function isDot() { if ('.' === $this->name || '..' === $this->name) { return true; } return false; } } PK ]~Ji = = ) src/main/php/org/bovigo/vfs/vfsStream.phpnu W+A * array('Core' = array('AbstractFactory' => array('test.php' => 'some text content', * 'other.php' => 'Some more text content', * 'Invalid.csv' => 'Something else', * ), * 'AnEmptyFolder' => array(), * 'badlocation.php' => 'some bad content', * ) * ) * * the resulting directory tree will look like this: *
* root * \- Core * |- badlocation.php * |- AbstractFactory * | |- test.php * | |- other.php * | \- Invalid.csv * \- AnEmptyFolder ** Arrays will become directories with their key as directory name, and * strings becomes files with their key as file name and their value as file * content. * * @param string $rootDirName name of root directory * @param int $permissions file permissions of root directory * @param array $structure directory structure to add under root directory * @return \org\bovigo\vfs\vfsStreamDirectory * @since 0.7.0 * @see https://github.com/mikey179/vfsStream/issues/14 * @see https://github.com/mikey179/vfsStream/issues/20 */ public static function setup($rootDirName = 'root', $permissions = null, array $structure = array()) { vfsStreamWrapper::register(); return self::create($structure, vfsStreamWrapper::setRoot(self::newDirectory($rootDirName, $permissions))); } /** * creates vfsStream directory structure from an array and adds it to given base dir * * Assumed $structure contains an array like this: *
* array('Core' = array('AbstractFactory' => array('test.php' => 'some text content',
* 'other.php' => 'Some more text content',
* 'Invalid.csv' => 'Something else',
* ),
* 'AnEmptyFolder' => array(),
* 'badlocation.php' => 'some bad content',
* )
* )
*
* the resulting directory tree will look like this:
* * baseDir * \- Core * |- badlocation.php * |- AbstractFactory * | |- test.php * | |- other.php * | \- Invalid.csv * \- AnEmptyFolder ** Arrays will become directories with their key as directory name, and * strings becomes files with their key as file name and their value as file * content. * * If no baseDir is given it will try to add the structure to the existing * root directory without replacing existing childs except those with equal * names. * * @param array $structure directory structure to add under root directory * @param vfsStreamDirectory $baseDir base directory to add structure to * @return vfsStreamDirectory * @throws \InvalidArgumentException * @since 0.10.0 * @see https://github.com/mikey179/vfsStream/issues/14 * @see https://github.com/mikey179/vfsStream/issues/20 */ public static function create(array $structure, vfsStreamDirectory $baseDir = null) { if (null === $baseDir) { $baseDir = vfsStreamWrapper::getRoot(); } if (null === $baseDir) { throw new \InvalidArgumentException('No baseDir given and no root directory set.'); } return self::addStructure($structure, $baseDir); } /** * helper method to create subdirectories recursively * * @param array $structure subdirectory structure to add * @param vfsStreamDirectory $baseDir directory to add the structure to * @return vfsStreamDirectory */ protected static function addStructure(array $structure, vfsStreamDirectory $baseDir) { foreach ($structure as $name => $data) { $name = (string) $name; if (is_array($data) === true) { self::addStructure($data, self::newDirectory($name)->at($baseDir)); } elseif (is_string($data) === true) { $matches = null; preg_match('/^\[(.*)\]$/', $name, $matches); if ($matches !== array()) { self::newBlock($matches[1])->withContent($data)->at($baseDir); } else { self::newFile($name)->withContent($data)->at($baseDir); } } elseif ($data instanceof FileContent) { self::newFile($name)->withContent($data)->at($baseDir); } elseif ($data instanceof vfsStreamFile) { $baseDir->addChild($data); } } return $baseDir; } /** * copies the file system structure from given path into the base dir * * If no baseDir is given it will try to add the structure to the existing * root directory without replacing existing childs except those with equal * names. * File permissions are copied as well. * Please note that file contents will only be copied if their file size * does not exceed the given $maxFileSize which defaults to 1024 KB. In case * the file is larger file content will be mocked, see * https://github.com/mikey179/vfsStream/wiki/MockingLargeFiles. * * @param string $path path to copy the structure from * @param vfsStreamDirectory $baseDir directory to add the structure to * @param int $maxFileSize maximum file size of files to copy content from * @return vfsStreamDirectory * @throws \InvalidArgumentException * @since 0.11.0 * @see https://github.com/mikey179/vfsStream/issues/4 */ public static function copyFromFileSystem($path, vfsStreamDirectory $baseDir = null, $maxFileSize = 1048576) { if (null === $baseDir) { $baseDir = vfsStreamWrapper::getRoot(); } if (null === $baseDir) { throw new \InvalidArgumentException('No baseDir given and no root directory set.'); } $dir = new \DirectoryIterator($path); foreach ($dir as $fileinfo) { switch (filetype($fileinfo->getPathname())) { case 'file': if ($fileinfo->getSize() <= $maxFileSize) { $content = file_get_contents($fileinfo->getPathname()); } else { $content = new LargeFileContent($fileinfo->getSize()); } self::newFile( $fileinfo->getFilename(), octdec(substr(sprintf('%o', $fileinfo->getPerms()), -4)) ) ->withContent($content) ->at($baseDir); break; case 'dir': if (!$fileinfo->isDot()) { self::copyFromFileSystem( $fileinfo->getPathname(), self::newDirectory( $fileinfo->getFilename(), octdec(substr(sprintf('%o', $fileinfo->getPerms()), -4)) )->at($baseDir), $maxFileSize ); } break; case 'block': self::newBlock( $fileinfo->getFilename(), octdec(substr(sprintf('%o', $fileinfo->getPerms()), -4)) )->at($baseDir); break; } } return $baseDir; } /** * returns a new file with given name * * @param string $name name of file to create * @param int $permissions permissions of file to create * @return vfsStreamFile */ public static function newFile($name, $permissions = null) { return new vfsStreamFile($name, $permissions); } /** * returns a new directory with given name * * If the name contains slashes, a new directory structure will be created. * The returned directory will always be the parent directory of this * directory structure. * * @param string $name name of directory to create * @param int $permissions permissions of directory to create * @return vfsStreamDirectory */ public static function newDirectory($name, $permissions = null) { if ('/' === $name{0}) { $name = substr($name, 1); } $firstSlash = strpos($name, '/'); if (false === $firstSlash) { return new vfsStreamDirectory($name, $permissions); } $ownName = substr($name, 0, $firstSlash); $subDirs = substr($name, $firstSlash + 1); $directory = new vfsStreamDirectory($ownName, $permissions); if (is_string($subDirs) && strlen($subDirs) > 0) { self::newDirectory($subDirs, $permissions)->at($directory); } return $directory; } /** * returns a new block with the given name * * @param string $name name of the block device * @param int $permissions permissions of block to create * @return vfsStreamBlock */ public static function newBlock($name, $permissions = null) { return new vfsStreamBlock($name, $permissions); } /** * returns current user * * If the system does not support posix_getuid() the current user will be root (0). * * @return int */ public static function getCurrentUser() { return function_exists('posix_getuid') ? posix_getuid() : self::OWNER_ROOT; } /** * returns current group * * If the system does not support posix_getgid() the current group will be root (0). * * @return int */ public static function getCurrentGroup() { return function_exists('posix_getgid') ? posix_getgid() : self::GROUP_ROOT; } /** * use visitor to inspect a content structure * * If the given content is null it will fall back to use the current root * directory of the stream wrapper. * * Returns given visitor for method chaining comfort. * * @param vfsStreamVisitor $visitor the visitor who inspects * @param vfsStreamContent $content directory structure to inspect * @return vfsStreamVisitor * @throws \InvalidArgumentException * @since 0.10.0 * @see https://github.com/mikey179/vfsStream/issues/10 */ public static function inspect(vfsStreamVisitor $visitor, vfsStreamContent $content = null) { if (null !== $content) { return $visitor->visit($content); } $root = vfsStreamWrapper::getRoot(); if (null === $root) { throw new \InvalidArgumentException('No content given and no root directory set.'); } return $visitor->visitDirectory($root); } /** * sets quota to given amount of bytes * * @param int $bytes * @since 1.1.0 */ public static function setQuota($bytes) { vfsStreamWrapper::setQuota(new Quota($bytes)); } /** * checks if vfsStream lists dotfiles in directory listings * * @return bool * @since 1.3.0 */ public static function useDotfiles() { return self::$dotFiles; } /** * disable dotfiles in directory listings * * @since 1.3.0 */ public static function disableDotfiles() { self::$dotFiles = false; } /** * enable dotfiles in directory listings * * @since 1.3.0 */ public static function enableDotfiles() { self::$dotFiles = true; } } PK ]~JL , src/main/php/org/bovigo/vfs/DotDirectory.phpnu W+A content = new StringBasedFileContent(null); $this->type = vfsStreamContent::TYPE_FILE; parent::__construct($name, $permissions); } /** * returns default permissions for concrete implementation * * @return int * @since 0.8.0 */ protected function getDefaultPermissions() { return 0666; } /** * checks whether the container can be applied to given name * * @param string $name * @return bool */ public function appliesTo($name) { return ($name === $this->name); } /** * alias for withContent() * * @param string $content * @return vfsStreamFile * @see withContent() */ public function setContent($content) { return $this->withContent($content); } /** * sets the contents of the file * * Setting content with this method does not change the time when the file * was last modified. * * @param string]FileContent $content * @return vfsStreamFile * @throws \InvalidArgumentException */ public function withContent($content) { if (is_string($content)) { $this->content = new StringBasedFileContent($content); } elseif ($content instanceof FileContent) { $this->content = $content; } else { throw new \InvalidArgumentException('Given content must either be a string or an instance of org\bovigo\vfs\content\FileContent'); } return $this; } /** * returns the contents of the file * * Getting content does not change the time when the file * was last accessed. * * @return string */ public function getContent() { return $this->content->content(); } /** * simply open the file * * @since 0.9 */ public function open() { $this->content->seek(0, SEEK_SET); $this->lastAccessed = time(); } /** * open file and set pointer to end of file * * @since 0.9 */ public function openForAppend() { $this->content->seek(0, SEEK_END); $this->lastAccessed = time(); } /** * open file and truncate content * * @since 0.9 */ public function openWithTruncate() { $this->open(); $this->content->truncate(0); $time = time(); $this->lastAccessed = $time; $this->lastModified = $time; } /** * reads the given amount of bytes from content * * Using this method changes the time when the file was last accessed. * * @param int $count * @return string */ public function read($count) { $this->lastAccessed = time(); return $this->content->read($count); } /** * returns the content until its end from current offset * * Using this method changes the time when the file was last accessed. * * @return string * @deprecated since 1.3.0 */ public function readUntilEnd() { $this->lastAccessed = time(); return $this->content->readUntilEnd(); } /** * writes an amount of data * * Using this method changes the time when the file was last modified. * * @param string $data * @return amount of written bytes */ public function write($data) { $this->lastModified = time(); return $this->content->write($data); } /** * Truncates a file to a given length * * @param int $size length to truncate file to * @return bool * @since 1.1.0 */ public function truncate($size) { $this->content->truncate($size); $this->lastModified = time(); return true; } /** * checks whether pointer is at end of file * * @return bool */ public function eof() { return $this->content->eof(); } /** * returns the current position within the file * * @return int * @deprecated since 1.3.0 */ public function getBytesRead() { return $this->content->bytesRead(); } /** * seeks to the given offset * * @param int $offset * @param int $whence * @return bool */ public function seek($offset, $whence) { return $this->content->seek($offset, $whence); } /** * returns size of content * * @return int */ public function size() { return $this->content->size(); } /** * locks file for * * @param resource|vfsStreamWrapper $resource * @param int $operation * @return bool * @since 0.10.0 * @see https://github.com/mikey179/vfsStream/issues/6 * @see https://github.com/mikey179/vfsStream/issues/40 */ public function lock($resource, $operation) { if ((LOCK_NB & $operation) == LOCK_NB) { $operation = $operation - LOCK_NB; } // call to lock file on the same file handler firstly releases the lock $this->unlock($resource); if (LOCK_EX === $operation) { if ($this->isLocked()) { return false; } $this->setExclusiveLock($resource); } elseif(LOCK_SH === $operation) { if ($this->hasExclusiveLock()) { return false; } $this->addSharedLock($resource); } return true; } /** * Removes lock from file acquired by given resource * * @param resource|vfsStreamWrapper $resource * @see https://github.com/mikey179/vfsStream/issues/40 */ public function unlock($resource) { if ($this->hasExclusiveLock($resource)) { $this->exclusiveLock = null; } if ($this->hasSharedLock($resource)) { unset($this->sharedLock[$this->getResourceId($resource)]); } } /** * Set exlusive lock on file by given resource * * @param resource|vfsStreamWrapper $resource * @see https://github.com/mikey179/vfsStream/issues/40 */ protected function setExclusiveLock($resource) { $this->exclusiveLock = $this->getResourceId($resource); } /** * Add shared lock on file by given resource * * @param resource|vfsStreamWrapper $resource * @see https://github.com/mikey179/vfsStream/issues/40 */ protected function addSharedLock($resource) { $this->sharedLock[$this->getResourceId($resource)] = true; } /** * checks whether file is locked * * @param resource|vfsStreamWrapper $resource * @return bool * @since 0.10.0 * @see https://github.com/mikey179/vfsStream/issues/6 * @see https://github.com/mikey179/vfsStream/issues/40 */ public function isLocked($resource = null) { return $this->hasSharedLock($resource) || $this->hasExclusiveLock($resource); } /** * checks whether file is locked in shared mode * * @param resource|vfsStreamWrapper $resource * @return bool * @since 0.10.0 * @see https://github.com/mikey179/vfsStream/issues/6 * @see https://github.com/mikey179/vfsStream/issues/40 */ public function hasSharedLock($resource = null) { if (null !== $resource) { return isset($this->sharedLock[$this->getResourceId($resource)]); } return !empty($this->sharedLock); } /** * Returns unique resource id * * @param resource|vfsStreamWrapper $resource * @return string * @see https://github.com/mikey179/vfsStream/issues/40 */ public function getResourceId($resource) { if (is_resource($resource)) { $data = stream_get_meta_data($resource); $resource = $data['wrapper_data']; } return spl_object_hash($resource); } /** * checks whether file is locked in exclusive mode * * @param resource|vfsStreamWrapper $resource * @return bool * @since 0.10.0 * @see https://github.com/mikey179/vfsStream/issues/6 * @see https://github.com/mikey179/vfsStream/issues/40 */ public function hasExclusiveLock($resource = null) { if (null !== $resource) { return $this->exclusiveLock === $this->getResourceId($resource); } return null !== $this->exclusiveLock; } } PK ]~J.2ym m 2 src/main/php/org/bovigo/vfs/vfsStreamException.phpnu W+A children = $children; if (vfsStream::useDotfiles()) { array_unshift($this->children, new DotDirectory('.'), new DotDirectory('..')); } reset($this->children); } /** * resets children pointer */ public function rewind() { reset($this->children); } /** * returns the current child * * @return vfsStreamContent */ public function current() { $child = current($this->children); if (false === $child) { return null; } return $child; } /** * returns the name of the current child * * @return string */ public function key() { $child = current($this->children); if (false === $child) { return null; } return $child->getName(); } /** * iterates to next child */ public function next() { next($this->children); } /** * checks if the current value is valid * * @return bool */ public function valid() { return (false !== current($this->children)); } } PK ]~J / 0 src/main/php/org/bovigo/vfs/vfsStreamContent.phpnu W+A type = vfsStreamContent::TYPE_BLOCK; } } PK ]~JJk" " 8 src/main/php/org/bovigo/vfs/vfsStreamAbstractContent.phpnu W+A name = "{$name}"; $time = time(); if (null === $permissions) { $permissions = $this->getDefaultPermissions() & ~vfsStream::umask(); } $this->lastAccessed = $time; $this->lastAttributeModified = $time; $this->lastModified = $time; $this->permissions = $permissions; $this->user = vfsStream::getCurrentUser(); $this->group = vfsStream::getCurrentGroup(); } /** * returns default permissions for concrete implementation * * @return int * @since 0.8.0 */ protected abstract function getDefaultPermissions(); /** * returns the file name of the content * * @return string */ public function getName() { return $this->name; } /** * renames the content * * @param string $newName */ public function rename($newName) { $this->name = "{$newName}"; } /** * checks whether the container can be applied to given name * * @param string $name * @return bool */ public function appliesTo($name) { if ($name === $this->name) { return true; } $segment_name = $this->name.'/'; return (strncmp($segment_name, $name, strlen($segment_name)) == 0); } /** * returns the type of the container * * @return int */ public function getType() { return $this->type; } /** * sets the last modification time of the stream content * * @param int $filemtime * @return $this */ public function lastModified($filemtime) { $this->lastModified = $filemtime; return $this; } /** * returns the last modification time of the stream content * * @return int */ public function filemtime() { return $this->lastModified; } /** * sets last access time of the stream content * * @param int $fileatime * @return $this * @since 0.9 */ public function lastAccessed($fileatime) { $this->lastAccessed = $fileatime; return $this; } /** * returns the last access time of the stream content * * @return int * @since 0.9 */ public function fileatime() { return $this->lastAccessed; } /** * sets the last attribute modification time of the stream content * * @param int $filectime * @return $this * @since 0.9 */ public function lastAttributeModified($filectime) { $this->lastAttributeModified = $filectime; return $this; } /** * returns the last attribute modification time of the stream content * * @return int * @since 0.9 */ public function filectime() { return $this->lastAttributeModified; } /** * adds content to given container * * @param vfsStreamContainer $container * @return $this */ public function at(vfsStreamContainer $container) { $container->addChild($this); return $this; } /** * change file mode to given permissions * * @param int $permissions * @return $this */ public function chmod($permissions) { $this->permissions = $permissions; $this->lastAttributeModified = time(); clearstatcache(); return $this; } /** * returns permissions * * @return int */ public function getPermissions() { return $this->permissions; } /** * checks whether content is readable * * @param int $user id of user to check for * @param int $group id of group to check for * @return bool */ public function isReadable($user, $group) { if ($this->user === $user) { $check = 0400; } elseif ($this->group === $group) { $check = 0040; } else { $check = 0004; } return (bool) ($this->permissions & $check); } /** * checks whether content is writable * * @param int $user id of user to check for * @param int $group id of group to check for * @return bool */ public function isWritable($user, $group) { if ($this->user === $user) { $check = 0200; } elseif ($this->group === $group) { $check = 0020; } else { $check = 0002; } return (bool) ($this->permissions & $check); } /** * checks whether content is executable * * @param int $user id of user to check for * @param int $group id of group to check for * @return bool */ public function isExecutable($user, $group) { if ($this->user === $user) { $check = 0100; } elseif ($this->group === $group) { $check = 0010; } else { $check = 0001; } return (bool) ($this->permissions & $check); } /** * change owner of file to given user * * @param int $user * @return $this */ public function chown($user) { $this->user = $user; $this->lastAttributeModified = time(); return $this; } /** * checks whether file is owned by given user * * @param int $user * @return bool */ public function isOwnedByUser($user) { return $this->user === $user; } /** * returns owner of file * * @return int */ public function getUser() { return $this->user; } /** * change owner group of file to given group * * @param int $group * @return $this */ public function chgrp($group) { $this->group = $group; $this->lastAttributeModified = time(); return $this; } /** * checks whether file is owned by group * * @param int $group * @return bool */ public function isOwnedByGroup($group) { return $this->group === $group; } /** * returns owner group of file * * @return int */ public function getGroup() { return $this->group; } /** * sets parent path * * @param string $parentPath * @internal only to be set by parent * @since 1.2.0 */ public function setParentPath($parentPath) { $this->parentPath = $parentPath; } /** * returns path to this content * * @return string * @since 1.2.0 */ public function path() { if (null === $this->parentPath) { return $this->name; } return $this->parentPath . '/' . $this->name; } /** * returns complete vfsStream url for this content * * @return string * @since 1.2.0 */ public function url() { return vfsStream::url($this->path()); } } PK ]~Jcs s 0 src/main/php/org/bovigo/vfs/vfsStreamWrapper.phpnu W+A getName() === $path) { return self::$root; } if ($this->isInRoot($path) && self::$root->hasChild($path) === true) { return self::$root->getChild($path); } return null; } /** * helper method to detect whether given path is in root path * * @param string $path * @return bool */ private function isInRoot($path) { return substr($path, 0, strlen(self::$root->getName())) === self::$root->getName(); } /** * returns content for given path but only when it is of given type * * @param string $path * @param int $type * @return vfsStreamContent */ protected function getContentOfType($path, $type) { $content = $this->getContent($path); if (null !== $content && $content->getType() === $type) { return $content; } return null; } /** * splits path into its dirname and the basename * * @param string $path * @return string[] */ protected function splitPath($path) { $lastSlashPos = strrpos($path, '/'); if (false === $lastSlashPos) { return array('dirname' => '', 'basename' => $path); } return array('dirname' => substr($path, 0, $lastSlashPos), 'basename' => substr($path, $lastSlashPos + 1) ); } /** * helper method to resolve a path from /foo/bar/. to /foo/bar * * @param string $path * @return string */ protected function resolvePath($path) { $newPath = array(); foreach (explode('/', $path) as $pathPart) { if ('.' !== $pathPart) { if ('..' !== $pathPart) { $newPath[] = $pathPart; } elseif (count($newPath) > 1) { array_pop($newPath); } } } return implode('/', $newPath); } /** * open the stream * * @param string $path the path to open * @param string $mode mode for opening * @param string $options options for opening * @param string $opened_path full path that was actually opened * @return bool */ public function stream_open($path, $mode, $options, $opened_path) { $extended = ((strstr($mode, '+') !== false) ? (true) : (false)); $mode = str_replace(array('t', 'b', '+'), '', $mode); if (in_array($mode, array('r', 'w', 'a', 'x', 'c')) === false) { if (($options & STREAM_REPORT_ERRORS) === STREAM_REPORT_ERRORS) { trigger_error('Illegal mode ' . $mode . ', use r, w, a, x or c, flavoured with t, b and/or +', E_USER_WARNING); } return false; } $this->mode = $this->calculateMode($mode, $extended); $path = $this->resolvePath(vfsStream::path($path)); $this->content = $this->getContentOfType($path, vfsStreamContent::TYPE_FILE); if (null !== $this->content) { if (self::WRITE === $mode) { if (($options & STREAM_REPORT_ERRORS) === STREAM_REPORT_ERRORS) { trigger_error('File ' . $path . ' already exists, can not open with mode x', E_USER_WARNING); } return false; } if ( (self::TRUNCATE === $mode || self::APPEND === $mode) && $this->content->isWritable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()) === false ) { return false; } if (self::TRUNCATE === $mode) { $this->content->openWithTruncate(); } elseif (self::APPEND === $mode) { $this->content->openForAppend(); } else { if (!$this->content->isReadable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup())) { if (($options & STREAM_REPORT_ERRORS) === STREAM_REPORT_ERRORS) { trigger_error('Permission denied', E_USER_WARNING); } return false; } $this->content->open(); } return true; } $content = $this->createFile($path, $mode, $options); if (false === $content) { return false; } $this->content = $content; return true; } /** * creates a file at given path * * @param string $path the path to open * @param string $mode mode for opening * @param string $options options for opening * @return bool */ private function createFile($path, $mode = null, $options = null) { $names = $this->splitPath($path); if (empty($names['dirname']) === true) { if (($options & STREAM_REPORT_ERRORS) === STREAM_REPORT_ERRORS) { trigger_error('File ' . $names['basename'] . ' does not exist', E_USER_WARNING); } return false; } $dir = $this->getContentOfType($names['dirname'], vfsStreamContent::TYPE_DIR); if (null === $dir) { if (($options & STREAM_REPORT_ERRORS) === STREAM_REPORT_ERRORS) { trigger_error('Directory ' . $names['dirname'] . ' does not exist', E_USER_WARNING); } return false; } elseif ($dir->hasChild($names['basename']) === true) { if (($options & STREAM_REPORT_ERRORS) === STREAM_REPORT_ERRORS) { trigger_error('Directory ' . $names['dirname'] . ' already contains a director named ' . $names['basename'], E_USER_WARNING); } return false; } if (self::READ === $mode) { if (($options & STREAM_REPORT_ERRORS) === STREAM_REPORT_ERRORS) { trigger_error('Can not open non-existing file ' . $path . ' for reading', E_USER_WARNING); } return false; } if ($dir->isWritable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()) === false) { if (($options & STREAM_REPORT_ERRORS) === STREAM_REPORT_ERRORS) { trigger_error('Can not create new file in non-writable path ' . $names['dirname'], E_USER_WARNING); } return false; } return vfsStream::newFile($names['basename'])->at($dir); } /** * calculates the file mode * * @param string $mode opening mode: r, w, a or x * @param bool $extended true if + was set with opening mode * @return int */ protected function calculateMode($mode, $extended) { if (true === $extended) { return self::ALL; } if (self::READ === $mode) { return self::READONLY; } return self::WRITEONLY; } /** * closes the stream * * @see https://github.com/mikey179/vfsStream/issues/40 */ public function stream_close() { $this->content->lock($this, LOCK_UN); } /** * read the stream up to $count bytes * * @param int $count amount of bytes to read * @return string */ public function stream_read($count) { if (self::WRITEONLY === $this->mode) { return ''; } if ($this->content->isReadable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()) === false) { return ''; } return $this->content->read($count); } /** * writes data into the stream * * @param string $data * @return int amount of bytes written */ public function stream_write($data) { if (self::READONLY === $this->mode) { return 0; } if ($this->content->isWritable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()) === false) { return 0; } if (self::$quota->isLimited()) { $data = substr($data, 0, self::$quota->spaceLeft(self::$root->sizeSummarized())); } return $this->content->write($data); } /** * truncates a file to a given length * * @param int $size length to truncate file to * @return bool * @since 1.1.0 */ public function stream_truncate($size) { if (self::READONLY === $this->mode) { return false; } if ($this->content->isWritable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()) === false) { return false; } if ($this->content->getType() !== vfsStreamContent::TYPE_FILE) { return false; } if (self::$quota->isLimited() && $this->content->size() < $size) { $maxSize = self::$quota->spaceLeft(self::$root->sizeSummarized()); if (0 === $maxSize) { return false; } if ($size > $maxSize) { $size = $maxSize; } } return $this->content->truncate($size); } /** * sets metadata like owner, user or permissions * * @param string $path * @param int $option * @param mixed $var * @return bool * @since 1.1.0 */ public function stream_metadata($path, $option, $var) { $path = $this->resolvePath(vfsStream::path($path)); $content = $this->getContent($path); switch ($option) { case STREAM_META_TOUCH: if (null === $content) { $content = $this->createFile($path, null, STREAM_REPORT_ERRORS); // file creation may not be allowed at provided path if (false === $content) { return false; } } $currentTime = time(); $content->lastModified(((isset($var[0])) ? ($var[0]) : ($currentTime))) ->lastAccessed(((isset($var[1])) ? ($var[1]) : ($currentTime))); return true; case STREAM_META_OWNER_NAME: return false; case STREAM_META_OWNER: if (null === $content) { return false; } return $this->doPermChange($path, $content, function() use ($content, $var) { $content->chown($var); } ); case STREAM_META_GROUP_NAME: return false; case STREAM_META_GROUP: if (null === $content) { return false; } return $this->doPermChange($path, $content, function() use ($content, $var) { $content->chgrp($var); } ); case STREAM_META_ACCESS: if (null === $content) { return false; } return $this->doPermChange($path, $content, function() use ($content, $var) { $content->chmod($var); } ); default: return false; } } /** * executes given permission change when necessary rights allow such a change * * @param string $path * @param vfsStreamAbstractContent $content * @param \Closure $change * @return bool */ private function doPermChange($path, vfsStreamAbstractContent $content, \Closure $change) { if (!$content->isOwnedByUser(vfsStream::getCurrentUser())) { return false; } if (self::$root->getName() !== $path) { $names = $this->splitPath($path); $parent = $this->getContent($names['dirname']); if (!$parent->isWritable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup())) { return false; } } $change(); return true; } /** * checks whether stream is at end of file * * @return bool */ public function stream_eof() { return $this->content->eof(); } /** * returns the current position of the stream * * @return int */ public function stream_tell() { return $this->content->getBytesRead(); } /** * seeks to the given offset * * @param int $offset * @param int $whence * @return bool */ public function stream_seek($offset, $whence) { return $this->content->seek($offset, $whence); } /** * flushes unstored data into storage * * @return bool */ public function stream_flush() { return true; } /** * returns status of stream * * @return array */ public function stream_stat() { $fileStat = array('dev' => 0, 'ino' => 0, 'mode' => $this->content->getType() | $this->content->getPermissions(), 'nlink' => 0, 'uid' => $this->content->getUser(), 'gid' => $this->content->getGroup(), 'rdev' => 0, 'size' => $this->content->size(), 'atime' => $this->content->fileatime(), 'mtime' => $this->content->filemtime(), 'ctime' => $this->content->filectime(), 'blksize' => -1, 'blocks' => -1 ); return array_merge(array_values($fileStat), $fileStat); } /** * retrieve the underlaying resource * * Please note that this method always returns false as there is no * underlaying resource to return. * * @param int $cast_as * @since 0.9.0 * @see https://github.com/mikey179/vfsStream/issues/3 * @return bool */ public function stream_cast($cast_as) { return false; } /** * set lock status for stream * * @param int $operation * @return bool * @since 0.10.0 * @see https://github.com/mikey179/vfsStream/issues/6 * @see https://github.com/mikey179/vfsStream/issues/31 * @see https://github.com/mikey179/vfsStream/issues/40 */ public function stream_lock($operation) { if ((LOCK_NB & $operation) == LOCK_NB) { $operation = $operation - LOCK_NB; } return $this->content->lock($this, $operation); } /** * sets options on the stream * * @param int $option key of option to set * @param int $arg1 * @param int $arg2 * @return bool * @since 0.10.0 * @see https://github.com/mikey179/vfsStream/issues/15 * @see http://www.php.net/manual/streamwrapper.stream-set-option.php */ public function stream_set_option($option, $arg1, $arg2) { switch ($option) { case STREAM_OPTION_BLOCKING: // break omitted case STREAM_OPTION_READ_TIMEOUT: // break omitted case STREAM_OPTION_WRITE_BUFFER: // break omitted default: // nothing to do here } return false; } /** * remove the data under the given path * * @param string $path * @return bool */ public function unlink($path) { $realPath = $this->resolvePath(vfsStream::path($path)); $content = $this->getContent($realPath); if (null === $content) { trigger_error('unlink(' . $path . '): No such file or directory', E_USER_WARNING); return false; } if ($content->getType() !== vfsStreamContent::TYPE_FILE) { trigger_error('unlink(' . $path . '): Operation not permitted', E_USER_WARNING); return false; } return $this->doUnlink($realPath); } /** * removes a path * * @param string $path * @return bool */ protected function doUnlink($path) { if (self::$root->getName() === $path) { // delete root? very brave. :) self::$root = null; clearstatcache(); return true; } $names = $this->splitPath($path); $content = $this->getContent($names['dirname']); if (!$content->isWritable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup())) { return false; } clearstatcache(); return $content->removeChild($names['basename']); } /** * rename from one path to another * * @param string $path_from * @param string $path_to * @return bool * @author Benoit Aubuchon */ public function rename($path_from, $path_to) { $srcRealPath = $this->resolvePath(vfsStream::path($path_from)); $dstRealPath = $this->resolvePath(vfsStream::path($path_to)); $srcContent = $this->getContent($srcRealPath); if (null == $srcContent) { trigger_error(' No such file or directory', E_USER_WARNING); return false; } $dstNames = $this->splitPath($dstRealPath); $dstParentContent = $this->getContent($dstNames['dirname']); if (null == $dstParentContent) { trigger_error('No such file or directory', E_USER_WARNING); return false; } if (!$dstParentContent->isWritable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup())) { trigger_error('Permission denied', E_USER_WARNING); return false; } if ($dstParentContent->getType() !== vfsStreamContent::TYPE_DIR) { trigger_error('Target is not a directory', E_USER_WARNING); return false; } // remove old source first, so we can rename later // (renaming first would lead to not being able to remove the old path) if (!$this->doUnlink($srcRealPath)) { return false; } $dstContent = $srcContent; // Renaming the filename $dstContent->rename($dstNames['basename']); // Copying to the destination $dstParentContent->addChild($dstContent); return true; } /** * creates a new directory * * @param string $path * @param int $mode * @param int $options * @return bool */ public function mkdir($path, $mode, $options) { $umask = vfsStream::umask(); if (0 < $umask) { $permissions = $mode & ~$umask; } else { $permissions = $mode; } $path = $this->resolvePath(vfsStream::path($path)); if (null !== $this->getContent($path)) { trigger_error('mkdir(): Path vfs://' . $path . ' exists', E_USER_WARNING); return false; } if (null === self::$root) { self::$root = vfsStream::newDirectory($path, $permissions); return true; } $maxDepth = count(explode('/', $path)); $names = $this->splitPath($path); $newDirs = $names['basename']; $dir = null; $i = 0; while ($dir === null && $i < $maxDepth) { $dir = $this->getContent($names['dirname']); $names = $this->splitPath($names['dirname']); if (null == $dir) { $newDirs = $names['basename'] . '/' . $newDirs; } $i++; } if (null === $dir || $dir->getType() !== vfsStreamContent::TYPE_DIR || $dir->isWritable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()) === false) { return false; } $recursive = ((STREAM_MKDIR_RECURSIVE & $options) !== 0) ? (true) : (false); if (strpos($newDirs, '/') !== false && false === $recursive) { return false; } vfsStream::newDirectory($newDirs, $permissions)->at($dir); return true; } /** * removes a directory * * @param string $path * @param int $options * @return bool * @todo consider $options with STREAM_MKDIR_RECURSIVE */ public function rmdir($path, $options) { $path = $this->resolvePath(vfsStream::path($path)); $child = $this->getContentOfType($path, vfsStreamContent::TYPE_DIR); if (null === $child) { return false; } // can only remove empty directories if (count($child->getChildren()) > 0) { return false; } if (self::$root->getName() === $path) { // delete root? very brave. :) self::$root = null; clearstatcache(); return true; } $names = $this->splitPath($path); $dir = $this->getContentOfType($names['dirname'], vfsStreamContent::TYPE_DIR); if ($dir->isWritable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()) === false) { return false; } clearstatcache(); return $dir->removeChild($child->getName()); } /** * opens a directory * * @param string $path * @param int $options * @return bool */ public function dir_opendir($path, $options) { $path = $this->resolvePath(vfsStream::path($path)); $this->dir = $this->getContentOfType($path, vfsStreamContent::TYPE_DIR); if (null === $this->dir || $this->dir->isReadable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()) === false) { return false; } $this->dirIterator = $this->dir->getIterator(); return true; } /** * reads directory contents * * @return string */ public function dir_readdir() { $dir = $this->dirIterator->current(); if (null === $dir) { return false; } $this->dirIterator->next(); return $dir->getName(); } /** * reset directory iteration * * @return bool */ public function dir_rewinddir() { return $this->dirIterator->rewind(); } /** * closes directory * * @return bool */ public function dir_closedir() { $this->dirIterator = null; return true; } /** * returns status of url * * @param string $path path of url to return status for * @param int $flags flags set by the stream API * @return array */ public function url_stat($path, $flags) { $content = $this->getContent($this->resolvePath(vfsStream::path($path))); if (null === $content) { if (($flags & STREAM_URL_STAT_QUIET) != STREAM_URL_STAT_QUIET) { trigger_error(' No such file or directory: ' . $path, E_USER_WARNING); } return false; } $fileStat = array('dev' => 0, 'ino' => 0, 'mode' => $content->getType() | $content->getPermissions(), 'nlink' => 0, 'uid' => $content->getUser(), 'gid' => $content->getGroup(), 'rdev' => 0, 'size' => $content->size(), 'atime' => $content->fileatime(), 'mtime' => $content->filemtime(), 'ctime' => $content->filectime(), 'blksize' => -1, 'blocks' => -1 ); return array_merge(array_values($fileStat), $fileStat); } } PK ]~Jd? % src/main/php/org/bovigo/vfs/Quota.phpnu W+A amount = $amount; } /** * create with unlimited space * * @return Quota */ public static function unlimited() { return new self(self::UNLIMITED); } /** * checks if a quota is set * * @return bool */ public function isLimited() { return self::UNLIMITED < $this->amount; } /** * checks if given used space exceeda quota limit * * * @param int $usedSpace * @return int */ public function spaceLeft($usedSpace) { if (self::UNLIMITED === $this->amount) { return $usedSpace; } if ($usedSpace >= $this->amount) { return 0; } $spaceLeft = $this->amount - $usedSpace; if (0 >= $spaceLeft) { return 0; } return $spaceLeft; } } PK ]~J`b A src/main/php/org/bovigo/vfs/visitor/vfsStreamStructureVisitor.phpnu W+A reset(); } /** * visit a file and process it * * @param vfsStreamFile $file * @return vfsStreamStructureVisitor */ public function visitFile(vfsStreamFile $file) { $this->current[$file->getName()] = $file->getContent(); return $this; } /** * visit a block device and process it * * @param vfsStreamBlock $block * @return vfsStreamStructureVisitor */ public function visitBlockDevice(vfsStreamBlock $block) { $this->current['[' . $block->getName() . ']'] = $block->getContent(); return $this; } /** * visit a directory and process it * * @param vfsStreamDirectory $dir * @return vfsStreamStructureVisitor */ public function visitDirectory(vfsStreamDirectory $dir) { $this->current[$dir->getName()] = array(); $tmp =& $this->current; $this->current =& $tmp[$dir->getName()]; foreach ($dir as $child) { $this->visit($child); } $this->current =& $tmp; return $this; } /** * returns structure of visited contents * * @return array * @api */ public function getStructure() { return $this->structure; } /** * resets structure so visitor could be reused * * @return vfsStreamStructureVisitor */ public function reset() { $this->structure = array(); $this->current =& $this->structure; return $this; } } PK ]~J(] = src/main/php/org/bovigo/vfs/visitor/vfsStreamPrintVisitor.phpnu W+A out = $out; } /** * visit a file and process it * * @param vfsStreamFile $file * @return vfsStreamPrintVisitor */ public function visitFile(vfsStreamFile $file) { $this->printContent($file->getName()); return $this; } /** * visit a block device and process it * * @param vfsStreamBlock $block * @return vfsStreamPrintVisitor */ public function visitBlockDevice(vfsStreamBlock $block) { $name = '[' . $block->getName() . ']'; $this->printContent($name); return $this; } /** * visit a directory and process it * * @param vfsStreamDirectory $dir * @return vfsStreamPrintVisitor */ public function visitDirectory(vfsStreamDirectory $dir) { $this->printContent($dir->getName()); $this->depth++; foreach ($dir as $child) { $this->visit($child); } $this->depth--; return $this; } /** * helper method to print the content * * @param string $name */ protected function printContent($name) { fwrite($this->out, str_repeat(' ', $this->depth) . '- ' . $name . "\n"); } } PK ]~JնE E 8 src/main/php/org/bovigo/vfs/visitor/vfsStreamVisitor.phpnu W+A getType()) { case vfsStreamContent::TYPE_BLOCK: $this->visitBlockDevice($content); break; case vfsStreamContent::TYPE_FILE: $this->visitFile($content); break; case vfsStreamContent::TYPE_DIR: if (!$content->isDot()) { $this->visitDirectory($content); } break; default: throw new \InvalidArgumentException('Unknown content type ' . $content->getType() . ' for ' . $content->getName()); } return $this; } /** * visit a block device and process it * * @param vfsStreamBlock $block * @return vfsStreamVisitor */ public function visitBlockDevice(vfsStreamBlock $block) { return $this->visitFile($block); } } PK ]~Jce ; src/main/php/org/bovigo/vfs/content/SeekableFileContent.phpnu W+A doRead($this->offset, $count); $this->offset += $count; return $data; } /** * actual reading of given byte count starting at given offset * * @param int $offset * @param int $count */ protected abstract function doRead($offset, $count); /** * seeks to the given offset * * @param int $offset * @param int $whence * @return bool */ public function seek($offset, $whence) { switch ($whence) { case SEEK_CUR: $this->offset += $offset; return true; case SEEK_END: $this->offset = $this->size() + $offset; return true; case SEEK_SET: $this->offset = $offset; return true; default: return false; } return false; } /** * checks whether pointer is at end of file * * @return bool */ public function eof() { return $this->size() <= $this->offset; } /** * writes an amount of data * * @param string $data * @return amount of written bytes */ public function write($data) { $dataLength = strlen($data); $this->doWrite($data, $this->offset, $dataLength); $this->offset += $dataLength; return $dataLength; } /** * actual writing of data with specified length at given offset * * @param string $data * @param int $offset * @param int $length */ protected abstract function doWrite($data, $offset, $length); /** * for backwards compatibility with vfsStreamFile::bytesRead() * * @return int * @deprecated */ public function bytesRead() { return $this->offset; } /** * for backwards compatibility with vfsStreamFile::readUntilEnd() * * @return string * @deprecated */ public function readUntilEnd() { return substr($this->content(), $this->offset); } } PK ]~J9 8 src/main/php/org/bovigo/vfs/content/LargeFileContent.phpnu W+A size = $size; } /** * create large file with given size in kilobyte * * @param int $kilobyte * @return LargeFileContent */ public static function withKilobytes($kilobyte) { return new self($kilobyte * 1024); } /** * create large file with given size in megabyte * * @param int $megabyte * @return LargeFileContent */ public static function withMegabytes($megabyte) { return self::withKilobytes($megabyte * 1024); } /** * create large file with given size in gigabyte * * @param int $gigabyte * @return LargeFileContent */ public static function withGigabytes($gigabyte) { return self::withMegabytes($gigabyte * 1024); } /** * returns actual content * * @return string */ public function content() { return $this->doRead(0, $this->size); } /** * returns size of content * * @return int */ public function size() { return $this->size; } /** * actual reading of given byte count starting at given offset * * @param int $offset * @param int $count */ protected function doRead($offset, $count) { if (($offset + $count) > $this->size) { $count = $this->size - $offset; } $result = ''; for ($i = 0; $i < $count; $i++) { if (isset($this->content[$i + $offset])) { $result .= $this->content[$i + $offset]; } else { $result .= ' '; } } return $result; } /** * actual writing of data with specified length at given offset * * @param string $data * @param int $offset * @param int $length */ protected function doWrite($data, $offset, $length) { for ($i = 0; $i < $length; $i++) { $this->content[$i + $offset] = $data{$i}; } if ($offset >= $this->size) { $this->size += $length; } elseif (($offset + $length) > $this->size) { $this->size = $offset + $length; } } /** * Truncates a file to a given length * * @param int $size length to truncate file to * @return bool */ public function truncate($size) { $this->size = $size; foreach (array_filter(array_keys($this->content), function($pos) use ($size) { return $pos >= $size; } ) as $removePos) { unset($this->content[$removePos]); } return true; } } PK ]~JG1G G 3 src/main/php/org/bovigo/vfs/content/FileContent.phpnu W+A