diff --git a/composer.lock b/composer.lock index 28f44762..01470528 100644 --- a/composer.lock +++ b/composer.lock @@ -249,16 +249,16 @@ }, { "name": "clue/stream-filter", - "version": "v1.5.0", + "version": "v1.6.0", "source": { "type": "git", "url": "https://github.com/clue/stream-filter.git", - "reference": "aeb7d8ea49c7963d3b581378955dbf5bc49aa320" + "reference": "d6169430c7731d8509da7aecd0af756a5747b78e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/clue/stream-filter/zipball/aeb7d8ea49c7963d3b581378955dbf5bc49aa320", - "reference": "aeb7d8ea49c7963d3b581378955dbf5bc49aa320", + "url": "https://api.github.com/repos/clue/stream-filter/zipball/d6169430c7731d8509da7aecd0af756a5747b78e", + "reference": "d6169430c7731d8509da7aecd0af756a5747b78e", "shasum": "" }, "require": { @@ -299,7 +299,7 @@ ], "support": { "issues": "https://github.com/clue/stream-filter/issues", - "source": "https://github.com/clue/stream-filter/tree/v1.5.0" + "source": "https://github.com/clue/stream-filter/tree/v1.6.0" }, "funding": [ { @@ -311,7 +311,7 @@ "type": "github" } ], - "time": "2020-10-02T12:38:20+00:00" + "time": "2022-02-21T13:15:14+00:00" }, { "name": "commerceguys/addressing", @@ -619,27 +619,28 @@ }, { "name": "consolidation/annotated-command", - "version": "4.4.0", + "version": "4.5.4", "source": { "type": "git", "url": "https://github.com/consolidation/annotated-command.git", - "reference": "308f6ac178566a1ce9aa90ed908dac90a2c1e707" + "reference": "93398c3166d9026ab93219ce23b2092b4d7b7904" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/consolidation/annotated-command/zipball/308f6ac178566a1ce9aa90ed908dac90a2c1e707", - "reference": "308f6ac178566a1ce9aa90ed908dac90a2c1e707", + "url": "https://api.github.com/repos/consolidation/annotated-command/zipball/93398c3166d9026ab93219ce23b2092b4d7b7904", + "reference": "93398c3166d9026ab93219ce23b2092b4d7b7904", "shasum": "" }, "require": { "consolidation/output-formatters": "^4.1.1", "php": ">=7.1.3", - "psr/log": "^1|^2", - "symfony/console": "^4.4.8|~5.1.0", - "symfony/event-dispatcher": "^4.4.8|^5", - "symfony/finder": "^4.4.8|^5" + "psr/log": "^1|^2|^3", + "symfony/console": "^4.4.8|^5|^6", + "symfony/event-dispatcher": "^4.4.8|^5|^6", + "symfony/finder": "^4.4.8|^5|^6" }, "require-dev": { + "composer-runtime-api": "^2.0", "phpunit/phpunit": "^7.5.20 || ^8 || ^9", "squizlabs/php_codesniffer": "^3", "yoast/phpunit-polyfills": "^0.2.0" @@ -668,9 +669,9 @@ "description": "Initialize Symfony Console commands from annotated command class methods.", "support": { "issues": "https://github.com/consolidation/annotated-command/issues", - "source": "https://github.com/consolidation/annotated-command/tree/4.4.0" + "source": "https://github.com/consolidation/annotated-command/tree/4.5.4" }, - "time": "2021-09-30T01:08:15+00:00" + "time": "2022-04-05T17:58:10+00:00" }, { "name": "consolidation/config", @@ -829,22 +830,22 @@ }, { "name": "consolidation/log", - "version": "2.0.2", + "version": "2.1.1", "source": { "type": "git", "url": "https://github.com/consolidation/log.git", - "reference": "82a2aaaa621a7b976e50a745a8d249d5085ee2b1" + "reference": "3ad08dc57e8aff9400111bad36beb0ed387fe6a9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/consolidation/log/zipball/82a2aaaa621a7b976e50a745a8d249d5085ee2b1", - "reference": "82a2aaaa621a7b976e50a745a8d249d5085ee2b1", + "url": "https://api.github.com/repos/consolidation/log/zipball/3ad08dc57e8aff9400111bad36beb0ed387fe6a9", + "reference": "3ad08dc57e8aff9400111bad36beb0ed387fe6a9", "shasum": "" }, "require": { "php": ">=7.1.3", - "psr/log": "^1.0", - "symfony/console": "^4|^5" + "psr/log": "^1 || ^2", + "symfony/console": "^4 || ^5 || ^6" }, "require-dev": { "phpunit/phpunit": ">=7.5.20", @@ -875,36 +876,36 @@ "description": "Improved Psr-3 / Psr\\Log logger based on Symfony Console components.", "support": { "issues": "https://github.com/consolidation/log/issues", - "source": "https://github.com/consolidation/log/tree/2.0.2" + "source": "https://github.com/consolidation/log/tree/2.1.1" }, - "time": "2020-12-10T16:26:23+00:00" + "time": "2022-02-24T04:27:32+00:00" }, { "name": "consolidation/output-formatters", - "version": "4.1.2", + "version": "4.2.2", "source": { "type": "git", "url": "https://github.com/consolidation/output-formatters.git", - "reference": "5821e6ae076bf690058a4de6c94dce97398a69c9" + "reference": "d57992bf81ead908ee21cd94b46ed65afa2e785b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/consolidation/output-formatters/zipball/5821e6ae076bf690058a4de6c94dce97398a69c9", - "reference": "5821e6ae076bf690058a4de6c94dce97398a69c9", + "url": "https://api.github.com/repos/consolidation/output-formatters/zipball/d57992bf81ead908ee21cd94b46ed65afa2e785b", + "reference": "d57992bf81ead908ee21cd94b46ed65afa2e785b", "shasum": "" }, "require": { - "dflydev/dot-access-data": "^1.1.0", + "dflydev/dot-access-data": "^1.1.0 || ^2 || ^3", "php": ">=7.1.3", - "symfony/console": "^4|^5", - "symfony/finder": "^4|^5" + "symfony/console": "^4|^5|^6", + "symfony/finder": "^4|^5|^6" }, "require-dev": { "php-coveralls/php-coveralls": "^2.4.2", "phpunit/phpunit": ">=7", "squizlabs/php_codesniffer": "^3", - "symfony/var-dumper": "^4", - "symfony/yaml": "^4", + "symfony/var-dumper": "^4|^5|^6", + "symfony/yaml": "^4|^5|^6", "yoast/phpunit-polyfills": "^0.2.0" }, "suggest": { @@ -934,38 +935,38 @@ "description": "Format text by applying transformations provided by plug-in formatters.", "support": { "issues": "https://github.com/consolidation/output-formatters/issues", - "source": "https://github.com/consolidation/output-formatters/tree/4.1.2" + "source": "https://github.com/consolidation/output-formatters/tree/4.2.2" }, - "time": "2020-12-12T19:04:59+00:00" + "time": "2022-02-13T15:28:30+00:00" }, { "name": "consolidation/robo", - "version": "3.0.6", + "version": "3.0.10", "source": { "type": "git", - "url": "https://github.com/consolidation/Robo.git", - "reference": "36dce2965a67abe5cf91f2bc36d2582a64a11258" + "url": "https://github.com/consolidation/robo.git", + "reference": "206bbe23b34081a36bfefc4de2abbc1abcd29ef4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/consolidation/Robo/zipball/36dce2965a67abe5cf91f2bc36d2582a64a11258", - "reference": "36dce2965a67abe5cf91f2bc36d2582a64a11258", + "url": "https://api.github.com/repos/consolidation/robo/zipball/206bbe23b34081a36bfefc4de2abbc1abcd29ef4", + "reference": "206bbe23b34081a36bfefc4de2abbc1abcd29ef4", "shasum": "" }, "require": { "consolidation/annotated-command": "^4.3", - "consolidation/config": "^1.2.1|^2.0.1", - "consolidation/log": "^1.1.1|^2.0.2", + "consolidation/config": "^1.2.1 || ^2.0.1", + "consolidation/log": "^1.1.1 || ^2.0.2", "consolidation/output-formatters": "^4.1.2", "consolidation/self-update": "^2.0", - "league/container": "^3.3.1", + "league/container": "^3.3.1 || ^4.0", "php": ">=7.1.3", - "symfony/console": "^4.4.19 || ^5", - "symfony/event-dispatcher": "^4.4.19 || ^5", - "symfony/filesystem": "^4.4.9 || ^5", - "symfony/finder": "^4.4.9 || ^5", - "symfony/process": "^4.4.9 || ^5", - "symfony/yaml": "^4.4 || ^5" + "symfony/console": "^4.4.19 || ^5 || ^6", + "symfony/event-dispatcher": "^4.4.19 || ^5 || ^6", + "symfony/filesystem": "^4.4.9 || ^5 || ^6", + "symfony/finder": "^4.4.9 || ^5 || ^6", + "symfony/process": "^4.4.9 || ^5 || ^6", + "symfony/yaml": "^4.4 || ^5 || ^6" }, "conflict": { "codegyre/robo": "*" @@ -974,7 +975,7 @@ "natxet/cssmin": "3.0.4", "patchwork/jsqueeze": "^2", "pear/archive_tar": "^1.4.4", - "phpunit/phpunit": "^7.5.20 | ^8", + "phpunit/phpunit": "^7.5.20 || ^8", "squizlabs/php_codesniffer": "^3.6", "yoast/phpunit-polyfills": "^0.2.0" }, @@ -1032,30 +1033,30 @@ ], "description": "Modern task runner", "support": { - "issues": "https://github.com/consolidation/Robo/issues", - "source": "https://github.com/consolidation/Robo/tree/3.0.6" + "issues": "https://github.com/consolidation/robo/issues", + "source": "https://github.com/consolidation/robo/tree/3.0.10" }, - "time": "2021-10-05T23:56:45+00:00" + "time": "2022-02-21T17:19:14+00:00" }, { "name": "consolidation/self-update", - "version": "2.0.0", + "version": "2.0.5", "source": { "type": "git", "url": "https://github.com/consolidation/self-update.git", - "reference": "7d6877f8006c51069e1469a9c57b1435640f74b7" + "reference": "8a64bdd8daf5faa8e85f56534dd99caf928164b3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/consolidation/self-update/zipball/7d6877f8006c51069e1469a9c57b1435640f74b7", - "reference": "7d6877f8006c51069e1469a9c57b1435640f74b7", + "url": "https://api.github.com/repos/consolidation/self-update/zipball/8a64bdd8daf5faa8e85f56534dd99caf928164b3", + "reference": "8a64bdd8daf5faa8e85f56534dd99caf928164b3", "shasum": "" }, "require": { "composer/semver": "^3.2", "php": ">=5.5.0", - "symfony/console": "^2.8|^3|^4|^5", - "symfony/filesystem": "^2.5|^3|^4|^5" + "symfony/console": "^2.8 || ^3 || ^4 || ^5 || ^6", + "symfony/filesystem": "^2.5 || ^3 || ^4 || ^5 || ^6" }, "bin": [ "scripts/release" @@ -1088,28 +1089,28 @@ "description": "Provides a self:update command for Symfony Console applications.", "support": { "issues": "https://github.com/consolidation/self-update/issues", - "source": "https://github.com/consolidation/self-update/tree/2.0.0" + "source": "https://github.com/consolidation/self-update/tree/2.0.5" }, - "time": "2021-10-05T23:29:47+00:00" + "time": "2022-02-09T22:44:24+00:00" }, { "name": "consolidation/site-alias", - "version": "3.1.1", + "version": "3.1.5", "source": { "type": "git", "url": "https://github.com/consolidation/site-alias.git", - "reference": "e824b57253d9174f4a500f87e6d0e1e497c2a50a" + "reference": "ef2eb7d37e59b3d837b4556d4d8070cb345b378c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/consolidation/site-alias/zipball/e824b57253d9174f4a500f87e6d0e1e497c2a50a", - "reference": "e824b57253d9174f4a500f87e6d0e1e497c2a50a", + "url": "https://api.github.com/repos/consolidation/site-alias/zipball/ef2eb7d37e59b3d837b4556d4d8070cb345b378c", + "reference": "ef2eb7d37e59b3d837b4556d4d8070cb345b378c", "shasum": "" }, "require": { - "consolidation/config": "^1.2.1|^2", + "consolidation/config": "^1.2.1 || ^2", "php": ">=5.5.0", - "symfony/finder": "~2.3|^3|^4.4|^5" + "symfony/finder": "~2.3 || ^3 || ^4.4 || ^5 || ^6" }, "require-dev": { "php-coveralls/php-coveralls": "^2.4.2", @@ -1146,22 +1147,22 @@ "description": "Manage alias records for local and remote sites.", "support": { "issues": "https://github.com/consolidation/site-alias/issues", - "source": "https://github.com/consolidation/site-alias/tree/3.1.1" + "source": "https://github.com/consolidation/site-alias/tree/3.1.5" }, - "time": "2021-09-21T00:30:48+00:00" + "time": "2022-02-23T23:59:18+00:00" }, { "name": "consolidation/site-process", - "version": "4.1.0", + "version": "4.2.0", "source": { "type": "git", "url": "https://github.com/consolidation/site-process.git", - "reference": "ef57711d7049f7606ce936ded16ad93f1ad7f02c" + "reference": "9ef08d471573d6a56405b06ef6830dd70c883072" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/consolidation/site-process/zipball/ef57711d7049f7606ce936ded16ad93f1ad7f02c", - "reference": "ef57711d7049f7606ce936ded16ad93f1ad7f02c", + "url": "https://api.github.com/repos/consolidation/site-process/zipball/9ef08d471573d6a56405b06ef6830dd70c883072", + "reference": "9ef08d471573d6a56405b06ef6830dd70c883072", "shasum": "" }, "require": { @@ -1169,7 +1170,7 @@ "consolidation/site-alias": "^3", "php": ">=7.1.3", "symfony/console": "^2.8.52|^3|^4.4|^5", - "symfony/process": "^4.3.4" + "symfony/process": "^4.3.4|^5" }, "require-dev": { "phpunit/phpunit": "^7.5.20|^8.5.14", @@ -1204,22 +1205,22 @@ "description": "A thin wrapper around the Symfony Process Component that allows applications to use the Site Alias library to specify the target for a remote call.", "support": { "issues": "https://github.com/consolidation/site-process/issues", - "source": "https://github.com/consolidation/site-process/tree/4.1.0" + "source": "https://github.com/consolidation/site-process/tree/4.2.0" }, - "time": "2021-02-21T02:53:33+00:00" + "time": "2022-02-19T04:09:55+00:00" }, { "name": "cweagans/composer-patches", - "version": "1.7.1", + "version": "1.7.2", "source": { "type": "git", "url": "https://github.com/cweagans/composer-patches.git", - "reference": "9888dcc74993c030b75f3dd548bb5e20cdbd740c" + "reference": "e9969cfc0796e6dea9b4e52f77f18e1065212871" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/cweagans/composer-patches/zipball/9888dcc74993c030b75f3dd548bb5e20cdbd740c", - "reference": "9888dcc74993c030b75f3dd548bb5e20cdbd740c", + "url": "https://api.github.com/repos/cweagans/composer-patches/zipball/e9969cfc0796e6dea9b4e52f77f18e1065212871", + "reference": "e9969cfc0796e6dea9b4e52f77f18e1065212871", "shasum": "" }, "require": { @@ -1252,9 +1253,9 @@ "description": "Provides a way to patch Composer packages.", "support": { "issues": "https://github.com/cweagans/composer-patches/issues", - "source": "https://github.com/cweagans/composer-patches/tree/1.7.1" + "source": "https://github.com/cweagans/composer-patches/tree/1.7.2" }, - "time": "2021-06-08T15:12:46+00:00" + "time": "2022-01-25T19:21:20+00:00" }, { "name": "d3/d3", @@ -1971,8 +1972,8 @@ }, "autoload": { "psr-4": { - "Doctrine\\Common\\Inflector\\": "lib/Doctrine/Common/Inflector", - "Doctrine\\Inflector\\": "lib/Doctrine/Inflector" + "Doctrine\\Inflector\\": "lib/Doctrine/Inflector", + "Doctrine\\Common\\Inflector\\": "lib/Doctrine/Common/Inflector" } }, "notification-url": "https://packagist.org/downloads/", @@ -2306,7 +2307,7 @@ "source": { "type": "git", "url": "https://git.drupalcode.org/project/address.git", - "reference": "b39e4f043c86b3f044e529ee27c485a3c32cb974" + "reference": "82604ddbef12aaa347308bf08a9e5c6d5af5222b" }, "require": { "commerceguys/addressing": "^1.2.0", @@ -2372,29 +2373,26 @@ }, { "name": "drupal/admin_toolbar", - "version": "3.1.0", + "version": "2.5.0", "source": { "type": "git", "url": "https://git.drupalcode.org/project/admin_toolbar.git", - "reference": "3.1.0" + "reference": "8.x-2.5" }, "dist": { "type": "zip", - "url": "https://ftp.drupal.org/files/projects/admin_toolbar-3.1.0.zip", - "reference": "3.1.0", - "shasum": "7b596d7de04faca747ba3e5216c2e819aae71f40" + "url": "https://ftp.drupal.org/files/projects/admin_toolbar-8.x-2.5.zip", + "reference": "8.x-2.5", + "shasum": "c71e58051b8d6818272df96d14cb11407d5e5ceb" }, "require": { - "drupal/core": "^8.8.0 || ^9.0 || ^10.0" - }, - "require-dev": { - "drupal/admin_toolbar_tools": "*" + "drupal/core": "^8.8.0 || ^9.0" }, "type": "drupal-module", "extra": { "drupal": { - "version": "3.1.0", - "datestamp": "1643742891", + "version": "8.x-2.5", + "datestamp": "1629907119", "security-coverage": { "status": "covered", "message": "Covered by Drupal's security advisory policy" @@ -2510,7 +2508,7 @@ "source": { "type": "git", "url": "https://git.drupalcode.org/project/administerusersbyrole.git", - "reference": "658de15649b296eea59751690b8ed8faf93eafb9" + "reference": "464c1e0566b9469353643cb1c27cb2c10d12365c" }, "require": { "drupal/core": "^8 || ^9" @@ -2521,8 +2519,8 @@ "dev-3.x": "3.x-dev" }, "drupal": { - "version": "8.x-3.0+2-dev", - "datestamp": "1612106158", + "version": "8.x-3.0+3-dev", + "datestamp": "1644512002", "security-coverage": { "status": "not-covered", "message": "Dev releases are not covered by Drupal security advisories." @@ -3149,23 +3147,20 @@ }, { "name": "drupal/config_filter", - "version": "2.2.0", + "version": "1.9.0", "source": { "type": "git", "url": "https://git.drupalcode.org/project/config_filter.git", - "reference": "8.x-2.2" + "reference": "8.x-1.9" }, "dist": { "type": "zip", - "url": "https://ftp.drupal.org/files/projects/config_filter-8.x-2.2.zip", - "reference": "8.x-2.2", - "shasum": "dc6bc8107255066507cfc1d6766e664c3673cda0" + "url": "https://ftp.drupal.org/files/projects/config_filter-8.x-1.9.zip", + "reference": "8.x-1.9", + "shasum": "cf6919fc5039771f8e6c2ed203f29ab0eca8d91f" }, "require": { - "drupal/core": "^8.8 || ^9" - }, - "conflict": { - "drush/drush": "<10" + "drupal/core": "^8 || ^9" }, "suggest": { "drupal/config_split": "Split site configuration for different environments." @@ -3173,8 +3168,8 @@ "type": "drupal-module", "extra": { "drupal": { - "version": "8.x-2.2", - "datestamp": "1601934694", + "version": "8.x-1.9", + "datestamp": "1649336052", "security-coverage": { "status": "covered", "message": "Covered by Drupal's security advisory policy" @@ -3784,16 +3779,16 @@ }, { "name": "drupal/core", - "version": "9.3.6", + "version": "9.3.9", "source": { "type": "git", "url": "https://github.com/drupal/core.git", - "reference": "2c0c89a0f49fab56f8322721888cdfa28fe98c3a" + "reference": "86b0c4496e20ae7f945e9a7f0404fafe191ab774" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/drupal/core/zipball/2c0c89a0f49fab56f8322721888cdfa28fe98c3a", - "reference": "2c0c89a0f49fab56f8322721888cdfa28fe98c3a", + "url": "https://api.github.com/repos/drupal/core/zipball/86b0c4496e20ae7f945e9a7f0404fafe191ab774", + "reference": "86b0c4496e20ae7f945e9a7f0404fafe191ab774", "shasum": "" }, "require": { @@ -4035,22 +4030,22 @@ ], "description": "Drupal is an open source content management platform powering millions of websites and applications.", "support": { - "source": "https://github.com/drupal/core/tree/9.3.6" + "source": "https://github.com/drupal/core/tree/9.3.9" }, - "time": "2022-02-15T20:26:28+00:00" + "time": "2022-03-21T21:21:58+00:00" }, { "name": "drupal/core-composer-scaffold", - "version": "9.3.6", + "version": "9.3.9", "source": { "type": "git", "url": "https://github.com/drupal/core-composer-scaffold.git", - "reference": "d3e0b1d707125c5de0f54315906e65654c3608da" + "reference": "a9dd9def8891e1c388719474720b57d3fe929a2f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/drupal/core-composer-scaffold/zipball/d3e0b1d707125c5de0f54315906e65654c3608da", - "reference": "d3e0b1d707125c5de0f54315906e65654c3608da", + "url": "https://api.github.com/repos/drupal/core-composer-scaffold/zipball/a9dd9def8891e1c388719474720b57d3fe929a2f", + "reference": "a9dd9def8891e1c388719474720b57d3fe929a2f", "shasum": "" }, "require": { @@ -4085,22 +4080,22 @@ "drupal" ], "support": { - "source": "https://github.com/drupal/core-composer-scaffold/tree/9.3.6" + "source": "https://github.com/drupal/core-composer-scaffold/tree/9.3.9" }, - "time": "2021-11-19T09:52:23+00:00" + "time": "2022-02-24T17:40:56+00:00" }, { "name": "drupal/core-project-message", - "version": "9.3.6", + "version": "9.3.9", "source": { "type": "git", "url": "https://github.com/drupal/core-project-message.git", - "reference": "812d6da43dd49cc210af62e80fa92189e68e565a" + "reference": "69664743736977676e11f824301ea3e925a712fc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/drupal/core-project-message/zipball/812d6da43dd49cc210af62e80fa92189e68e565a", - "reference": "812d6da43dd49cc210af62e80fa92189e68e565a", + "url": "https://api.github.com/repos/drupal/core-project-message/zipball/69664743736977676e11f824301ea3e925a712fc", + "reference": "69664743736977676e11f824301ea3e925a712fc", "shasum": "" }, "require": { @@ -4126,22 +4121,22 @@ "drupal" ], "support": { - "source": "https://github.com/drupal/core-project-message/tree/10.0.0-alpha1" + "source": "https://github.com/drupal/core-project-message/tree/9.3.9" }, - "time": "2020-09-14T13:40:36+00:00" + "time": "2022-02-24T17:40:56+00:00" }, { "name": "drupal/core-recommended", - "version": "9.3.6", + "version": "9.3.9", "source": { "type": "git", "url": "https://github.com/drupal/core-recommended.git", - "reference": "1b24d3f87b55510f85d8495a63e141e601e32a88" + "reference": "3ce3f2b6145de56178e006fb2ef94089d32cf411" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/drupal/core-recommended/zipball/1b24d3f87b55510f85d8495a63e141e601e32a88", - "reference": "1b24d3f87b55510f85d8495a63e141e601e32a88", + "url": "https://api.github.com/repos/drupal/core-recommended/zipball/3ce3f2b6145de56178e006fb2ef94089d32cf411", + "reference": "3ce3f2b6145de56178e006fb2ef94089d32cf411", "shasum": "" }, "require": { @@ -4150,11 +4145,11 @@ "doctrine/annotations": "1.13.2", "doctrine/lexer": "1.2.1", "doctrine/reflection": "1.2.2", - "drupal/core": "9.3.6", + "drupal/core": "9.3.9", "egulias/email-validator": "3.1.2", "guzzlehttp/guzzle": "6.5.5", "guzzlehttp/promises": "1.5.1", - "guzzlehttp/psr7": "1.8.3", + "guzzlehttp/psr7": "1.8.5", "laminas/laminas-diactoros": "2.8.0", "laminas/laminas-escaper": "2.9.0", "laminas/laminas-feed": "2.15.0", @@ -4212,9 +4207,9 @@ ], "description": "Locked core dependencies; require this project INSTEAD OF drupal/core.", "support": { - "source": "https://github.com/drupal/core-recommended/tree/9.3.6" + "source": "https://github.com/drupal/core-recommended/tree/9.3.9" }, - "time": "2022-02-15T20:26:28+00:00" + "time": "2022-03-21T21:21:58+00:00" }, { "name": "drupal/cshs", @@ -4493,17 +4488,17 @@ }, { "name": "drupal/devel", - "version": "4.1.3", + "version": "4.1.5", "source": { "type": "git", "url": "https://git.drupalcode.org/project/devel.git", - "reference": "4.1.3" + "reference": "4.1.5" }, "dist": { "type": "zip", - "url": "https://ftp.drupal.org/files/projects/devel-4.1.3.zip", - "reference": "4.1.3", - "shasum": "f82261ca19a43379742e1df4c5a3795ef7a70441" + "url": "https://ftp.drupal.org/files/projects/devel-4.1.5.zip", + "reference": "4.1.5", + "shasum": "7d0b4397215f615a67ba80aab777e93918d497f9" }, "require": { "doctrine/common": "^2.7", @@ -4522,8 +4517,8 @@ "type": "drupal-module", "extra": { "drupal": { - "version": "4.1.3", - "datestamp": "1639534069", + "version": "4.1.5", + "datestamp": "1646072825", "security-coverage": { "status": "covered", "message": "Covered by Drupal's security advisory policy" @@ -4928,26 +4923,26 @@ }, { "name": "drupal/entity", - "version": "1.2.0", + "version": "1.3.0", "source": { "type": "git", "url": "https://git.drupalcode.org/project/entity.git", - "reference": "8.x-1.2" + "reference": "8.x-1.3" }, "dist": { "type": "zip", - "url": "https://ftp.drupal.org/files/projects/entity-8.x-1.2.zip", - "reference": "8.x-1.2", - "shasum": "7e7cb12ea65d9f986b59935eda316387cf511079" + "url": "https://ftp.drupal.org/files/projects/entity-8.x-1.3.zip", + "reference": "8.x-1.3", + "shasum": "9515e28a70448d369adf4199d08a01a5ab75792d" }, "require": { - "drupal/core": "^8.8 || ^9" + "drupal/core": "^8.8.2 || ^9" }, "type": "drupal-module", "extra": { "drupal": { - "version": "8.x-1.2", - "datestamp": "1606399149", + "version": "8.x-1.3", + "datestamp": "1646324539", "security-coverage": { "status": "covered", "message": "Covered by Drupal's security advisory policy" @@ -4989,9 +4984,10 @@ } ], "description": "Provides expanded entity APIs, which will be moved to Drupal core one day.", - "homepage": "http://drupal.org/project/entity", + "homepage": "https://www.drupal.org/project/entity", "support": { - "source": "https://git.drupalcode.org/project/entity" + "source": "https://git.drupalcode.org/project/entity", + "issues": "https://www.drupal.org/project/issues/entity" } }, { @@ -5127,7 +5123,7 @@ "role": "Maintainer" }, { - "name": "RajabNatshah", + "name": "Rajab Natshah", "homepage": "https://www.drupal.org/user/1414312" } ], @@ -5311,11 +5307,17 @@ }, { "name": "drupal/field_group", - "version": "dev-3.x", + "version": "3.2.0", "source": { "type": "git", "url": "https://git.drupalcode.org/project/field_group.git", - "reference": "f9a93f0d06b4fb354015e2b380492a5ddedd009e" + "reference": "8.x-3.2" + }, + "dist": { + "type": "zip", + "url": "https://ftp.drupal.org/files/projects/field_group-8.x-3.2.zip", + "reference": "8.x-3.2", + "shasum": "2020bbfe40f6ba43bc733ae7c8761632572433a0" }, "require": { "drupal/core": "^8.8 || ^9" @@ -5325,15 +5327,12 @@ }, "type": "drupal-module", "extra": { - "branch-alias": { - "dev-3.x": "3.x-dev" - }, "drupal": { - "version": "8.x-3.2+6-dev", - "datestamp": "1634760756", + "version": "8.x-3.2", + "datestamp": "1628513585", "security-coverage": { - "status": "not-covered", - "message": "Dev releases are not covered by Drupal security advisories." + "status": "covered", + "message": "Covered by Drupal's security advisory policy" } } }, @@ -5372,21 +5371,21 @@ }, { "name": "drupal/file_mdm", - "version": "2.3.0", + "version": "2.4.0", "source": { "type": "git", "url": "https://git.drupalcode.org/project/file_mdm.git", - "reference": "8.x-2.3" + "reference": "8.x-2.4" }, "dist": { "type": "zip", - "url": "https://ftp.drupal.org/files/projects/file_mdm-8.x-2.3.zip", - "reference": "8.x-2.3", - "shasum": "3979a591cfe41342627277d82f569b714d39e4a5" + "url": "https://ftp.drupal.org/files/projects/file_mdm-8.x-2.4.zip", + "reference": "8.x-2.4", + "shasum": "f0611a95417d35e98b7792dfffb569afe8bd6e7c" }, "require": { - "drupal/core": "^9.2 || ^10", - "lsolesen/pel": "^0.9.11", + "drupal/core": "^9.2", + "lsolesen/pel": "^0.9.12", "phenx/php-font-lib": "^0.5.4" }, "require-dev": { @@ -5397,8 +5396,8 @@ "type": "drupal-module", "extra": { "drupal": { - "version": "8.x-2.3", - "datestamp": "1644943374", + "version": "8.x-2.4", + "datestamp": "1645440700", "security-coverage": { "status": "covered", "message": "Covered by Drupal's security advisory policy" @@ -5535,59 +5534,6 @@ "source": "https://git.drupalcode.org/project/filter_perms" } }, - { - "name": "drupal/formatter_suite", - "version": "1.3.0", - "source": { - "type": "git", - "url": "https://git.drupalcode.org/project/formatter_suite.git", - "reference": "8.x-1.3" - }, - "dist": { - "type": "zip", - "url": "https://ftp.drupal.org/files/projects/formatter_suite-8.x-1.3.zip", - "reference": "8.x-1.3", - "shasum": "ac7bd151141e4b362d02744e8ea125d7e6919af2" - }, - "require": { - "drupal/core": "^8.8 || ^9" - }, - "type": "drupal-module", - "extra": { - "drupal": { - "version": "8.x-1.3", - "datestamp": "1595830765", - "security-coverage": { - "status": "covered", - "message": "Covered by Drupal's security advisory policy" - } - } - }, - "notification-url": "https://packages.drupal.org/8/downloads", - "license": [ - "GPL-2.0-or-later" - ], - "authors": [ - { - "name": "nadeau", - "homepage": "https://www.drupal.org/user/103422" - }, - { - "name": "toamit", - "homepage": "https://www.drupal.org/user/2820523" - } - ], - "description": "Field formaters to present numbers, text, links, etc.", - "homepage": "https://www.drupal.org/project/formatter_suite", - "keywords": [ - "Drupal", - "Format" - ], - "support": { - "source": "http://cgit.drupalcode.org/formatter_suite", - "issues": "http://drupal.org/project/issues/formatter_suite" - } - }, { "name": "drupal/geocoder", "version": "3.25.0", @@ -5716,17 +5662,17 @@ }, { "name": "drupal/geofield", - "version": "1.36.0", + "version": "1.38.0", "source": { "type": "git", "url": "https://git.drupalcode.org/project/geofield.git", - "reference": "8.x-1.36" + "reference": "8.x-1.38" }, "dist": { "type": "zip", - "url": "https://ftp.drupal.org/files/projects/geofield-8.x-1.36.zip", - "reference": "8.x-1.36", - "shasum": "4aa5f6b6f60f33506a7044f11d7ed68bd4e75009" + "url": "https://ftp.drupal.org/files/projects/geofield-8.x-1.38.zip", + "reference": "8.x-1.38", + "shasum": "a41ce66e4aab2c266a8e9f0addcac68a0b76f44b" }, "require": { "drupal/core": "^8.8 || ^9", @@ -5735,8 +5681,8 @@ "type": "drupal-module", "extra": { "drupal": { - "version": "8.x-1.36", - "datestamp": "1641134825", + "version": "8.x-1.38", + "datestamp": "1646604411", "security-coverage": { "status": "covered", "message": "Covered by Drupal's security advisory policy" @@ -6045,17 +5991,17 @@ }, { "name": "drupal/inline_entity_form", - "version": "1.0.0-rc9", + "version": "1.0.0-rc11", "source": { "type": "git", "url": "https://git.drupalcode.org/project/inline_entity_form.git", - "reference": "8.x-1.0-rc9" + "reference": "8.x-1.0-rc11" }, "dist": { "type": "zip", - "url": "https://ftp.drupal.org/files/projects/inline_entity_form-8.x-1.0-rc9.zip", - "reference": "8.x-1.0-rc9", - "shasum": "78953103a9c6e4e44bc877820a35f39913ea4559" + "url": "https://ftp.drupal.org/files/projects/inline_entity_form-8.x-1.0-rc11.zip", + "reference": "8.x-1.0-rc11", + "shasum": "67a92ec1482be19b2f2091ca9498f585e34072b9" }, "require": { "drupal/core": "^8.8 || ^9", @@ -6067,8 +6013,8 @@ "type": "drupal-module", "extra": { "drupal": { - "version": "8.x-1.0-rc9", - "datestamp": "1618174486", + "version": "8.x-1.0-rc11", + "datestamp": "1648748863", "security-coverage": { "status": "not-covered", "message": "RC releases are not covered by Drupal security advisories." @@ -6656,17 +6602,17 @@ }, { "name": "drupal/leaflet", - "version": "2.1.20", + "version": "2.1.23", "source": { "type": "git", "url": "https://git.drupalcode.org/project/leaflet.git", - "reference": "2.1.20" + "reference": "2.1.23" }, "dist": { "type": "zip", - "url": "https://ftp.drupal.org/files/projects/leaflet-2.1.20.zip", - "reference": "2.1.20", - "shasum": "fd473626341bd83f55e80530ba08b7ce55ddafc7" + "url": "https://ftp.drupal.org/files/projects/leaflet-2.1.23.zip", + "reference": "2.1.23", + "shasum": "ae488b28c40e73fd589f088dee3ada293cb0232e" }, "require": { "drupal/core": "^8.8 || ^9", @@ -6675,8 +6621,8 @@ "type": "drupal-module", "extra": { "drupal": { - "version": "2.1.20", - "datestamp": "1643578866", + "version": "2.1.23", + "datestamp": "1648934436", "security-coverage": { "status": "covered", "message": "Covered by Drupal's security advisory policy" @@ -6930,17 +6876,17 @@ }, { "name": "drupal/linkit", - "version": "6.0.0-beta3", + "version": "5.0.0-beta13", "source": { "type": "git", "url": "https://git.drupalcode.org/project/linkit.git", - "reference": "6.0.0-beta3" + "reference": "8.x-5.0-beta13" }, "dist": { "type": "zip", - "url": "https://ftp.drupal.org/files/projects/linkit-6.0.0-beta3.zip", - "reference": "6.0.0-beta3", - "shasum": "39a5bf54cbc88324d788a573df7b3fecf7622065" + "url": "https://ftp.drupal.org/files/projects/linkit-8.x-5.0-beta13.zip", + "reference": "8.x-5.0-beta13", + "shasum": "9215fbea84166cabc9b7a2d9a04dedaffb9fc1ed" }, "require": { "drupal/core": "^8.7.7 || ^9" @@ -6951,8 +6897,8 @@ "type": "drupal-module", "extra": { "drupal": { - "version": "6.0.0-beta3", - "datestamp": "1632946984", + "version": "8.x-5.0-beta13", + "datestamp": "1632946970", "security-coverage": { "status": "not-covered", "message": "Beta releases are not covered by Drupal security advisories." @@ -7185,17 +7131,17 @@ }, { "name": "drupal/matomo", - "version": "1.14.0", + "version": "1.17.0", "source": { "type": "git", "url": "https://git.drupalcode.org/project/matomo.git", - "reference": "8.x-1.14" + "reference": "8.x-1.17" }, "dist": { "type": "zip", - "url": "https://ftp.drupal.org/files/projects/matomo-8.x-1.14.zip", - "reference": "8.x-1.14", - "shasum": "d098510f86002376fd0cd5970280c45faba7d8cb" + "url": "https://ftp.drupal.org/files/projects/matomo-8.x-1.17.zip", + "reference": "8.x-1.17", + "shasum": "091f946ec7a09d6b4463e5d75adca9cdcdff2918" }, "require": { "drupal/core": "^8.8.0 || ^9.0.0" @@ -7211,8 +7157,8 @@ "type": "drupal-module", "extra": { "drupal": { - "version": "8.x-1.14", - "datestamp": "1639155906", + "version": "8.x-1.17", + "datestamp": "1647206848", "security-coverage": { "status": "covered", "message": "Covered by Drupal's security advisory policy" @@ -7249,17 +7195,17 @@ }, { "name": "drupal/maxlength", - "version": "2.0.0-rc1", + "version": "1.0.0-rc1", "source": { "type": "git", "url": "https://git.drupalcode.org/project/maxlength.git", - "reference": "2.0.0-rc1" + "reference": "8.x-1.0-rc1" }, "dist": { "type": "zip", - "url": "https://ftp.drupal.org/files/projects/maxlength-2.0.0-rc1.zip", - "reference": "2.0.0-rc1", - "shasum": "1d08a0a49b36b8593be203fc3c423dd29647fc4b" + "url": "https://ftp.drupal.org/files/projects/maxlength-8.x-1.0-rc1.zip", + "reference": "8.x-1.0-rc1", + "shasum": "44eb9d79d9814cd786c2c9874c28033759665a99" }, "require": { "drupal/core": "^8.8 || ^9" @@ -7267,8 +7213,8 @@ "type": "drupal-module", "extra": { "drupal": { - "version": "2.0.0-rc1", - "datestamp": "1634070330", + "version": "8.x-1.0-rc1", + "datestamp": "1593198218", "security-coverage": { "status": "not-covered", "message": "RC releases are not covered by Drupal security advisories." @@ -7373,7 +7319,7 @@ "source": { "type": "git", "url": "https://git.drupalcode.org/project/menu_block.git", - "reference": "17bc5a2094dec85a921fdac6aff0030bfe004744" + "reference": "f2b402959d5fff4668bef410bb5bf3bbc6755abb" }, "require": { "drupal/core": "^8 || ^9" @@ -7384,8 +7330,8 @@ "dev-1.x": "1.x-dev" }, "drupal": { - "version": "8.x-1.6+9-dev", - "datestamp": "1612055345", + "version": "8.x-1.7+5-dev", + "datestamp": "1647567907", "security-coverage": { "status": "not-covered", "message": "Dev releases are not covered by Drupal security advisories." @@ -7749,17 +7695,17 @@ }, { "name": "drupal/pagerer", - "version": "2.2.0", + "version": "2.3.0", "source": { "type": "git", "url": "https://git.drupalcode.org/project/pagerer.git", - "reference": "8.x-2.2" + "reference": "8.x-2.3" }, "dist": { "type": "zip", - "url": "https://ftp.drupal.org/files/projects/pagerer-8.x-2.2.zip", - "reference": "8.x-2.2", - "shasum": "e7c8479a38df9bc9b86304e778a3be42db3fdb17" + "url": "https://ftp.drupal.org/files/projects/pagerer-8.x-2.3.zip", + "reference": "8.x-2.3", + "shasum": "acb58870c16bd4eb88a9e13e4fb28020d17b0bb5" }, "require": { "drupal/core": "^9.2", @@ -7769,8 +7715,8 @@ "type": "drupal-module", "extra": { "drupal": { - "version": "8.x-2.2", - "datestamp": "1640209287", + "version": "8.x-2.3", + "datestamp": "1647175550", "security-coverage": { "status": "covered", "message": "Covered by Drupal's security advisory policy" @@ -8042,10 +7988,10 @@ "source": { "type": "git", "url": "https://git.drupalcode.org/project/paragraphs.git", - "reference": "d366e7a88adb2355bd0d39f8bbba7dfddd2f4e49" + "reference": "80e4c5bfbfbf27d4cb59a228c0011ce81496ba76" }, "require": { - "drupal/core": "^8.8 || ^9", + "drupal/core": "^9.2", "drupal/entity_reference_revisions": "~1.3" }, "require-dev": { @@ -8070,8 +8016,8 @@ "dev-1.x": "1.x-dev" }, "drupal": { - "version": "8.x-1.12+23-dev", - "datestamp": "1639568824", + "version": "8.x-1.13+5-dev", + "datestamp": "1646129836", "security-coverage": { "status": "not-covered", "message": "Dev releases are not covered by Drupal security advisories." @@ -8233,17 +8179,17 @@ }, { "name": "drupal/pathologic", - "version": "1.0.0-alpha2", + "version": "1.0.0-alpha3", "source": { "type": "git", "url": "https://git.drupalcode.org/project/pathologic.git", - "reference": "8.x-1.0-alpha2" + "reference": "8.x-1.0-alpha3" }, "dist": { "type": "zip", - "url": "https://ftp.drupal.org/files/projects/pathologic-8.x-1.0-alpha2.zip", - "reference": "8.x-1.0-alpha2", - "shasum": "5b1b6846ab72e24a90dcd4cafbe855fba069e56b" + "url": "https://ftp.drupal.org/files/projects/pathologic-8.x-1.0-alpha3.zip", + "reference": "8.x-1.0-alpha3", + "shasum": "efcbbaccc24168e2fb30eb441e99ce330bde3321" }, "require": { "drupal/core": "^8 || ^9" @@ -8251,8 +8197,8 @@ "type": "drupal-module", "extra": { "drupal": { - "version": "8.x-1.0-alpha2", - "datestamp": "1593911470", + "version": "8.x-1.0-alpha3", + "datestamp": "1646804076", "security-coverage": { "status": "not-covered", "message": "Alpha releases are not covered by Drupal security advisories." @@ -8585,7 +8531,7 @@ "extra": { "drupal": { "version": "8.x-1.2", - "datestamp": "1644486753", + "datestamp": "1644487627", "security-coverage": { "status": "covered", "message": "Covered by Drupal's security advisory policy" @@ -8776,17 +8722,17 @@ }, { "name": "drupal/smart_date", - "version": "3.5.0", + "version": "3.5.1", "source": { "type": "git", "url": "https://git.drupalcode.org/project/smart_date.git", - "reference": "3.5.0" + "reference": "3.5.1" }, "dist": { "type": "zip", - "url": "https://ftp.drupal.org/files/projects/smart_date-3.5.0.zip", - "reference": "3.5.0", - "shasum": "4f60c10c1efbb12da4f6e732a5aef3a095e806a7" + "url": "https://ftp.drupal.org/files/projects/smart_date-3.5.1.zip", + "reference": "3.5.1", + "shasum": "bebf090fee43ce53469146a07676b0a844bbcd8d" }, "require": { "drupal/core": "^8 || ^9", @@ -8799,8 +8745,8 @@ "type": "drupal-module", "extra": { "drupal": { - "version": "3.5.0", - "datestamp": "1643119102", + "version": "3.5.1", + "datestamp": "1646337034", "security-coverage": { "status": "covered", "message": "Covered by Drupal's security advisory policy" @@ -9099,32 +9045,26 @@ }, { "name": "drupal/synonyms", - "version": "2.1.0", + "version": "dev-1.x", "source": { "type": "git", "url": "https://git.drupalcode.org/project/synonyms.git", - "reference": "2.1.0" - }, - "dist": { - "type": "zip", - "url": "https://ftp.drupal.org/files/projects/synonyms-2.1.0.zip", - "reference": "2.1.0", - "shasum": "8b2c28b864e4012fce184cc8acc914276b3b40cd" + "reference": "d9c7956405622c5630284f15633845771e84ae54" }, "require": { - "drupal/core": "^9 || ^10" - }, - "require-dev": { - "drupal/synonyms_list_field": "*" + "drupal/core": "^8 || ^9" }, "type": "drupal-module", "extra": { + "branch-alias": { + "dev-1.x": "1.x-dev" + }, "drupal": { - "version": "2.1.0", - "datestamp": "1641244507", + "version": "8.x-1.0-alpha3+4-dev", + "datestamp": "1613107043", "security-coverage": { - "status": "covered", - "message": "Covered by Drupal's security advisory policy" + "status": "not-covered", + "message": "Dev releases are not covered by Drupal security advisories." } } }, @@ -9134,30 +9074,26 @@ ], "authors": [ { - "name": "Bojan Zivanovic", - "homepage": "https://www.drupal.org/u/bojanz", - "role": "Author and D5, D6 and D7 versions developer." + "name": "Zen", + "homepage": "https://www.drupal.org/user/21209" }, { - "name": "Alex Trosenko", - "homepage": "https://www.drupal.org/u/bucefal91", - "role": "D7 and D8 versions developer." + "name": "bojanz", + "homepage": "https://www.drupal.org/user/86106" }, { - "name": "Duro Arezina", - "homepage": "https://www.drupal.org/u/devad", - "role": "D8, D9 and D10 versions maintenance" + "name": "bucefal91", + "homepage": "https://www.drupal.org/user/504128" }, { - "name": "See other contributors", - "homepage": "https://www.drupal.org/node/148775/committers" + "name": "devad", + "homepage": "https://www.drupal.org/user/2268520" } ], - "description": "Provides synonyms feature for all entities.", + "description": "Provides synonyms feature for content entities.", "homepage": "https://www.drupal.org/project/synonyms", "support": { - "source": "https://git.drupalcode.org/project/synonyms", - "issues": "https://www.drupal.org/project/issues/synonyms" + "source": "https://git.drupalcode.org/project/synonyms" } }, { @@ -9619,17 +9555,17 @@ }, { "name": "drupal/views_bulk_operations", - "version": "4.0.1", + "version": "3.13.0", "source": { "type": "git", "url": "https://git.drupalcode.org/project/views_bulk_operations.git", - "reference": "4.0.1" + "reference": "8.x-3.13" }, "dist": { "type": "zip", - "url": "https://ftp.drupal.org/files/projects/views_bulk_operations-4.0.1.zip", - "reference": "4.0.1", - "shasum": "dfcd54a002ae6c9b156702c03601fa89121c777f" + "url": "https://ftp.drupal.org/files/projects/views_bulk_operations-8.x-3.13.zip", + "reference": "8.x-3.13", + "shasum": "70583d08b91be3b5e008f571589425c2176eb73b" }, "require": { "drupal/core": "^8.8 || ^9" @@ -9643,8 +9579,8 @@ "type": "drupal-module", "extra": { "drupal": { - "version": "4.0.1", - "datestamp": "1642845502", + "version": "8.x-3.13", + "datestamp": "1619697066", "security-coverage": { "status": "covered", "message": "Covered by Drupal's security advisory policy" @@ -9823,16 +9759,16 @@ }, { "name": "drush/drush", - "version": "10.6.1", + "version": "10.6.2", "source": { "type": "git", "url": "https://github.com/drush-ops/drush.git", - "reference": "d36bca3322555a6f94edc94439873afcde2bbe90" + "reference": "0a570a16ec63259eb71195aba5feab532318b337" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/drush-ops/drush/zipball/d36bca3322555a6f94edc94439873afcde2bbe90", - "reference": "d36bca3322555a6f94edc94439873afcde2bbe90", + "url": "https://api.github.com/repos/drush-ops/drush/zipball/0a570a16ec63259eb71195aba5feab532318b337", + "reference": "0a570a16ec63259eb71195aba5feab532318b337", "shasum": "" }, "require": { @@ -9850,7 +9786,7 @@ "league/container": "^2.5 || ^3.4", "php": ">=7.1.3", "psr/log": "~1.0", - "psy/psysh": "~0.6", + "psy/psysh": ">=0.6 <0.11", "symfony/event-dispatcher": "^3.4 || ^4.0", "symfony/finder": "^3.4 || ^4.0 || ^5", "symfony/var-dumper": "^3.4 || ^4.0 || ^5.0", @@ -9956,7 +9892,7 @@ "irc": "irc://irc.freenode.org/drush", "issues": "https://github.com/drush-ops/drush/issues", "slack": "https://drupal.slack.com/messages/C62H9CWQM", - "source": "https://github.com/drush-ops/drush/tree/10.6.1" + "source": "https://github.com/drush-ops/drush/tree/10.6.2" }, "funding": [ { @@ -9964,7 +9900,7 @@ "type": "github" } ], - "time": "2021-10-05T11:14:14+00:00" + "time": "2021-12-15T17:09:54+00:00" }, { "name": "egulias/email-validator", @@ -10036,30 +9972,30 @@ }, { "name": "enlightn/security-checker", - "version": "v1.9.0", + "version": "v1.10.0", "source": { "type": "git", "url": "https://github.com/enlightn/security-checker.git", - "reference": "dc5bce653fa4d9c792e9dcffa728c0642847c1e1" + "reference": "196bacc76e7a72a63d0e1220926dbb190272db97" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/enlightn/security-checker/zipball/dc5bce653fa4d9c792e9dcffa728c0642847c1e1", - "reference": "dc5bce653fa4d9c792e9dcffa728c0642847c1e1", + "url": "https://api.github.com/repos/enlightn/security-checker/zipball/196bacc76e7a72a63d0e1220926dbb190272db97", + "reference": "196bacc76e7a72a63d0e1220926dbb190272db97", "shasum": "" }, "require": { "ext-json": "*", "guzzlehttp/guzzle": "^6.3|^7.0", "php": ">=5.6", - "symfony/console": "^3.4|^4|^5", - "symfony/finder": "^3|^4|^5", - "symfony/process": "^3.4|^4|^5", - "symfony/yaml": "^3.4|^4|^5" + "symfony/console": "^3.4|^4|^5|^6", + "symfony/finder": "^3|^4|^5|^6", + "symfony/process": "^3.4|^4|^5|^6", + "symfony/yaml": "^3.4|^4|^5|^6" }, "require-dev": { "ext-zip": "*", - "friendsofphp/php-cs-fixer": "^2.18", + "friendsofphp/php-cs-fixer": "^2.18|^3.0", "phpunit/phpunit": "^5.5|^6|^7|^8|^9" }, "bin": [ @@ -10096,9 +10032,9 @@ ], "support": { "issues": "https://github.com/enlightn/security-checker/issues", - "source": "https://github.com/enlightn/security-checker/tree/v1.9.0" + "source": "https://github.com/enlightn/security-checker/tree/v1.10.0" }, - "time": "2021-05-06T09:03:35+00:00" + "time": "2022-02-21T22:40:16+00:00" }, { "name": "fileeye/mimemap", @@ -10544,12 +10480,12 @@ } }, "autoload": { - "psr-4": { - "GuzzleHttp\\Promise\\": "src/" - }, "files": [ "src/functions_include.php" - ] + ], + "psr-4": { + "GuzzleHttp\\Promise\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -10603,16 +10539,16 @@ }, { "name": "guzzlehttp/psr7", - "version": "1.8.3", + "version": "1.8.5", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "1afdd860a2566ed3c2b0b4a3de6e23434a79ec85" + "reference": "337e3ad8e5716c15f9657bd214d16cc5e69df268" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/1afdd860a2566ed3c2b0b4a3de6e23434a79ec85", - "reference": "1afdd860a2566ed3c2b0b4a3de6e23434a79ec85", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/337e3ad8e5716c15f9657bd214d16cc5e69df268", + "reference": "337e3ad8e5716c15f9657bd214d16cc5e69df268", "shasum": "" }, "require": { @@ -10693,7 +10629,7 @@ ], "support": { "issues": "https://github.com/guzzle/psr7/issues", - "source": "https://github.com/guzzle/psr7/tree/1.8.3" + "source": "https://github.com/guzzle/psr7/tree/1.8.5" }, "funding": [ { @@ -10709,7 +10645,7 @@ "type": "tidelift" } ], - "time": "2021-10-05T13:56:00+00:00" + "time": "2022-03-20T21:51:18+00:00" }, { "name": "kint-php/kint", @@ -11163,16 +11099,16 @@ }, { "name": "lsolesen/pel", - "version": "0.9.11", + "version": "0.9.12", "source": { "type": "git", "url": "https://github.com/pel/pel.git", - "reference": "3229f133f9403894fd77de7832b25aead8164221" + "reference": "b95fe29cdacf9d36330da277f10910a13648c84c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pel/pel/zipball/3229f133f9403894fd77de7832b25aead8164221", - "reference": "3229f133f9403894fd77de7832b25aead8164221", + "url": "https://api.github.com/repos/pel/pel/zipball/b95fe29cdacf9d36330da277f10910a13648c84c", + "reference": "b95fe29cdacf9d36330da277f10910a13648c84c", "shasum": "" }, "require": { @@ -11217,9 +11153,9 @@ ], "support": { "issues": "https://github.com/pel/pel/issues", - "source": "https://github.com/pel/pel/tree/0.9.11" + "source": "https://github.com/pel/pel/tree/0.9.12" }, - "time": "2022-02-04T15:03:47+00:00" + "time": "2022-02-18T13:20:54+00:00" }, { "name": "masterminds/html5", @@ -11805,16 +11741,16 @@ }, { "name": "php-http/httplug", - "version": "2.2.0", + "version": "2.3.0", "source": { "type": "git", "url": "https://github.com/php-http/httplug.git", - "reference": "191a0a1b41ed026b717421931f8d3bd2514ffbf9" + "reference": "f640739f80dfa1152533976e3c112477f69274eb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-http/httplug/zipball/191a0a1b41ed026b717421931f8d3bd2514ffbf9", - "reference": "191a0a1b41ed026b717421931f8d3bd2514ffbf9", + "url": "https://api.github.com/repos/php-http/httplug/zipball/f640739f80dfa1152533976e3c112477f69274eb", + "reference": "f640739f80dfa1152533976e3c112477f69274eb", "shasum": "" }, "require": { @@ -11861,9 +11797,9 @@ ], "support": { "issues": "https://github.com/php-http/httplug/issues", - "source": "https://github.com/php-http/httplug/tree/master" + "source": "https://github.com/php-http/httplug/tree/2.3.0" }, - "time": "2020-07-13T15:43:23+00:00" + "time": "2022-02-21T09:52:22+00:00" }, { "name": "php-http/message", @@ -12052,16 +11988,16 @@ }, { "name": "phpmailer/phpmailer", - "version": "v6.5.4", + "version": "v6.6.0", "source": { "type": "git", "url": "https://github.com/PHPMailer/PHPMailer.git", - "reference": "c0d9f7dd3c2aa247ca44791e9209233829d82285" + "reference": "e43bac82edc26ca04b36143a48bde1c051cfd5b1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/c0d9f7dd3c2aa247ca44791e9209233829d82285", - "reference": "c0d9f7dd3c2aa247ca44791e9209233829d82285", + "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/e43bac82edc26ca04b36143a48bde1c051cfd5b1", + "reference": "e43bac82edc26ca04b36143a48bde1c051cfd5b1", "shasum": "" }, "require": { @@ -12118,7 +12054,7 @@ "description": "PHPMailer is a full-featured email creation and transfer class for PHP", "support": { "issues": "https://github.com/PHPMailer/PHPMailer/issues", - "source": "https://github.com/PHPMailer/PHPMailer/tree/v6.5.4" + "source": "https://github.com/PHPMailer/PHPMailer/tree/v6.6.0" }, "funding": [ { @@ -12126,7 +12062,7 @@ "type": "github" } ], - "time": "2022-02-17T08:19:04+00:00" + "time": "2022-02-28T15:31:21+00:00" }, { "name": "psr/cache", @@ -12437,29 +12373,29 @@ }, { "name": "psy/psysh", - "version": "v0.11.1", + "version": "v0.10.12", "source": { "type": "git", "url": "https://github.com/bobthecow/psysh.git", - "reference": "570292577277f06f590635381a7f761a6cf4f026" + "reference": "a0d9981aa07ecfcbea28e4bfa868031cca121e7d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/bobthecow/psysh/zipball/570292577277f06f590635381a7f761a6cf4f026", - "reference": "570292577277f06f590635381a7f761a6cf4f026", + "url": "https://api.github.com/repos/bobthecow/psysh/zipball/a0d9981aa07ecfcbea28e4bfa868031cca121e7d", + "reference": "a0d9981aa07ecfcbea28e4bfa868031cca121e7d", "shasum": "" }, "require": { "ext-json": "*", "ext-tokenizer": "*", - "nikic/php-parser": "^4.0 || ^3.1", - "php": "^8.0 || ^7.0.8", - "symfony/console": "^6.0 || ^5.0 || ^4.0 || ^3.4", - "symfony/var-dumper": "^6.0 || ^5.0 || ^4.0 || ^3.4" + "nikic/php-parser": "~4.0|~3.0|~2.0|~1.3", + "php": "^8.0 || ^7.0 || ^5.5.9", + "symfony/console": "~5.0|~4.0|~3.0|^2.4.2|~2.3.10", + "symfony/var-dumper": "~5.0|~4.0|~3.0|~2.7" }, "require-dev": { "bamarni/composer-bin-plugin": "^1.2", - "hoa/console": "3.17.05.02" + "hoa/console": "3.17.*" }, "suggest": { "ext-pcntl": "Enabling the PCNTL extension makes PsySH a lot happier :)", @@ -12474,7 +12410,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "0.11.x-dev" + "dev-main": "0.10.x-dev" } }, "autoload": { @@ -12506,9 +12442,9 @@ ], "support": { "issues": "https://github.com/bobthecow/psysh/issues", - "source": "https://github.com/bobthecow/psysh/tree/v0.11.1" + "source": "https://github.com/bobthecow/psysh/tree/v0.10.12" }, - "time": "2022-01-03T13:58:38+00:00" + "time": "2021-11-30T14:05:36+00:00" }, { "name": "ralouphie/getallheaders", @@ -13235,16 +13171,16 @@ }, { "name": "symfony/dom-crawler", - "version": "v4.4.37", + "version": "v4.4.39", "source": { "type": "git", "url": "https://github.com/symfony/dom-crawler.git", - "reference": "60d36408a3a48500bcc6e30d9f831e51d04d7fa4" + "reference": "4e9215a8b533802ba84a3cc5bd3c43103e7a6dc3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/60d36408a3a48500bcc6e30d9f831e51d04d7fa4", - "reference": "60d36408a3a48500bcc6e30d9f831e51d04d7fa4", + "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/4e9215a8b533802ba84a3cc5bd3c43103e7a6dc3", + "reference": "4e9215a8b533802ba84a3cc5bd3c43103e7a6dc3", "shasum": "" }, "require": { @@ -13289,7 +13225,7 @@ "description": "Eases DOM navigation for HTML and XML documents", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/dom-crawler/tree/v4.4.37" + "source": "https://github.com/symfony/dom-crawler/tree/v4.4.39" }, "funding": [ { @@ -13305,7 +13241,7 @@ "type": "tidelift" } ], - "time": "2022-01-02T09:41:36+00:00" + "time": "2022-02-25T10:38:15+00:00" }, { "name": "symfony/error-handler", @@ -13540,16 +13476,16 @@ }, { "name": "symfony/filesystem", - "version": "v4.4.37", + "version": "v4.4.39", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "c59f37705c3e513ae55b2735f128f4ce363c82ec" + "reference": "72a5b35fecaa670b13954e6eaf414acbe2a67b35" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/c59f37705c3e513ae55b2735f128f4ce363c82ec", - "reference": "c59f37705c3e513ae55b2735f128f4ce363c82ec", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/72a5b35fecaa670b13954e6eaf414acbe2a67b35", + "reference": "72a5b35fecaa670b13954e6eaf414acbe2a67b35", "shasum": "" }, "require": { @@ -13583,7 +13519,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v4.4.37" + "source": "https://github.com/symfony/filesystem/tree/v4.4.39" }, "funding": [ { @@ -13599,7 +13535,7 @@ "type": "tidelift" } ], - "time": "2022-01-02T09:41:36+00:00" + "time": "2022-02-25T10:38:15+00:00" }, { "name": "symfony/finder", @@ -14027,12 +13963,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -14408,7 +14344,7 @@ }, { "name": "symfony/polyfill-php72", - "version": "v1.24.0", + "version": "v1.25.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php72.git", @@ -14464,7 +14400,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php72/tree/v1.24.0" + "source": "https://github.com/symfony/polyfill-php72/tree/v1.25.0" }, "funding": [ { @@ -14484,7 +14420,7 @@ }, { "name": "symfony/polyfill-php73", - "version": "v1.24.0", + "version": "v1.25.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php73.git", @@ -14543,7 +14479,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.24.0" + "source": "https://github.com/symfony/polyfill-php73/tree/v1.25.0" }, "funding": [ { @@ -14646,7 +14582,7 @@ }, { "name": "symfony/polyfill-php81", - "version": "v1.24.0", + "version": "v1.25.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php81.git", @@ -14705,7 +14641,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php81/tree/v1.24.0" + "source": "https://github.com/symfony/polyfill-php81/tree/v1.25.0" }, "funding": [ { @@ -16004,7 +15940,6 @@ "drupal/email_registration": 5, "drupal/entity_browser_enhanced": 5, "drupal/entity_clone": 15, - "drupal/field_group": 20, "drupal/filefield_sources": 20, "drupal/filter_perms": 20, "drupal/inline_entity_form": 5, @@ -16018,7 +15953,7 @@ "drupal/pathologic": 15, "drupal/profile": 5, "drupal/smtp": 10, - "drupal/synonyms": 10, + "drupal/synonyms": 20, "drupal/translation_views": 15, "drupal/ultimate_cron": 15 }, @@ -16026,5 +15961,5 @@ "prefer-lowest": false, "platform": [], "platform-dev": [], - "plugin-api-version": "2.0.0" + "plugin-api-version": "2.1.0" } diff --git a/old.vendor/ajgl/breakpoint-twig-extension/.github/workflows/tests.yaml b/old.vendor/ajgl/breakpoint-twig-extension/.github/workflows/tests.yaml new file mode 100644 index 00000000..90487262 --- /dev/null +++ b/old.vendor/ajgl/breakpoint-twig-extension/.github/workflows/tests.yaml @@ -0,0 +1,47 @@ +name: tests + +on: + push: + pull_request: + +jobs: + tests: + runs-on: ubuntu-latest + continue-on-error: ${{ matrix.allow_failure }} + strategy: + fail-fast: false + matrix: + php: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0'] + stability: ['prefer-lowest', 'prefer-stable'] + allow_failure: [false] + include: + - php: '8.0' + stability: 'dev' + allow_failure: true + + name: ${{ matrix.php }}-${{ matrix.stability }} + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Cache dependencies + uses: actions/cache@v1 + with: + path: ~/.composer/cache/files + key: dependencies-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }} + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: none + + - name: Install dependencies + run: composer update --${{ matrix.stability }} --prefer-dist --no-interaction --no-progress + + - name: Check coding standard + run: composer lint + + - name: Execute tests + run: composer test || ${{ matrix.allow_failure }} diff --git a/old.vendor/ajgl/breakpoint-twig-extension/.gitignore b/old.vendor/ajgl/breakpoint-twig-extension/.gitignore new file mode 100644 index 00000000..25be7c4d --- /dev/null +++ b/old.vendor/ajgl/breakpoint-twig-extension/.gitignore @@ -0,0 +1,4 @@ +/vendor/ +*.cache +composer.lock +phpunit.xml diff --git a/old.vendor/ajgl/breakpoint-twig-extension/.php_cs.dist b/old.vendor/ajgl/breakpoint-twig-extension/.php_cs.dist new file mode 100644 index 00000000..65878857 --- /dev/null +++ b/old.vendor/ajgl/breakpoint-twig-extension/.php_cs.dist @@ -0,0 +1,36 @@ + + +For the full copyright and license information, please view the LICENSE +file that was distributed with this source code. +EOF; + +return \PhpCsFixer\Config::create() + ->setRiskyAllowed(true) + ->setRules( + [ + '@Symfony' => true, + '@Symfony:risky' => true, + 'array_syntax' => array('syntax' => 'short'), + 'fully_qualified_strict_types' => true, + 'header_comment' => array('header' => $header), + 'native_function_invocation' => false, + 'ordered_imports' => [ + 'imports_order' => ['class', 'const', 'function'], + ], + 'phpdoc_order' => true, + 'psr4' => true, + 'strict_comparison' => true, + 'strict_param' => true, + ] + ) + ->setFinder( + \PhpCsFixer\Finder::create() + ->in(__DIR__.'/src') + ->in(__DIR__.'/tests') + ) +; diff --git a/old.vendor/ajgl/breakpoint-twig-extension/CHANGELOG.md b/old.vendor/ajgl/breakpoint-twig-extension/CHANGELOG.md new file mode 100644 index 00000000..337f00c3 --- /dev/null +++ b/old.vendor/ajgl/breakpoint-twig-extension/CHANGELOG.md @@ -0,0 +1,68 @@ +# [CHANGELOG](http://keepachangelog.com/) +All notable changes to this project will be documented in this file. +This project adheres to [Semantic Versioning](http://semver.org/). + +## [Unreleased][unreleased] + + +## [0.3.5] - 2021-02-08 + +### Added +- Add support for Symfony 5 +- Add support for Twig 3.x + + +## [0.3.4] - 2019-04-10 + +### Fixed +- Population of `$arguments` variable + + +## [0.3.3] - 2019-03-18 + +### Fixed +- Population of `$arguments` variable +- Usage of deprecated classes + + +## [0.3.2] - 2018-12-10 + +### Added +- Add support for Symfony 4 + +## [0.3.1] - 2017-11-20 + +### Changed +- Require PHP 5.6 + +### Fixed +- Update requirements to allow twig 2.x + + +## [0.3.0] - 2016-03-31 + +### Added +- Add `$environment` and `$context` variables +- Allow to inspect function arguments + + +## [0.2.0] - 2016-03-10 + +### Added +- Add Symfony Bundle + + +## 0.1.0 - 2016-03-09 + +### Added +- Add `breakpoint` function + + +[unreleased]: https://github.com/ajgarlag/AjglBreakpointTwigExtension/compare/0.3.5...master +[0.3.4]: https://github.com/ajgarlag/AjglBreakpointTwigExtension/compare/0.3.4...0.3.5 +[0.3.4]: https://github.com/ajgarlag/AjglBreakpointTwigExtension/compare/0.3.3...0.3.4 +[0.3.3]: https://github.com/ajgarlag/AjglBreakpointTwigExtension/compare/0.3.2...0.3.3 +[0.3.2]: https://github.com/ajgarlag/AjglBreakpointTwigExtension/compare/0.3.1...0.3.2 +[0.3.1]: https://github.com/ajgarlag/AjglBreakpointTwigExtension/compare/0.3.0...0.3.1 +[0.3.0]: https://github.com/ajgarlag/AjglBreakpointTwigExtension/compare/0.2.0...0.3.0 +[0.2.0]: https://github.com/ajgarlag/AjglBreakpointTwigExtension/compare/0.1.0...0.2.0 diff --git a/old.vendor/ajgl/breakpoint-twig-extension/LICENSE b/old.vendor/ajgl/breakpoint-twig-extension/LICENSE new file mode 100644 index 00000000..9aeafa27 --- /dev/null +++ b/old.vendor/ajgl/breakpoint-twig-extension/LICENSE @@ -0,0 +1,23 @@ +Copyright (c) 2013-2016 Antonio J. García Lagar + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the +Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions of +the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 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. diff --git a/old.vendor/ajgl/breakpoint-twig-extension/README.md b/old.vendor/ajgl/breakpoint-twig-extension/README.md new file mode 100644 index 00000000..18b2e778 --- /dev/null +++ b/old.vendor/ajgl/breakpoint-twig-extension/README.md @@ -0,0 +1,122 @@ +AjglBreakpointTwigExtension +=========================== + +The AjglBreakpointTwigExtension component allows you set breakpoints in twig templates. + +[![Build Status](https://github.com/ajgarlag/AjglBreakpointTwigExtension/workflows/tests/badge.svg?branch=master)](https://github.com/ajgarlag/AjglBreakpointTwigExtension/actions) +[![Latest Stable Version](https://poser.pugx.org/ajgl/breakpoint-twig-extension/v/stable.png)](https://packagist.org/packages/ajgl/breakpoint-twig-extension) +[![Latest Unstable Version](https://poser.pugx.org/ajgl/breakpoint-twig-extension/v/unstable.png)](https://packagist.org/packages/ajgl/breakpoint-twig-extension) +[![Total Downloads](https://poser.pugx.org/ajgl/breakpoint-twig-extension/downloads.png)](https://packagist.org/packages/ajgl/breakpoint-twig-extension) +[![Montly Downloads](https://poser.pugx.org/ajgl/breakpoint-twig-extension/d/monthly.png)](https://packagist.org/packages/ajgl/breakpoint-twig-extension) +[![Daily Downloads](https://poser.pugx.org/ajgl/breakpoint-twig-extension/d/daily.png)](https://packagist.org/packages/ajgl/breakpoint-twig-extension) +[![License](https://poser.pugx.org/ajgl/breakpoint-twig-extension/license.png)](https://packagist.org/packages/ajgl/breakpoint-twig-extension) +[![SensioLabsInsight](https://insight.sensiolabs.com/projects/e0f1276d-6ded-4a20-9b3f-1a7c77a92015/mini.png)](https://insight.sensiolabs.com/projects/e0f1276d-6ded-4a20-9b3f-1a7c77a92015) + +This component requires the [Xdebug] PHP extension to be installed. + + +Installation +------------ + +To install the latest stable version of this component, open a console and execute the following command: +``` +$ composer require ajgl/breakpoint-twig-extension +``` + + +Usage +----- + +The first step is to register the extension into the twig environment +```php +/* @var $twig Twig_Environment */ +$twig->addExtension(new Ajgl\Twig\Extension\BreakpointExtension()); +``` + +Once registered, you can call the new `breakpoint` function: +```twig + + + + + title + + + {{ breakpoint() }} + + +``` + +Once stopped, your debugger will allow you to inspect the `$environment` and `$context` variables. + +### Function arguments + +Any argument passed to the twig function will be added to the `$arguments` array, so you can inspect it easily. + +```twig + + + + + title + + + {{ breakpoint(app.user, app.session) }} + + +``` + +Symfony Bundle +-------------- + +If you want to use this extension in your Symfony application, you can enable the +Symfony Bundle included in this package. + +The bundle will register the twig extension automatically. So, once enabled, you +can insert the `breakpoint` twig function in your templates. + +### Symfony 2/3 + +```php +// app/AppKernel.php +if (in_array($this->getEnvironment(), array('dev', 'test'), true)) { + $bundles[] = new Ajgl\Twig\Extension\SymfonyBundle\AjglBreakpointTwigExtensionBundle(); +} +``` + +### Symfony 4/5 + +```php +// config/bundles.php +//... +return [ + //... + Ajgl\Twig\Extension\SymfonyBundle\AjglBreakpointTwigExtensionBundle::class => ['dev' => true] +]; +``` + +License +------- + +This component is under the MIT license. See the complete license in the [LICENSE] file. + + +Reporting an issue or a feature request +--------------------------------------- + +Issues and feature requests are tracked in the [Github issue tracker]. + + +Author Information +------------------ + +Developed with ♥ by [Antonio J. García Lagar]. + +If you find this component useful, please add a ★ in the [GitHub repository page] and/or the [Packagist package page]. + +[Xdebug]: https://xdebug.org/ +[LICENSE]: LICENSE +[Github issue tracker]: https://github.com/ajgarlag/AjglBreakpointTwigExtension/issues +[Antonio J. García Lagar]: http://aj.garcialagar.es +[GitHub repository page]: https://github.com/ajgarlag/AjglBreakpointTwigExtension +[Packagist package page]: https://packagist.org/packages/ajgl/breakpoint-twig-extension diff --git a/old.vendor/ajgl/breakpoint-twig-extension/composer.json b/old.vendor/ajgl/breakpoint-twig-extension/composer.json new file mode 100644 index 00000000..cf466f2e --- /dev/null +++ b/old.vendor/ajgl/breakpoint-twig-extension/composer.json @@ -0,0 +1,55 @@ +{ + "name": "ajgl/breakpoint-twig-extension", + "description": "Twig extension to set breakpoints", + "keywords": ["twig", "xdebug", "breakpoint"], + "homepage": "https://github.com/ajgarlag/AjglBreakpointTwigExtension", + "license": "MIT", + "authors": [ + { + "name": "Antonio J. García Lagar", + "email": "aj@garcialagar.es", + "homepage": "http://aj.garcialagar.es", + "role": "developer" + } + ], + "autoload": { + "psr-4": { "Ajgl\\Twig\\Extension\\": "src/" } + }, + "autoload-dev": { + "psr-4": { "Ajgl\\Twig\\Extension\\Tests\\": "tests/" } + }, + "require": { + "php": ">=5.6", + "twig/twig": "^1.34|^2.0|^3.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.18", + "symfony/framework-bundle": "^2.7|^3.4|^4.4|^5.2", + "symfony/phpunit-bridge": "^4.4|^5.2", + "symfony/twig-bundle": "^2.7|^3.4|^4.4|^5.2" + }, + "suggest": { + "ext-xdebug": "The Xdebug extension is required for the breakpoint to work", + "symfony/framework-bundle": "The framework bundle to integrate the extension into Symfony", + "symfony/twig-bundle": "The twig bundle to integrate the extension into Symfony" + }, + "scripts": { + "fix-cs": [ + "vendor/bin/php-cs-fixer fix --ansi" + ], + "lint": [ + "vendor/bin/php-cs-fixer fix --dry-run --ansi" + ], + "test": [ + "vendor/bin/simple-phpunit --colors=always" + ] + }, + "config": { + "sort-packages": true + }, + "extra": { + "branch-alias": { + "dev-master": "0.3.x-dev" + } + } +} diff --git a/old.vendor/ajgl/breakpoint-twig-extension/phpunit.xml.dist b/old.vendor/ajgl/breakpoint-twig-extension/phpunit.xml.dist new file mode 100644 index 00000000..ec8dc6e4 --- /dev/null +++ b/old.vendor/ajgl/breakpoint-twig-extension/phpunit.xml.dist @@ -0,0 +1,22 @@ + + + + + + ./tests + + + + + + ./src + + + + diff --git a/old.vendor/ajgl/breakpoint-twig-extension/src/BreakpointExtension.php b/old.vendor/ajgl/breakpoint-twig-extension/src/BreakpointExtension.php new file mode 100644 index 00000000..f839d683 --- /dev/null +++ b/old.vendor/ajgl/breakpoint-twig-extension/src/BreakpointExtension.php @@ -0,0 +1,49 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Ajgl\Twig\Extension; + +use Twig\Environment; +use Twig\Extension\AbstractExtension; +use Twig\TwigFunction; + +/** + * @author Antonio J. García Lagar + */ +class BreakpointExtension extends AbstractExtension +{ + public function getName() + { + return 'breakpoint'; + } + + public function getFunctions() + { + return [ + new TwigFunction('breakpoint', [$this, 'setBreakpoint'], ['needs_environment' => true, 'needs_context' => true]), + ]; + } + + /** + * If Xdebug is detected, makes the debugger break. + * + * @param Environment $environment the environment instance + * @param mixed $context variables from the Twig template + */ + public function setBreakpoint(Environment $environment, $context) + { + if (function_exists('xdebug_break')) { + $arguments = func_get_args(); + $arguments = array_slice($arguments, 2); + xdebug_break(); + } + } +} diff --git a/old.vendor/ajgl/breakpoint-twig-extension/src/SymfonyBundle/AjglBreakpointTwigExtensionBundle.php b/old.vendor/ajgl/breakpoint-twig-extension/src/SymfonyBundle/AjglBreakpointTwigExtensionBundle.php new file mode 100644 index 00000000..2caa7ca8 --- /dev/null +++ b/old.vendor/ajgl/breakpoint-twig-extension/src/SymfonyBundle/AjglBreakpointTwigExtensionBundle.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Ajgl\Twig\Extension\SymfonyBundle; + +use Symfony\Component\HttpKernel\Bundle\Bundle; + +/** + * @author Antonio J. García Lagar + */ +class AjglBreakpointTwigExtensionBundle extends Bundle +{ +} diff --git a/old.vendor/ajgl/breakpoint-twig-extension/src/SymfonyBundle/DependencyInjection/AjglBreakpointTwigExtensionExtension.php b/old.vendor/ajgl/breakpoint-twig-extension/src/SymfonyBundle/DependencyInjection/AjglBreakpointTwigExtensionExtension.php new file mode 100644 index 00000000..cf25daac --- /dev/null +++ b/old.vendor/ajgl/breakpoint-twig-extension/src/SymfonyBundle/DependencyInjection/AjglBreakpointTwigExtensionExtension.php @@ -0,0 +1,29 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Ajgl\Twig\Extension\SymfonyBundle\DependencyInjection; + +use Symfony\Component\Config\FileLocator; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Loader; +use Symfony\Component\HttpKernel\DependencyInjection\Extension; + +/** + * @author Antonio J. García Lagar + */ +class AjglBreakpointTwigExtensionExtension extends Extension +{ + public function load(array $config, ContainerBuilder $container) + { + $loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); + $loader->load('twig.xml'); + } +} diff --git a/old.vendor/ajgl/breakpoint-twig-extension/src/SymfonyBundle/Resources/config/twig.xml b/old.vendor/ajgl/breakpoint-twig-extension/src/SymfonyBundle/Resources/config/twig.xml new file mode 100644 index 00000000..e7bd8321 --- /dev/null +++ b/old.vendor/ajgl/breakpoint-twig-extension/src/SymfonyBundle/Resources/config/twig.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/old.vendor/ajgl/breakpoint-twig-extension/tests/BreakpointExtensionTest.php b/old.vendor/ajgl/breakpoint-twig-extension/tests/BreakpointExtensionTest.php new file mode 100644 index 00000000..b4316ab3 --- /dev/null +++ b/old.vendor/ajgl/breakpoint-twig-extension/tests/BreakpointExtensionTest.php @@ -0,0 +1,53 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Ajgl\Twig\Extension\Tests; + +use Ajgl\Twig\Extension\BreakpointExtension; +use PHPUnit\Framework\TestCase; +use Symfony\Bridge\PhpUnit\SetUpTearDownTrait; +use Twig\TwigFunction; + +/** + * @author Antonio J. García Lagar + */ +class BreakpointExtensionTest extends TestCase +{ + use SetUpTearDownTrait; + + /** + * @var BreakpointExtension + */ + protected $extension; + + protected function doSetUp() + { + $this->extension = new BreakpointExtension(); + } + + public function testGetName() + { + $this->assertSame('breakpoint', $this->extension->getName()); + } + + public function testGetFunctions() + { + $functions = $this->extension->getFunctions(); + $this->assertCount(1, $functions); + $function = reset($functions); + $this->assertInstanceOf(TwigFunction::class, $function); + $callable = $function->getCallable(); + $this->assertTrue(is_array($callable)); + $this->assertCount(2, $callable); + $this->assertSame($this->extension, $callable[0]); + $this->assertSame('setBreakpoint', $callable[1]); + } +} diff --git a/old.vendor/ajgl/breakpoint-twig-extension/tests/SymfonyBundle/DependencyInjection/AjglBreakpointTwigExtensionExtensionTest.php b/old.vendor/ajgl/breakpoint-twig-extension/tests/SymfonyBundle/DependencyInjection/AjglBreakpointTwigExtensionExtensionTest.php new file mode 100644 index 00000000..f3eebbf8 --- /dev/null +++ b/old.vendor/ajgl/breakpoint-twig-extension/tests/SymfonyBundle/DependencyInjection/AjglBreakpointTwigExtensionExtensionTest.php @@ -0,0 +1,53 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Ajgl\Twig\Extension\Tests\SymfonyBundle\DependencyInjection; + +use Ajgl\Twig\Extension\SymfonyBundle\DependencyInjection\AjglBreakpointTwigExtensionExtension; +use PHPUnit\Framework\TestCase; +use Symfony\Bridge\PhpUnit\SetUpTearDownTrait; +use Symfony\Component\DependencyInjection\ContainerBuilder; + +/** + * @author Antonio J. García Lagar + */ +class AjglBreakpointTwigExtensionExtensionTest extends TestCase +{ + use SetUpTearDownTrait; + + /** + * @var ContainerBuilder + */ + protected $container; + + /** + * @var AjglBreakpointTwigExtensionExtension + */ + protected $extension; + + protected function doSetUp() + { + $this->container = new ContainerBuilder(); + $this->extension = new AjglBreakpointTwigExtensionExtension(); + } + + public function testTwigExtensionsDefinition() + { + $this->extension->load([], $this->container); + $this->assertTrue($this->container->hasDefinition('ajgl_twig_extension.breakpoint')); + $definition = $this->container->getDefinition('ajgl_twig_extension.breakpoint'); + $this->assertSame( + 'Ajgl\Twig\Extension\BreakpointExtension', + $definition->getClass() + ); + $this->assertNotNull($definition->getTag('twig.extension')); + } +} diff --git a/old.vendor/alchemy/zippy/LICENSE b/old.vendor/alchemy/zippy/LICENSE new file mode 100644 index 00000000..b7247e12 --- /dev/null +++ b/old.vendor/alchemy/zippy/LICENSE @@ -0,0 +1,21 @@ +Zippy is released under the MIT License : + +Copyright (c) 2012 Alchemy + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +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. diff --git a/old.vendor/alchemy/zippy/Makefile b/old.vendor/alchemy/zippy/Makefile new file mode 100644 index 00000000..050971b0 --- /dev/null +++ b/old.vendor/alchemy/zippy/Makefile @@ -0,0 +1,17 @@ +adapters:="ZipAdapter" "ZipExtensionAdapter" "GNUTar\\TarGNUTarAdapter" "GNUTar\\TarGzGNUTarAdapter" "GNUTar\\TarBz2GNUTarAdapter" "BSDTar\\TarBSDTarAdapter" "BSDTar\\TarGzBSDTarAdapter" "BSDTar\\TarBz2BSDTarAdapter" + +.PHONY: test clean + +test: node_modules + -./tests/bootstrap.sh stop + ./tests/bootstrap.sh start + sleep 1 + ./vendor/bin/phpunit + FAILURES="";$(foreach adapter,$(adapters),ZIPPY_ADAPTER=$(adapter) ./vendor/bin/phpunit -c phpunit-functional.xml.dist || FAILURES=1;)test -z "$$FAILURES" + -./tests/bootstrap.sh stop + +node_modules: + npm install connect serve-static + +clean: + rm -rf node_modules diff --git a/old.vendor/alchemy/zippy/composer.json b/old.vendor/alchemy/zippy/composer.json new file mode 100644 index 00000000..0e21e8d1 --- /dev/null +++ b/old.vendor/alchemy/zippy/composer.json @@ -0,0 +1,49 @@ +{ + "name": "alchemy/zippy", + "type": "library", + "description": "Zippy, the archive manager companion", + "keywords": ["zip", "tar", "bzip", "compression"], + "license": "MIT", + "authors": [ + { + "name": "Alchemy", + "email": "dev.team@alchemy.fr", + "homepage": "http://www.alchemy.fr/" + } + ], + "require": { + "php": ">=5.5", + "doctrine/collections": "~1.0", + "symfony/filesystem": "^2.0.5 || ^3.0 || ^4.0", + "symfony/process": "^2.1 || ^3.0 || ^4.0", + "symfony/polyfill-mbstring": "^1.3" + }, + "require-dev": { + "ext-zip": "*", + "guzzle/guzzle": "~3.0", + "guzzlehttp/guzzle": "^6.0", + "phpunit/phpunit": "^4.0 || ^5.0", + "symfony/finder": "^2.0.5 || ^3.0 || ^4.0" + }, + "suggest": { + "ext-zip": "To use the ZipExtensionAdapter", + "guzzlehttp/guzzle": "To use the GuzzleTeleporter with Guzzle 6", + "guzzle/guzzle": "To use the GuzzleTeleporter with Guzzle 3" + }, + "autoload": { + "psr-4": { + "Alchemy\\Zippy\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "Alchemy\\Zippy\\Functional\\": "tests/Functional/", + "Alchemy\\Zippy\\Tests\\": "tests/Tests/" + } + }, + "extra": { + "branch-alias": { + "dev-master": "0.4.x-dev" + } + } +} diff --git a/old.vendor/alchemy/zippy/src/Adapter/AbstractAdapter.php b/old.vendor/alchemy/zippy/src/Adapter/AbstractAdapter.php new file mode 100644 index 00000000..e0ad2a8e --- /dev/null +++ b/old.vendor/alchemy/zippy/src/Adapter/AbstractAdapter.php @@ -0,0 +1,273 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + */ + +namespace Alchemy\Zippy\Adapter; + +use Alchemy\Zippy\Adapter\Resource\ResourceInterface; +use Alchemy\Zippy\Adapter\VersionProbe\VersionProbeInterface; +use Alchemy\Zippy\Archive\Archive; +use Alchemy\Zippy\Archive\ArchiveInterface; +use Alchemy\Zippy\Exception\RuntimeException; +use Alchemy\Zippy\Exception\InvalidArgumentException; +use Alchemy\Zippy\Resource\PathUtil; +use Alchemy\Zippy\Resource\ResourceManager; + +abstract class AbstractAdapter implements AdapterInterface +{ + /** @var ResourceManager */ + protected $manager; + + /** + * The version probe + * + * @var VersionProbeInterface + */ + protected $probe; + + public function __construct(ResourceManager $manager) + { + $this->manager = $manager; + } + + /** + * @inheritdoc + */ + public function open($path) + { + $this->requireSupport(); + + return new Archive($this->createResource($path), $this, $this->manager); + } + + /** + * @inheritdoc + */ + public function create($path, $files = null, $recursive = true) + { + $this->requireSupport(); + + return $this->doCreate($this->makeTargetAbsolute($path), $files, $recursive); + } + + /** + * @inheritdoc + */ + public function listMembers(ResourceInterface $resource) + { + $this->requireSupport(); + + return $this->doListMembers($resource); + } + + /** + * @inheritdoc + */ + public function add(ResourceInterface $resource, $files, $recursive = true) + { + $this->requireSupport(); + + return $this->doAdd($resource, $files, $recursive); + } + + /** + * @inheritdoc + */ + public function remove(ResourceInterface $resource, $files) + { + $this->requireSupport(); + + return $this->doRemove($resource, $files); + } + + /** + * @inheritdoc + */ + public function extract(ResourceInterface $resource, $to = null) + { + $this->requireSupport(); + + return $this->doExtract($resource, $to); + } + + /** + * @inheritdoc + */ + public function extractMembers(ResourceInterface $resource, $members, $to = null, $overwrite = false) + { + $this->requireSupport(); + + return $this->doExtractMembers($resource, $members, $to, $overwrite); + } + + /** + * Returns the version probe used by this adapter + * + * @return VersionProbeInterface + */ + public function getVersionProbe() + { + return $this->probe; + } + + /** + * Sets the version probe used by this adapter + * + * @param VersionProbeInterface $probe + * + * @return VersionProbeInterface + */ + public function setVersionProbe(VersionProbeInterface $probe) + { + $this->probe = $probe; + + return $this; + } + + /** + * @inheritdoc + */ + public function isSupported() + { + if (!$this->probe) { + throw new RuntimeException(sprintf( + 'No version probe has been set on %s whereas it is required', get_class($this) + )); + } + + return VersionProbeInterface::PROBE_OK === $this->probe->getStatus(); + } + + /** + * Throws an exception is the current adapter is not supported + * + * @throws RuntimeException + */ + protected function requireSupport() + { + if (false === $this->isSupported()) { + throw new RuntimeException(sprintf('%s is not supported on your system', get_class($this))); + } + } + + /** + * Change current working directory to another + * + * @param string $target the target directory + * + * @return AdapterInterface + * + * @throws RuntimeException In case of failure + */ + protected function chdir($target) + { + if (false === @chdir($target)) { + throw new RuntimeException(sprintf('Unable to chdir to `%s`', $target)); + } + + return $this; + } + + /** + * Creates a resource given a path + * + * @param string $path + * + * @return ResourceInterface + */ + abstract protected function createResource($path); + + /** + * Do the removal after having check that the current adapter is supported + * + * @param ResourceInterface $resource + * @param array $files + * + * @return array + */ + abstract protected function doRemove(ResourceInterface $resource, $files); + + /** + * Do the add after having check that the current adapter is supported + * + * @param ResourceInterface $resource + * @param array $files + * @param bool $recursive + * + * @return array + */ + abstract protected function doAdd(ResourceInterface $resource, $files, $recursive); + + /** + * Do the extract after having check that the current adapter is supported + * + * @param ResourceInterface $resource + * @param $to + * + * @return \SplFileInfo The extracted archive + */ + abstract protected function doExtract(ResourceInterface $resource, $to); + + /** + * Do the extract members after having check that the current adapter is supported + * + * @param ResourceInterface $resource + * @param string|string[] $members + * @param string $to + * @param bool $overwrite + * + * @return \SplFileInfo The extracted archive + */ + abstract protected function doExtractMembers(ResourceInterface $resource, $members, $to, $overwrite = false); + + /** + * Do the list members after having check that the current adapter is supported + * + * @param ResourceInterface $resource + * + * @return array + */ + abstract protected function doListMembers(ResourceInterface $resource); + + /** + * Do the create after having check that the current adapter is supported + * + * @param string $path + * @param string $file + * @param bool $recursive + * + * @return ArchiveInterface + */ + abstract protected function doCreate($path, $file, $recursive); + + /** + * Makes the target path absolute as the adapters might have a different directory + * + * @param string $path The path to convert + * + * @return string The absolute path + * + * @throws InvalidArgumentException In case the path is not writable or does not exist + */ + private function makeTargetAbsolute($path) + { + $directory = dirname($path); + + if (!is_dir($directory)) { + throw new InvalidArgumentException(sprintf('Target path %s does not exist.', $directory)); + } + if (!is_writable($directory)) { + throw new InvalidArgumentException(sprintf('Target path %s is not writeable.', $directory)); + } + + return realpath($directory) . '/' . PathUtil::basename($path); + } +} diff --git a/old.vendor/alchemy/zippy/src/Adapter/AbstractBinaryAdapter.php b/old.vendor/alchemy/zippy/src/Adapter/AbstractBinaryAdapter.php new file mode 100644 index 00000000..4ed40db9 --- /dev/null +++ b/old.vendor/alchemy/zippy/src/Adapter/AbstractBinaryAdapter.php @@ -0,0 +1,240 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + */ + +namespace Alchemy\Zippy\Adapter; + +use Alchemy\Zippy\Adapter\Resource\FileResource; +use Alchemy\Zippy\Archive\MemberInterface; +use Alchemy\Zippy\Exception\RuntimeException; +use Alchemy\Zippy\Exception\InvalidArgumentException; +use Alchemy\Zippy\Parser\ParserFactory; +use Alchemy\Zippy\Parser\ParserInterface; +use Alchemy\Zippy\ProcessBuilder\ProcessBuilderFactory; +use Alchemy\Zippy\ProcessBuilder\ProcessBuilderFactoryInterface; +use Alchemy\Zippy\Resource\ResourceManager; +use Symfony\Component\Process\ExecutableFinder; +use Symfony\Component\Process\ProcessBuilder; + +abstract class AbstractBinaryAdapter extends AbstractAdapter implements BinaryAdapterInterface +{ + /** + * The parser to use to parse command output + * + * @var ParserInterface + */ + protected $parser; + + /** + * The deflator process builder factory to use to build binary command line + * + * @var ProcessBuilderFactoryInterface + */ + protected $deflator; + + /** + * The inflator process builder factory to use to build binary command line + * + * @var ProcessBuilderFactoryInterface + */ + protected $inflator; + + /** + * Constructor + * + * @param ParserInterface $parser An output parser + * @param ResourceManager $manager A resource manager + * @param ProcessBuilderFactoryInterface $inflator A process builder factory for the inflator binary + * @param ProcessBuilderFactoryInterface $deflator A process builder factory for the deflator binary + */ + public function __construct( + ParserInterface $parser, + ResourceManager $manager, + ProcessBuilderFactoryInterface $inflator, + ProcessBuilderFactoryInterface $deflator + ) { + $this->parser = $parser; + parent::__construct($manager); + $this->deflator = $deflator; + $this->inflator = $inflator; + } + + /** + * @inheritdoc + */ + public function getParser() + { + return $this->parser; + } + + /** + * @inheritdoc + */ + public function setParser(ParserInterface $parser) + { + $this->parser = $parser; + + return $this; + } + + /** + * @inheritdoc + */ + public function getDeflator() + { + return $this->deflator; + } + + /** + * @inheritdoc + */ + public function getInflator() + { + return $this->inflator; + } + + /** + * @inheritdoc + */ + public function setDeflator(ProcessBuilderFactoryInterface $processBuilder) + { + $this->deflator = $processBuilder; + + return $this; + } + + public function setInflator(ProcessBuilderFactoryInterface $processBuilder) + { + $this->inflator = $processBuilder; + + return $this; + } + + /** + * @inheritdoc + */ + public function getInflatorVersion() + { + $this->requireSupport(); + + return $this->doGetInflatorVersion(); + } + + /** + * @inheritdoc + */ + public function getDeflatorVersion() + { + $this->requireSupport(); + + return $this->doGetDeflatorVersion(); + } + + /** + * Returns a new instance of the invoked adapter + * + * @param ExecutableFinder $finder + * @param ResourceManager $manager + * @param string|null $inflatorBinaryName The inflator binary name to use + * @param string|null $deflatorBinaryName The deflator binary name to use + * + * @return AbstractBinaryAdapter + */ + public static function newInstance( + ExecutableFinder $finder, + ResourceManager $manager, + $inflatorBinaryName = null, + $deflatorBinaryName = null + ) { + $inflator = $inflatorBinaryName instanceof ProcessBuilderFactoryInterface ? $inflatorBinaryName : self::findABinary($inflatorBinaryName, + static::getDefaultInflatorBinaryName(), $finder); + $deflator = $deflatorBinaryName instanceof ProcessBuilderFactoryInterface ? $deflatorBinaryName : self::findABinary($deflatorBinaryName, + static::getDefaultDeflatorBinaryName(), $finder); + + try { + $outputParser = ParserFactory::create(static::getName()); + } catch (InvalidArgumentException $e) { + throw new RuntimeException(sprintf( + 'Failed to get a new instance of %s', + get_called_class()), $e->getCode(), $e + ); + } + + if (null === $inflator) { + throw new RuntimeException(sprintf('Unable to create the inflator')); + } + + if (null === $deflator) { + throw new RuntimeException(sprintf('Unable to create the deflator')); + } + + return new static($outputParser, $manager, $inflator, $deflator); + } + + private static function findABinary($wish, array $defaults, ExecutableFinder $finder) + { + $possibles = $wish ? (array) $wish : $defaults; + + $binary = null; + + foreach ($possibles as $possible) { + if (null !== $found = $finder->find($possible)) { + $binary = new ProcessBuilderFactory($found); + break; + } + } + + return $binary; + } + + /** + * Adds files to argument list + * + * @param MemberInterface[]|\SplFileInfo[]|string[] $files An array of files + * @param ProcessBuilder $builder A Builder instance + * + * @return bool + */ + protected function addBuilderFileArgument(array $files, ProcessBuilder $builder) + { + $iterations = 0; + + array_walk($files, function($file) use ($builder, &$iterations) { + $builder->add( + $file instanceof \SplFileInfo ? + $file->getRealPath() : ($file instanceof MemberInterface ? $file->getLocation() : $file) + ); + + $iterations++; + }); + + return 0 !== $iterations; + } + + protected function createResource($path) + { + return new FileResource($path); + } + + /** + * Fetch the inflator version after having check that the current adapter is supported + * + * @return string + */ + abstract protected function doGetInflatorVersion(); + + /** + * Fetch the Deflator version after having check that the current adapter is supported + * + * @return string + */ + abstract protected function doGetDeflatorVersion(); +} diff --git a/old.vendor/alchemy/zippy/src/Adapter/AbstractTarAdapter.php b/old.vendor/alchemy/zippy/src/Adapter/AbstractTarAdapter.php new file mode 100644 index 00000000..34b3c808 --- /dev/null +++ b/old.vendor/alchemy/zippy/src/Adapter/AbstractTarAdapter.php @@ -0,0 +1,438 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Alchemy\Zippy\Adapter; + +use Alchemy\Zippy\Adapter\Resource\ResourceInterface; +use Alchemy\Zippy\Archive\Archive; +use Alchemy\Zippy\Archive\Member; +use Alchemy\Zippy\Exception\RuntimeException; +use Alchemy\Zippy\Exception\InvalidArgumentException; +use Alchemy\Zippy\Resource\Resource as ZippyResource; +use Symfony\Component\Process\Exception\ExceptionInterface as ProcessException; + +abstract class AbstractTarAdapter extends AbstractBinaryAdapter +{ + /** + * @inheritdoc + */ + protected function doCreate($path, $files, $recursive) + { + return $this->doTarCreate($this->getLocalOptions(), $path, $files, $recursive); + } + + /** + * @inheritdoc + */ + protected function doListMembers(ResourceInterface $resource) + { + return $this->doTarListMembers($this->getLocalOptions(), $resource); + } + + /** + * @inheritdoc + */ + protected function doAdd(ResourceInterface $resource, $files, $recursive) + { + return $this->doTarAdd($this->getLocalOptions(), $resource, $files, $recursive); + } + + /** + * @inheritdoc + */ + protected function doRemove(ResourceInterface $resource, $files) + { + return $this->doTarRemove($this->getLocalOptions(), $resource, $files); + } + + /** + * @inheritdoc + */ + protected function doExtractMembers(ResourceInterface $resource, $members, $to, $overwrite = false) + { + return $this->doTarExtractMembers($this->getLocalOptions(), $resource, $members, $to, $overwrite); + } + + /** + * @inheritdoc + */ + protected function doExtract(ResourceInterface $resource, $to) + { + return $this->doTarExtract($this->getLocalOptions(), $resource, $to); + } + + /** + * @inheritdoc + */ + protected function doGetInflatorVersion() + { + $process = $this + ->inflator + ->create() + ->add('--version') + ->getProcess(); + + $process->run(); + + if (!$process->isSuccessful()) { + throw new RuntimeException(sprintf( + 'Unable to execute the following command %s {output: %s}', + $process->getCommandLine(), $process->getErrorOutput() + )); + } + + return $this->parser->parseInflatorVersion($process->getOutput() ?: ''); + } + + /** + * @inheritdoc + */ + protected function doGetDeflatorVersion() + { + return $this->getInflatorVersion(); + } + + protected function doTarCreate($options, $path, $files = null, $recursive = true) + { + $files = (array) $files; + + $builder = $this + ->inflator + ->create(); + + if (!$recursive) { + $builder->add('--no-recursion'); + } + + $builder->add('-c'); + + foreach ((array) $options as $option) { + $builder->add((string) $option); + } + + if (0 === count($files)) { + $nullFile = defined('PHP_WINDOWS_VERSION_BUILD') ? 'NUL' : '/dev/null'; + + $builder->add('-f'); + $builder->add($path); + $builder->add('-T'); + $builder->add($nullFile); + + $process = $builder->getProcess(); + $process->run(); + + } else { + + $builder->add(sprintf('--file=%s', $path)); + + if (!$recursive) { + $builder->add('--no-recursion'); + } + + $collection = $this->manager->handle(getcwd(), $files); + + $builder->setWorkingDirectory($collection->getContext()); + + $collection->forAll(function($i, ZippyResource $resource) use ($builder) { + return $builder->add($resource->getTarget()); + }); + + $process = $builder->getProcess(); + + try { + $process->run(); + } catch (ProcessException $e) { + $this->manager->cleanup($collection); + throw $e; + } + + $this->manager->cleanup($collection); + } + + if (!$process->isSuccessful()) { + throw new RuntimeException(sprintf( + 'Unable to execute the following command %s {output: %s}', + $process->getCommandLine(), + $process->getErrorOutput() + )); + } + + return new Archive($this->createResource($path), $this, $this->manager); + } + + protected function doTarListMembers($options, ResourceInterface $resource) + { + $builder = $this + ->inflator + ->create(); + + foreach ($this->getListMembersOptions() as $option) { + $builder->add($option); + } + + $builder + ->add('--list') + ->add('-v') + ->add(sprintf('--file=%s', $resource->getResource())); + + foreach ((array) $options as $option) { + $builder->add((string) $option); + } + + $process = $builder->getProcess(); + $process->run(); + + if (!$process->isSuccessful()) { + throw new RuntimeException(sprintf( + 'Unable to execute the following command %s {output: %s}', + $process->getCommandLine(), + $process->getErrorOutput() + )); + } + + $members = array(); + + foreach ($this->parser->parseFileListing($process->getOutput() ?: '') as $member) { + $members[] = new Member( + $resource, + $this, + $member['location'], + $member['size'], + $member['mtime'], + $member['is_dir'] + ); + } + + return $members; + } + + protected function doTarAdd($options, ResourceInterface $resource, $files, $recursive = true) + { + $files = (array) $files; + + $builder = $this + ->inflator + ->create(); + + if (!$recursive) { + $builder->add('--no-recursion'); + } + + $builder + ->add('--append') + ->add(sprintf('--file=%s', $resource->getResource())); + + foreach ((array) $options as $option) { + $builder->add((string) $option); + } + + // there will be an issue if the file starts with a dash + // see --add-file=FILE + $collection = $this->manager->handle(getcwd(), $files); + + $builder->setWorkingDirectory($collection->getContext()); + + $collection->forAll(function($i, ZippyResource $resource) use ($builder) { + return $builder->add($resource->getTarget()); + }); + + $process = $builder->getProcess(); + + try { + $process->run(); + } catch (ProcessException $e) { + $this->manager->cleanup($collection); + throw $e; + } + + $this->manager->cleanup($collection); + + if (!$process->isSuccessful()) { + throw new RuntimeException(sprintf( + 'Unable to execute the following command %s {output: %s}', + $process->getCommandLine(), + $process->getErrorOutput() + )); + } + + return $files; + } + + protected function doTarRemove($options, ResourceInterface $resource, $files) + { + $files = (array) $files; + + $builder = $this + ->inflator + ->create(); + + $builder + ->add('--delete') + ->add(sprintf('--file=%s', $resource->getResource())); + + foreach ((array) $options as $option) { + $builder->add((string) $option); + } + + if (!$this->addBuilderFileArgument($files, $builder)) { + throw new InvalidArgumentException('Invalid files'); + } + + $process = $builder->getProcess(); + + $process->run(); + + if (!$process->isSuccessful()) { + throw new RuntimeException(sprintf( + 'Unable to execute the following command %s {output: %s}', + $process->getCommandLine(), + $process->getErrorOutput() + )); + } + + return $files; + } + + protected function doTarExtract($options, ResourceInterface $resource, $to = null) + { + if (null !== $to && !is_dir($to)) { + throw new InvalidArgumentException(sprintf("%s is not a directory", $to)); + } + + $builder = $this + ->inflator + ->create(); + + $builder + ->add('--extract') + ->add(sprintf('--file=%s', $resource->getResource())); + + foreach ($this->getExtractOptions() as $option) { + $builder + ->add($option); + } + + foreach ((array) $options as $option) { + $builder->add((string) $option); + } + + if (null !== $to) { + $builder + ->add('--directory') + ->add($to); + } + + $process = $builder->getProcess(); + + $process->run(); + + if (!$process->isSuccessful()) { + throw new RuntimeException(sprintf( + 'Unable to execute the following command %s {output: %s}', + $process->getCommandLine(), + $process->getErrorOutput() + )); + } + + return new \SplFileInfo($to ?: $resource->getResource()); + } + + /** + * @param array $options + * @param ResourceInterface $resource + * @param array $members + * @param string $to + * @param bool $overwrite + * + * @return array + */ + protected function doTarExtractMembers($options, ResourceInterface $resource, $members, $to = null, $overwrite = false) + { + if (null !== $to && !is_dir($to)) { + throw new InvalidArgumentException(sprintf("%s is not a directory", $to)); + } + + $members = (array) $members; + + $builder = $this + ->inflator + ->create(); + + if ($overwrite == false) { + $builder->add('-k'); + } + + $builder + ->add('--extract') + ->add(sprintf('--file=%s', $resource->getResource())); + + foreach ($this->getExtractMembersOptions() as $option) { + $builder + ->add($option); + } + + foreach ((array) $options as $option) { + $builder->add((string) $option); + } + + if (null !== $to) { + $builder + ->add('--directory') + ->add($to); + } + + if (!$this->addBuilderFileArgument($members, $builder)) { + throw new InvalidArgumentException('Invalid files'); + } + + $process = $builder->getProcess(); + + $process->run(); + + if (!$process->isSuccessful()) { + throw new RuntimeException(sprintf( + 'Unable to execute the following command %s {output: %s}', + $process->getCommandLine(), + $process->getErrorOutput() + )); + } + + return $members; + } + + /** + * Returns an array of option for the listMembers command + * + * @return array + */ + abstract protected function getListMembersOptions(); + + /** + * Returns an array of option for the extract command + * + * @return array + */ + abstract protected function getExtractOptions(); + + /** + * Returns an array of option for the extractMembers command + * + * @return array + */ + abstract protected function getExtractMembersOptions(); + + /** + * Gets adapter specific additional options + * + * @return array + */ + abstract protected function getLocalOptions(); +} diff --git a/old.vendor/alchemy/zippy/src/Adapter/AdapterContainer.php b/old.vendor/alchemy/zippy/src/Adapter/AdapterContainer.php new file mode 100644 index 00000000..071b6df1 --- /dev/null +++ b/old.vendor/alchemy/zippy/src/Adapter/AdapterContainer.php @@ -0,0 +1,222 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Alchemy\Zippy\Adapter; + +use Alchemy\Zippy\Adapter\BSDTar\TarBSDTarAdapter; +use Alchemy\Zippy\Adapter\BSDTar\TarBz2BSDTarAdapter; +use Alchemy\Zippy\Adapter\BSDTar\TarGzBSDTarAdapter; +use Alchemy\Zippy\Adapter\GNUTar\TarBz2GNUTarAdapter; +use Alchemy\Zippy\Adapter\GNUTar\TarGNUTarAdapter; +use Alchemy\Zippy\Adapter\GNUTar\TarGzGNUTarAdapter; +use Alchemy\Zippy\Resource\RequestMapper; +use Alchemy\Zippy\Resource\ResourceManager; +use Alchemy\Zippy\Resource\ResourceTeleporter; +use Alchemy\Zippy\Resource\TargetLocator; +use Alchemy\Zippy\Resource\TeleporterContainer; +use Symfony\Component\Filesystem\Filesystem; +use Symfony\Component\Process\ExecutableFinder; + +class AdapterContainer implements \ArrayAccess +{ + + private $items = array(); + + /** + * Builds the adapter container + * + * @return AdapterContainer + */ + public static function load() + { + $container = new static(); + + $container['zip.inflator'] = null; + $container['zip.deflator'] = null; + + $container['resource-manager'] = function($container) { + return new ResourceManager( + $container['request-mapper'], + $container['resource-teleporter'], + $container['filesystem'] + ); + }; + + $container['executable-finder'] = function($container) { + return new ExecutableFinder(); + }; + + $container['request-mapper'] = function($container) { + return new RequestMapper($container['target-locator']); + }; + + $container['target-locator'] = function() { + return new TargetLocator(); + }; + + $container['teleporter-container'] = function($container) { + return TeleporterContainer::load(); + }; + + $container['resource-teleporter'] = function($container) { + return new ResourceTeleporter($container['teleporter-container']); + }; + + $container['filesystem'] = function() { + return new Filesystem(); + }; + + $container['Alchemy\\Zippy\\Adapter\\ZipAdapter'] = function($container) { + return ZipAdapter::newInstance( + $container['executable-finder'], + $container['resource-manager'], + $container['zip.inflator'], + $container['zip.deflator'] + ); + }; + + $container['gnu-tar.inflator'] = null; + $container['gnu-tar.deflator'] = null; + + $container['Alchemy\\Zippy\\Adapter\\GNUTar\\TarGNUTarAdapter'] = function($container) { + return TarGNUTarAdapter::newInstance( + $container['executable-finder'], + $container['resource-manager'], + $container['gnu-tar.inflator'], + $container['gnu-tar.deflator'] + ); + }; + + $container['Alchemy\\Zippy\\Adapter\\GNUTar\\TarGzGNUTarAdapter'] = function($container) { + return TarGzGNUTarAdapter::newInstance( + $container['executable-finder'], + $container['resource-manager'], + $container['gnu-tar.inflator'], + $container['gnu-tar.deflator'] + ); + }; + + $container['Alchemy\\Zippy\\Adapter\\GNUTar\\TarBz2GNUTarAdapter'] = function($container) { + return TarBz2GNUTarAdapter::newInstance( + $container['executable-finder'], + $container['resource-manager'], + $container['gnu-tar.inflator'], + $container['gnu-tar.deflator'] + ); + }; + + $container['bsd-tar.inflator'] = null; + $container['bsd-tar.deflator'] = null; + + $container['Alchemy\\Zippy\\Adapter\\BSDTar\\TarBSDTarAdapter'] = function($container) { + return TarBSDTarAdapter::newInstance( + $container['executable-finder'], + $container['resource-manager'], + $container['bsd-tar.inflator'], + $container['bsd-tar.deflator'] + ); + }; + + $container['Alchemy\\Zippy\\Adapter\\BSDTar\\TarGzBSDTarAdapter'] = function($container) { + return TarGzBSDTarAdapter::newInstance( + $container['executable-finder'], + $container['resource-manager'], + $container['bsd-tar.inflator'], + $container['bsd-tar.deflator'] + ); + }; + + $container['Alchemy\\Zippy\\Adapter\\BSDTar\\TarBz2BSDTarAdapter'] = function($container) { + return TarBz2BSDTarAdapter::newInstance( + $container['executable-finder'], + $container['resource-manager'], + $container['bsd-tar.inflator'], + $container['bsd-tar.deflator']); + }; + + $container['Alchemy\\Zippy\\Adapter\\ZipExtensionAdapter'] = function() { + return ZipExtensionAdapter::newInstance(); + }; + + return $container; + } + + /** + * (PHP 5 >= 5.0.0)
+ * Whether a offset exists + * + * @link http://php.net/manual/en/arrayaccess.offsetexists.php + * + * @param mixed $offset

+ * An offset to check for. + *

+ * + * @return bool true on success or false on failure. + *

The return value will be casted to boolean if non-boolean was returned.

+ */ + public function offsetExists($offset) + { + return isset($this->items[$offset]); + } + + /** + * (PHP 5 >= 5.0.0)
+ * Offset to retrieve + * @link http://php.net/manual/en/arrayaccess.offsetget.php + * @param mixed $offset

+ * The offset to retrieve. + *

+ * @return mixed Can return all value types. + */ + public function offsetGet($offset) + { + if (array_key_exists($offset, $this->items) && is_callable($this->items[$offset])) { + $this->items[$offset] = call_user_func($this->items[$offset], $this); + } + + if (array_key_exists($offset, $this->items)) { + return $this->items[$offset]; + } + + throw new \InvalidArgumentException(); + } + + /** + * (PHP 5 >= 5.0.0)
+ * Offset to set + * @link http://php.net/manual/en/arrayaccess.offsetset.php + * @param mixed $offset

+ * The offset to assign the value to. + *

+ * @param mixed $value

+ * The value to set. + *

+ * @return void + */ + public function offsetSet($offset, $value) + { + $this->items[$offset] = $value; + } + + /** + * (PHP 5 >= 5.0.0)
+ * Offset to unset + * @link http://php.net/manual/en/arrayaccess.offsetunset.php + * @param mixed $offset

+ * The offset to unset. + *

+ * @return void + */ + public function offsetUnset($offset) + { + unset($this->items[$offset]); + } +} diff --git a/old.vendor/alchemy/zippy/src/Adapter/AdapterInterface.php b/old.vendor/alchemy/zippy/src/Adapter/AdapterInterface.php new file mode 100644 index 00000000..d73a51a7 --- /dev/null +++ b/old.vendor/alchemy/zippy/src/Adapter/AdapterInterface.php @@ -0,0 +1,133 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Alchemy\Zippy\Adapter; + +use Alchemy\Zippy\Adapter\Resource\ResourceInterface; +use Alchemy\Zippy\Archive\ArchiveInterface; +use Alchemy\Zippy\Exception\NotSupportedException; +use Alchemy\Zippy\Exception\RuntimeException; +use Alchemy\Zippy\Exception\InvalidArgumentException; + +Interface AdapterInterface +{ + /** + * Opens an archive + * + * @param string $path The path to the archive + * + * @return ArchiveInterface + * + * @throws InvalidArgumentException In case the provided path is not valid + * @throws RuntimeException In case of failure + */ + public function open($path); + + /** + * Creates a new archive + * + * Please note some adapters can not create empty archives. + * They would throw a `NotSupportedException` in case you ask to create an archive without files + * + * @param string $path The path to the archive + * @param string|string[]|\Traversable|null $files A filename, an array of files, or a \Traversable instance + * @param bool $recursive Whether to recurse or not in the provided directories + * + * @return ArchiveInterface + * + * @throws RuntimeException In case of failure + * @throws NotSupportedException In case the operation in not supported + * @throws InvalidArgumentException In case no files could be added + */ + public function create($path, $files = null, $recursive = true); + + /** + * Tests if the adapter is supported by the current environment + * + * @return bool + */ + public function isSupported(); + + /** + * Returns the list of all archive members + * + * @param ResourceInterface $resource The path to the archive + * + * @return array + * + * @throws RuntimeException In case of failure + */ + public function listMembers(ResourceInterface $resource); + + /** + * Adds a file to the archive + * + * @param ResourceInterface $resource The path to the archive + * @param string|array|\Traversable $files An array of paths to add, relative to cwd + * @param bool $recursive Whether or not to recurse in the provided directories + * + * @return array + * + * @throws RuntimeException In case of failure + * @throws InvalidArgumentException In case no files could be added + */ + public function add(ResourceInterface $resource, $files, $recursive = true); + + /** + * Removes a member of the archive + * + * @param ResourceInterface $resource The path to the archive + * @param string|array|\Traversable $files A filename, an array of files, or a \Traversable instance + * + * @return array + * + * @throws RuntimeException In case of failure + * @throws InvalidArgumentException In case no files could be removed + */ + public function remove(ResourceInterface $resource, $files); + + /** + * Extracts an entire archive + * + * Note that any existing files will be overwritten by the adapter + * + * @param ResourceInterface $resource The path to the archive + * @param string|null $to The path where to extract the archive + * + * @return \SplFileInfo The extracted archive + * + * @throws RuntimeException In case of failure + * @throws InvalidArgumentException In case the provided path where to extract the archive is not valid + */ + public function extract(ResourceInterface $resource, $to = null); + + /** + * Extracts specific members of the archive + * + * @param ResourceInterface $resource The path to the archive + * @param string|string[] $members A path or array of paths matching the members to extract from the resource. + * @param string|null $to The path where to extract the members + * @param bool $overwrite Whether to overwrite existing files in target directory + * + * @return \SplFileInfo The extracted archive + * + * @throws RuntimeException In case of failure + * @throws InvalidArgumentException In case no members could be removed or providedd extract target directory is not valid + */ + public function extractMembers(ResourceInterface $resource, $members, $to = null, $overwrite = false); + + /** + * Returns the adapter name + * + * @return string + */ + public static function getName(); +} diff --git a/old.vendor/alchemy/zippy/src/Adapter/BSDTar/TarBSDTarAdapter.php b/old.vendor/alchemy/zippy/src/Adapter/BSDTar/TarBSDTarAdapter.php new file mode 100644 index 00000000..13a523fd --- /dev/null +++ b/old.vendor/alchemy/zippy/src/Adapter/BSDTar/TarBSDTarAdapter.php @@ -0,0 +1,79 @@ +probe = new BSDTarVersionProbe($inflator, $deflator); + } + + /** + * @inheritdoc + */ + protected function getLocalOptions() + { + return array(); + } + + /** + * @inheritdoc + */ + public static function getName() + { + return 'bsd-tar'; + } + + /** + * @inheritdoc + */ + public static function getDefaultDeflatorBinaryName() + { + return array('bsdtar', 'tar'); + } + + /** + * @inheritdoc + */ + public static function getDefaultInflatorBinaryName() + { + return array('bsdtar', 'tar'); + } + + /** + * {@inheritdoc} + */ + protected function getListMembersOptions() + { + return array(); + } + + /** + * {@inheritdoc} + */ + protected function getExtractOptions() + { + return array(); + } + + /** + * {@inheritdoc} + */ + protected function getExtractMembersOptions() + { + return array(); + } +} diff --git a/old.vendor/alchemy/zippy/src/Adapter/BSDTar/TarBz2BSDTarAdapter.php b/old.vendor/alchemy/zippy/src/Adapter/BSDTar/TarBz2BSDTarAdapter.php new file mode 100644 index 00000000..b2c8d8de --- /dev/null +++ b/old.vendor/alchemy/zippy/src/Adapter/BSDTar/TarBz2BSDTarAdapter.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Alchemy\Zippy\Adapter; + +use Alchemy\Zippy\Parser\ParserInterface; +use Alchemy\Zippy\ProcessBuilder\ProcessBuilderFactoryInterface; + +interface BinaryAdapterInterface +{ + /** + * Gets the output parser + * + * @return ParserInterface + */ + public function getParser(); + + /** + * Sets the parser + * + * @param ParserInterface $parser The parser to use + * + * @return AbstractBinaryAdapter + */ + public function setParser(ParserInterface $parser); + + /** + * Returns the inflator process builder + * + * @return ProcessBuilderFactoryInterface + */ + public function getInflator(); + + /** + * Sets the inflator process builder + * + * @param ProcessBuilderFactoryInterface $processBuilder The parser to use + * + * @return AbstractBinaryAdapter + */ + public function setInflator(ProcessBuilderFactoryInterface $processBuilder); + + /** + * Returns the deflator process builder + * + * @return ProcessBuilderFactoryInterface + */ + public function getDeflator(); + + /** + * Sets the deflator process builder + * + * @param ProcessBuilderFactoryInterface $processBuilder The parser to use + * + * @return AbstractBinaryAdapter + */ + public function setDeflator(ProcessBuilderFactoryInterface $processBuilder); + + /** + * Returns the inflator binary version + * + * @return string + */ + public function getInflatorVersion(); + + /** + * Returns the deflator binary version + * + * @return string + */ + public function getDeflatorVersion(); + + /** + * Gets the inflator adapter binary name + * + * @return array + */ + public static function getDefaultInflatorBinaryName(); + + /** + * Gets the deflator adapter binary name + * + * @return array + */ + public static function getDefaultDeflatorBinaryName(); +} diff --git a/old.vendor/alchemy/zippy/src/Adapter/GNUTar/TarBz2GNUTarAdapter.php b/old.vendor/alchemy/zippy/src/Adapter/GNUTar/TarBz2GNUTarAdapter.php new file mode 100644 index 00000000..d44dc257 --- /dev/null +++ b/old.vendor/alchemy/zippy/src/Adapter/GNUTar/TarBz2GNUTarAdapter.php @@ -0,0 +1,25 @@ +probe = new GNUTarVersionProbe($inflator, $deflator); + } + + /** + * @inheritdoc + */ + protected function getLocalOptions() + { + return array(); + } + + /** + * @inheritdoc + */ + public static function getName() + { + return 'gnu-tar'; + } + + /** + * @inheritdoc + */ + public static function getDefaultDeflatorBinaryName() + { + return array('gnutar', 'tar'); + } + + /** + * @inheritdoc + */ + public static function getDefaultInflatorBinaryName() + { + return array('gnutar', 'tar'); + } + + /** + * {@inheritdoc} + */ + protected function getListMembersOptions() + { + return array('--utc'); + } + + /** + * {@inheritdoc} + */ + protected function getExtractOptions() + { + return array('--overwrite'); + } + + /** + * {@inheritdoc} + */ + protected function getExtractMembersOptions() + { + return array('--overwrite'); + } +} diff --git a/old.vendor/alchemy/zippy/src/Adapter/GNUTar/TarGzGNUTarAdapter.php b/old.vendor/alchemy/zippy/src/Adapter/GNUTar/TarGzGNUTarAdapter.php new file mode 100644 index 00000000..6bbf5cb4 --- /dev/null +++ b/old.vendor/alchemy/zippy/src/Adapter/GNUTar/TarGzGNUTarAdapter.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + */ + +namespace Alchemy\Zippy\Adapter\Resource; + +class FileResource implements ResourceInterface +{ + private $path; + + public function __construct($path) + { + $this->path = $path; + } + + /** + * {@inheritdoc} + */ + public function getResource() + { + return $this->path; + } +} diff --git a/old.vendor/alchemy/zippy/src/Adapter/Resource/ResourceInterface.php b/old.vendor/alchemy/zippy/src/Adapter/Resource/ResourceInterface.php new file mode 100644 index 00000000..a42d08a5 --- /dev/null +++ b/old.vendor/alchemy/zippy/src/Adapter/Resource/ResourceInterface.php @@ -0,0 +1,23 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + */ + +namespace Alchemy\Zippy\Adapter\Resource; + +interface ResourceInterface +{ + /** + * Returns the actual resource used by an adapter + * + * @return mixed + */ + public function getResource(); +} diff --git a/old.vendor/alchemy/zippy/src/Adapter/Resource/ZipArchiveResource.php b/old.vendor/alchemy/zippy/src/Adapter/Resource/ZipArchiveResource.php new file mode 100644 index 00000000..4028324c --- /dev/null +++ b/old.vendor/alchemy/zippy/src/Adapter/Resource/ZipArchiveResource.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + */ + +namespace Alchemy\Zippy\Adapter\Resource; + +class ZipArchiveResource implements ResourceInterface +{ + private $archive; + + public function __construct(\ZipArchive $archive) + { + $this->archive = $archive; + } + + /** + * {@inheritdoc} + */ + public function getResource() + { + return $this->archive; + } +} diff --git a/old.vendor/alchemy/zippy/src/Adapter/VersionProbe/AbstractTarVersionProbe.php b/old.vendor/alchemy/zippy/src/Adapter/VersionProbe/AbstractTarVersionProbe.php new file mode 100644 index 00000000..4da1c5d5 --- /dev/null +++ b/old.vendor/alchemy/zippy/src/Adapter/VersionProbe/AbstractTarVersionProbe.php @@ -0,0 +1,77 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + */ + +namespace Alchemy\Zippy\Adapter\VersionProbe; + +use Alchemy\Zippy\ProcessBuilder\ProcessBuilderFactoryInterface; +use Symfony\Component\Process\Process; + +abstract class AbstractTarVersionProbe implements VersionProbeInterface +{ + private $isSupported; + private $inflator; + private $deflator; + + public function __construct(ProcessBuilderFactoryInterface $inflator, ProcessBuilderFactoryInterface $deflator) + { + $this->inflator = $inflator; + $this->deflator = $deflator; + } + + /** + * {@inheritdoc} + */ + public function getStatus() + { + if (null !== $this->isSupported) { + return $this->isSupported; + } + + if (null === $this->inflator || null === $this->deflator) { + return $this->isSupported = VersionProbeInterface::PROBE_NOTSUPPORTED; + } + + $good = true; + + foreach (array($this->inflator, $this->deflator) as $builder) { + /** @var Process $process */ + $process = $builder + ->create() + ->add('--version') + ->getProcess(); + + $process->run(); + + if (!$process->isSuccessful()) { + return $this->isSupported = VersionProbeInterface::PROBE_NOTSUPPORTED; + } + + $lines = explode("\n", $process->getOutput(), 2); + $good = false !== stripos($lines[0], $this->getVersionSignature()); + + if (!$good) { + break; + } + } + + $this->isSupported = $good ? VersionProbeInterface::PROBE_OK : VersionProbeInterface::PROBE_NOTSUPPORTED; + + return $this->isSupported; + } + + /** + * Returns the signature of inflator/deflator + * + * @return string + */ + abstract protected function getVersionSignature(); +} diff --git a/old.vendor/alchemy/zippy/src/Adapter/VersionProbe/BSDTarVersionProbe.php b/old.vendor/alchemy/zippy/src/Adapter/VersionProbe/BSDTarVersionProbe.php new file mode 100644 index 00000000..6f374750 --- /dev/null +++ b/old.vendor/alchemy/zippy/src/Adapter/VersionProbe/BSDTarVersionProbe.php @@ -0,0 +1,24 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + */ + +namespace Alchemy\Zippy\Adapter\VersionProbe; + +class BSDTarVersionProbe extends AbstractTarVersionProbe +{ + /** + * {@inheritdoc} + */ + protected function getVersionSignature() + { + return 'bsdtar'; + } +} diff --git a/old.vendor/alchemy/zippy/src/Adapter/VersionProbe/GNUTarVersionProbe.php b/old.vendor/alchemy/zippy/src/Adapter/VersionProbe/GNUTarVersionProbe.php new file mode 100644 index 00000000..046a836a --- /dev/null +++ b/old.vendor/alchemy/zippy/src/Adapter/VersionProbe/GNUTarVersionProbe.php @@ -0,0 +1,24 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + */ + +namespace Alchemy\Zippy\Adapter\VersionProbe; + +class GNUTarVersionProbe extends AbstractTarVersionProbe +{ + /** + * {@inheritdoc} + */ + protected function getVersionSignature() + { + return '(gnu tar)'; + } +} diff --git a/old.vendor/alchemy/zippy/src/Adapter/VersionProbe/VersionProbeInterface.php b/old.vendor/alchemy/zippy/src/Adapter/VersionProbe/VersionProbeInterface.php new file mode 100644 index 00000000..a0c03721 --- /dev/null +++ b/old.vendor/alchemy/zippy/src/Adapter/VersionProbe/VersionProbeInterface.php @@ -0,0 +1,26 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + */ + +namespace Alchemy\Zippy\Adapter\VersionProbe; + +interface VersionProbeInterface +{ + const PROBE_OK = 0; + const PROBE_NOTSUPPORTED = 1; + + /** + * Probes for the support of an adapter. + * + * @return integer One of the self::PROBE_* constants + */ + public function getStatus(); +} diff --git a/old.vendor/alchemy/zippy/src/Adapter/VersionProbe/ZipExtensionVersionProbe.php b/old.vendor/alchemy/zippy/src/Adapter/VersionProbe/ZipExtensionVersionProbe.php new file mode 100644 index 00000000..d95d0b53 --- /dev/null +++ b/old.vendor/alchemy/zippy/src/Adapter/VersionProbe/ZipExtensionVersionProbe.php @@ -0,0 +1,24 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + */ + +namespace Alchemy\Zippy\Adapter\VersionProbe; + +class ZipExtensionVersionProbe implements VersionProbeInterface +{ + /** + * {@inheritdoc} + */ + public function getStatus() + { + return class_exists('\ZipArchive') ? VersionProbeInterface::PROBE_OK : VersionProbeInterface::PROBE_NOTSUPPORTED; + } +} diff --git a/old.vendor/alchemy/zippy/src/Adapter/VersionProbe/ZipVersionProbe.php b/old.vendor/alchemy/zippy/src/Adapter/VersionProbe/ZipVersionProbe.php new file mode 100644 index 00000000..12595cbf --- /dev/null +++ b/old.vendor/alchemy/zippy/src/Adapter/VersionProbe/ZipVersionProbe.php @@ -0,0 +1,96 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + */ + +namespace Alchemy\Zippy\Adapter\VersionProbe; + +use Alchemy\Zippy\ProcessBuilder\ProcessBuilderFactoryInterface; + +class ZipVersionProbe implements VersionProbeInterface +{ + private $isSupported; + private $inflator; + private $deflator; + + public function __construct(ProcessBuilderFactoryInterface $inflator, ProcessBuilderFactoryInterface $deflator) + { + $this->inflator = $inflator; + $this->deflator = $deflator; + } + + /** + * Set the inflator to zip + * + * @param ProcessBuilderFactoryInterface $inflator + * @return ZipVersionProbe + */ + public function setInflator(ProcessBuilderFactoryInterface $inflator) + { + $this->inflator = $inflator; + + return $this; + } + + /** + * Set the deflator to unzip + * + * @param ProcessBuilderFactoryInterface $deflator + * @return ZipVersionProbe + */ + public function setDeflator(ProcessBuilderFactoryInterface $deflator) + { + $this->deflator = $deflator; + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getStatus() + { + if (null !== $this->isSupported) { + return $this->isSupported; + } + + if (null === $this->inflator || null === $this->deflator) { + return $this->isSupported = VersionProbeInterface::PROBE_NOTSUPPORTED; + } + + $processDeflate = $this + ->deflator + ->create() + ->add('-h') + ->getProcess(); + + $processDeflate->run(); + + $processInflate = $this + ->inflator + ->create() + ->add('-h') + ->getProcess(); + + $processInflate->run(); + + if (false === $processDeflate->isSuccessful() || false === $processInflate->isSuccessful()) { + return $this->isSupported = VersionProbeInterface::PROBE_NOTSUPPORTED; + } + + $lines = explode("\n", $processInflate->getOutput(), 2); + $inflatorOk = false !== stripos($lines[0], 'Info-ZIP'); + + $lines = explode("\n", $processDeflate->getOutput(), 2); + $deflatorOk = false !== stripos($lines[0], 'Info-ZIP'); + + return $this->isSupported = ($inflatorOk && $deflatorOk) ? VersionProbeInterface::PROBE_OK : VersionProbeInterface::PROBE_NOTSUPPORTED; + } +} diff --git a/old.vendor/alchemy/zippy/src/Adapter/ZipAdapter.php b/old.vendor/alchemy/zippy/src/Adapter/ZipAdapter.php new file mode 100644 index 00000000..4fb6ba7f --- /dev/null +++ b/old.vendor/alchemy/zippy/src/Adapter/ZipAdapter.php @@ -0,0 +1,370 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Alchemy\Zippy\Adapter; + +use Alchemy\Zippy\Adapter\Resource\ResourceInterface; +use Alchemy\Zippy\Adapter\VersionProbe\ZipVersionProbe; +use Alchemy\Zippy\Archive\Archive; +use Alchemy\Zippy\Archive\Member; +use Alchemy\Zippy\Exception\InvalidArgumentException; +use Alchemy\Zippy\Exception\NotSupportedException; +use Alchemy\Zippy\Exception\RuntimeException; +use Alchemy\Zippy\Parser\ParserInterface; +use Alchemy\Zippy\ProcessBuilder\ProcessBuilderFactoryInterface; +use Alchemy\Zippy\Resource\Resource as ZippyResource; +use Alchemy\Zippy\Resource\ResourceManager; +use Symfony\Component\Process\Exception\ExceptionInterface as ProcessException; + +/** + * ZipAdapter allows you to create and extract files from archives using Zip + * + * @see http://www.gnu.org/software/tar/manual/tar.html + */ +class ZipAdapter extends AbstractBinaryAdapter +{ + public function __construct( + ParserInterface $parser, + ResourceManager $manager, + ProcessBuilderFactoryInterface $inflator, + ProcessBuilderFactoryInterface $deflator + ) { + parent::__construct($parser, $manager, $inflator, $deflator); + + $this->probe = new ZipVersionProbe($inflator, $deflator); + } + + /** + * @inheritdoc + */ + protected function doCreate($path, $files, $recursive) + { + $files = (array) $files; + + $builder = $this + ->inflator + ->create(); + + if (0 === count($files)) { + throw new NotSupportedException('Can not create empty zip archive'); + } + + if ($recursive) { + $builder->add('-r'); + } + + $builder->add($path); + + $collection = $this->manager->handle(getcwd(), $files); + $builder->setWorkingDirectory($collection->getContext()); + + $collection->forAll(function($i, ZippyResource $resource) use ($builder) { + return $builder->add($resource->getTarget()); + }); + + $process = $builder->getProcess(); + + try { + $process->run(); + } catch (ProcessException $e) { + $this->manager->cleanup($collection); + throw $e; + } + + $this->manager->cleanup($collection); + + if (!$process->isSuccessful()) { + throw new RuntimeException(sprintf( + 'Unable to execute the following command %s {output: %s}', + $process->getCommandLine(), + $process->getErrorOutput() + )); + } + + return new Archive($this->createResource($path), $this, $this->manager); + } + + /** + * @inheritdoc + */ + protected function doListMembers(ResourceInterface $resource) + { + $process = $this + ->deflator + ->create() + ->add('-l') + ->add($resource->getResource()) + ->getProcess(); + + $process->run(); + + if (!$process->isSuccessful()) { + throw new RuntimeException(sprintf( + 'Unable to execute the following command %s {output: %s}', + $process->getCommandLine(), + $process->getErrorOutput() + )); + } + + $members = array(); + + foreach ($this->parser->parseFileListing($process->getOutput() ?: '') as $member) { + $members[] = new Member( + $resource, + $this, + $member['location'], + $member['size'], + $member['mtime'], + $member['is_dir'] + ); + } + + return $members; + } + + /** + * @inheritdoc + */ + protected function doAdd(ResourceInterface $resource, $files, $recursive) + { + $files = (array) $files; + + $builder = $this + ->inflator + ->create(); + + if ($recursive) { + $builder->add('-r'); + } + + $builder + ->add('-u') + ->add($resource->getResource()); + + $collection = $this->manager->handle(getcwd(), $files); + + $builder->setWorkingDirectory($collection->getContext()); + + $collection->forAll(function($i, ZippyResource $resource) use ($builder) { + return $builder->add($resource->getTarget()); + }); + + $process = $builder->getProcess(); + + try { + $process->run(); + } catch (ProcessException $e) { + $this->manager->cleanup($collection); + throw $e; + } + + $this->manager->cleanup($collection); + + if (!$process->isSuccessful()) { + throw new RuntimeException(sprintf( + 'Unable to execute the following command %s {output: %s}', + $process->getCommandLine(), + $process->getErrorOutput() + )); + } + } + + /** + * @inheritdoc + */ + protected function doGetDeflatorVersion() + { + $process = $this + ->deflator + ->create() + ->add('-h') + ->getProcess(); + + $process->run(); + + if (!$process->isSuccessful()) { + throw new RuntimeException(sprintf( + 'Unable to execute the following command %s {output: %s}', + $process->getCommandLine(), + $process->getErrorOutput() + )); + } + + return $this->parser->parseDeflatorVersion($process->getOutput() ?: ''); + } + + /** + * @inheritdoc + */ + protected function doGetInflatorVersion() + { + $process = $this + ->inflator + ->create() + ->add('-h') + ->getProcess(); + + $process->run(); + + if (!$process->isSuccessful()) { + throw new RuntimeException(sprintf( + 'Unable to execute the following command %s {output: %s}', + $process->getCommandLine(), + $process->getErrorOutput() + )); + } + + return $this->parser->parseInflatorVersion($process->getOutput() ?: ''); + } + + /** + * @inheritdoc + */ + protected function doRemove(ResourceInterface $resource, $files) + { + $files = (array) $files; + + $builder = $this + ->inflator + ->create(); + + $builder + ->add('-d') + ->add($resource->getResource()); + + if (!$this->addBuilderFileArgument($files, $builder)) { + throw new InvalidArgumentException('Invalid files'); + } + + $process = $builder->getProcess(); + + $process->run(); + + if (!$process->isSuccessful()) { + throw new RuntimeException(sprintf( + 'Unable to execute the following command %s {output: %s}', + $process->getCommandLine(), + $process->getErrorOutput() + )); + } + + return $files; + } + + /** + * @inheritdoc + */ + public static function getName() + { + return 'zip'; + } + + /** + * @inheritdoc + */ + public static function getDefaultDeflatorBinaryName() + { + return array('unzip'); + } + + /** + * @inheritdoc + */ + public static function getDefaultInflatorBinaryName() + { + return array('zip'); + } + + /** + * @inheritdoc + */ + protected function doExtract(ResourceInterface $resource, $to) + { + if (null !== $to && !is_dir($to)) { + throw new InvalidArgumentException(sprintf("%s is not a directory", $to)); + } + + $builder = $this + ->deflator + ->create(); + + $builder + ->add('-o') + ->add($resource->getResource()); + + if (null !== $to) { + $builder + ->add('-d') + ->add($to); + } + + $process = $builder->getProcess(); + + $process->run(); + + if (!$process->isSuccessful()) { + throw new RuntimeException(sprintf( + 'Unable to execute the following command %s {output: %s}', + $process->getCommandLine(), + $process->getErrorOutput() + )); + } + + return new \SplFileInfo($to ?: $resource->getResource()); + } + + /** + * @inheritdoc + */ + protected function doExtractMembers(ResourceInterface $resource, $members, $to, $overwrite = false) + { + if (null !== $to && !is_dir($to)) { + throw new InvalidArgumentException(sprintf("%s is not a directory", $to)); + } + + $members = (array) $members; + + $builder = $this + ->deflator + ->create(); + + if ((bool) $overwrite) { + $builder->add('-o'); + } + + $builder + ->add($resource->getResource()); + + if (null !== $to) { + $builder + ->add('-d') + ->add($to); + } + + if (!$this->addBuilderFileArgument($members, $builder)) { + throw new InvalidArgumentException('Invalid files'); + } + + $process = $builder->getProcess(); + + $process->run(); + + if (!$process->isSuccessful()) { + throw new RuntimeException(sprintf( + 'Unable to execute the following command %s {output: %s}', + $process->getCommandLine(), + $process->getErrorOutput() + )); + } + + return $members; + } +} diff --git a/old.vendor/alchemy/zippy/src/Adapter/ZipExtensionAdapter.php b/old.vendor/alchemy/zippy/src/Adapter/ZipExtensionAdapter.php new file mode 100644 index 00000000..d2997290 --- /dev/null +++ b/old.vendor/alchemy/zippy/src/Adapter/ZipExtensionAdapter.php @@ -0,0 +1,361 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Alchemy\Zippy\Adapter; + +use Alchemy\Zippy\Adapter\Resource\ResourceInterface; +use Alchemy\Zippy\Adapter\Resource\ZipArchiveResource; +use Alchemy\Zippy\Adapter\VersionProbe\ZipExtensionVersionProbe; +use Alchemy\Zippy\Archive\Archive; +use Alchemy\Zippy\Archive\Member; +use Alchemy\Zippy\Exception\NotSupportedException; +use Alchemy\Zippy\Exception\RuntimeException; +use Alchemy\Zippy\Exception\InvalidArgumentException; +use Alchemy\Zippy\Resource\Resource as ZippyResource; +use Alchemy\Zippy\Resource\ResourceManager; + +/** + * ZipExtensionAdapter allows you to create and extract files from archives + * using PHP Zip extension + * + * @see http://www.php.net/manual/en/book.zip.php + */ +class ZipExtensionAdapter extends AbstractAdapter +{ + private $errorCodesMapping = array( + \ZipArchive::ER_EXISTS => "File already exists", + \ZipArchive::ER_INCONS => "Zip archive inconsistent", + \ZipArchive::ER_INVAL => "Invalid argument", + \ZipArchive::ER_MEMORY => "Malloc failure", + \ZipArchive::ER_NOENT => "No such file", + \ZipArchive::ER_NOZIP => "Not a zip archive", + \ZipArchive::ER_OPEN => "Can't open file", + \ZipArchive::ER_READ => "Read error", + \ZipArchive::ER_SEEK => "Seek error" + ); + + public function __construct(ResourceManager $manager) + { + parent::__construct($manager); + $this->probe = new ZipExtensionVersionProbe(); + } + + /** + * @inheritdoc + */ + protected function doListMembers(ResourceInterface $resource) + { + $members = array(); + for ($i = 0; $i < $resource->getResource()->numFiles; $i++) { + $stat = $resource->getResource()->statIndex($i); + $members[] = new Member( + $resource, + $this, + $stat['name'], + $stat['size'], + new \DateTime('@' . $stat['mtime']), + 0 === strlen($resource->getResource()->getFromIndex($i, 1)) + ); + } + + return $members; + } + + /** + * @inheritdoc + */ + public static function getName() + { + return 'zip-extension'; + } + + /** + * @inheritdoc + */ + protected function doExtract(ResourceInterface $resource, $to) + { + return $this->extractMembers($resource, null, $to); + } + + /** + * @inheritdoc + */ + protected function doExtractMembers(ResourceInterface $resource, $members, $to, $overwrite = false) + { + if (null === $to) { + // if no destination is given, will extract to zip current folder + $to = dirname(realpath($resource->getResource()->filename)); + } + + if (!is_dir($to)) { + $resource->getResource()->close(); + throw new InvalidArgumentException(sprintf("%s is not a directory", $to)); + } + + if (!is_writable($to)) { + $resource->getResource()->close(); + throw new InvalidArgumentException(sprintf("%s is not writable", $to)); + } + + if (null !== $members) { + $membersTemp = (array) $members; + if (empty($membersTemp)) { + $resource->getResource()->close(); + + throw new InvalidArgumentException("no members provided"); + } + $members = array(); + // allows $members to be an array of strings or array of Members + foreach ($membersTemp as $member) { + if ($member instanceof Member) { + $member = $member->getLocation(); + } + + if ($resource->getResource()->locateName($member) === false) { + $resource->getResource()->close(); + + throw new InvalidArgumentException(sprintf('%s is not in the zip file', $member)); + } + + if ($overwrite == false) { + if (file_exists($member)) { + $resource->getResource()->close(); + + throw new RuntimeException('Target file ' . $member . ' already exists.'); + } + } + + $members[] = $member; + } + } + + if (!$resource->getResource()->extractTo($to, $members)) { + $resource->getResource()->close(); + + throw new InvalidArgumentException(sprintf('Unable to extract archive : %s', $resource->getResource()->getStatusString())); + } + + return new \SplFileInfo($to); + } + + /** + * @inheritdoc + */ + protected function doRemove(ResourceInterface $resource, $files) + { + $files = (array) $files; + + if (empty($files)) { + throw new InvalidArgumentException("no files provided"); + } + + // either remove all files or none in case of error + foreach ($files as $file) { + if ($resource->getResource()->locateName($file) === false) { + $resource->getResource()->unchangeAll(); + $resource->getResource()->close(); + + throw new InvalidArgumentException(sprintf('%s is not in the zip file', $file)); + } + if (!$resource->getResource()->deleteName($file)) { + $resource->getResource()->unchangeAll(); + $resource->getResource()->close(); + + throw new RuntimeException(sprintf('unable to remove %s', $file)); + } + } + $this->flush($resource->getResource()); + + return $files; + } + + /** + * @inheritdoc + */ + protected function doAdd(ResourceInterface $resource, $files, $recursive) + { + $files = (array) $files; + if (empty($files)) { + $resource->getResource()->close(); + throw new InvalidArgumentException("no files provided"); + } + $this->addEntries($resource, $files, $recursive); + + return $files; + } + + /** + * @inheritdoc + */ + protected function doCreate($path, $files, $recursive) + { + $files = (array) $files; + + if (empty($files)) { + throw new NotSupportedException("Cannot create an empty zip"); + } + + $resource = $this->getResource($path, \ZipArchive::CREATE); + $this->addEntries($resource, $files, $recursive); + + return new Archive($resource, $this, $this->manager); + } + + /** + * Returns a new instance of the invoked adapter + * + * @return AbstractAdapter + * + * @throws RuntimeException In case object could not be instanciated + */ + public static function newInstance() + { + return new ZipExtensionAdapter(ResourceManager::create()); + } + + protected function createResource($path) + { + return $this->getResource($path, \ZipArchive::CHECKCONS); + } + + private function getResource($path, $mode) + { + $zip = new \ZipArchive(); + $res = $zip->open($path, $mode); + + if ($res !== true) { + throw new RuntimeException($this->errorCodesMapping[$res]); + } + + return new ZipArchiveResource($zip); + } + + private function addEntries(ResourceInterface $zipResource, array $files, $recursive) + { + $stack = new \SplStack(); + + $error = null; + $cwd = getcwd(); + $collection = $this->manager->handle($cwd, $files); + + $this->chdir($collection->getContext()); + + $adapter = $this; + + try { + $collection->forAll(function($i, ZippyResource $resource) use ($zipResource, $stack, $recursive, $adapter) { + $adapter->checkReadability($zipResource->getResource(), $resource->getTarget()); + if (is_dir($resource->getTarget())) { + if ($recursive) { + $stack->push($resource->getTarget() . ((substr($resource->getTarget(), -1) === DIRECTORY_SEPARATOR) ? '' : DIRECTORY_SEPARATOR)); + } else { + $adapter->addEmptyDir($zipResource->getResource(), $resource->getTarget()); + } + } else { + $adapter->addFileToZip($zipResource->getResource(), $resource->getTarget()); + } + + return true; + }); + + // recursively add dirs + while (!$stack->isEmpty()) { + $dir = $stack->pop(); + // removes . and .. + $files = array_diff(scandir($dir), array(".", "..")); + if (count($files) > 0) { + foreach ($files as $file) { + $file = $dir . $file; + $this->checkReadability($zipResource->getResource(), $file); + if (is_dir($file)) { + $stack->push($file . DIRECTORY_SEPARATOR); + } else { + $this->addFileToZip($zipResource->getResource(), $file); + } + } + } else { + $this->addEmptyDir($zipResource->getResource(), $dir); + } + } + $this->flush($zipResource->getResource()); + + $this->manager->cleanup($collection); + } catch (\Exception $e) { + $error = $e; + } + + $this->chdir($cwd); + + if ($error) { + throw $error; + } + } + + /** + * Is public for PHP 5.3 compatibility, should be private + * + * @param \ZipArchive $zip + * @param string $file + */ + public function checkReadability(\ZipArchive $zip, $file) + { + if (!is_readable($file)) { + $zip->unchangeAll(); + $zip->close(); + + throw new InvalidArgumentException(sprintf('could not read %s', $file)); + } + } + + /** + * Is public for PHP 5.3 compatibility, should be private + * + * @param \ZipArchive $zip + * @param string $file + */ + public function addFileToZip(\ZipArchive $zip, $file) + { + if (!$zip->addFile($file)) { + $zip->unchangeAll(); + $zip->close(); + + throw new RuntimeException(sprintf('unable to add %s to the zip file', $file)); + } + } + + /** + * Is public for PHP 5.3 compatibility, should be private + * + * @param \ZipArchive $zip + * @param string $dir + */ + public function addEmptyDir(\ZipArchive $zip, $dir) + { + if (!$zip->addEmptyDir($dir)) { + $zip->unchangeAll(); + $zip->close(); + + throw new RuntimeException(sprintf('unable to add %s to the zip file', $dir)); + } + } + + /** + * Flushes changes to the archive + * + * @param \ZipArchive $zip + */ + private function flush(\ZipArchive $zip) // flush changes by reopening the file + { + $path = $zip->filename; + $zip->close(); + $zip->open($path, \ZipArchive::CHECKCONS); + } +} diff --git a/old.vendor/alchemy/zippy/src/Archive/Archive.php b/old.vendor/alchemy/zippy/src/Archive/Archive.php new file mode 100644 index 00000000..f7ece485 --- /dev/null +++ b/old.vendor/alchemy/zippy/src/Archive/Archive.php @@ -0,0 +1,136 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Alchemy\Zippy\Archive; + +use Alchemy\Zippy\Adapter\AdapterInterface; +use Alchemy\Zippy\Resource\ResourceManager; +use Alchemy\Zippy\Adapter\Resource\ResourceInterface; + +/** + * Represents an archive + */ +class Archive implements ArchiveInterface +{ + /** + * The path to the archive + * + * @var string + */ + protected $path; + + /** + * The archive adapter + * + * @var AdapterInterface + */ + protected $adapter; + + /** + * An array of archive members + * + * @var MemberInterface[] + */ + protected $members = array(); + + /** + * @var ResourceInterface + */ + protected $resource; + + /** + * + * @var ResourceManager + */ + protected $manager; + + /** + * Constructor + * + * @param ResourceInterface $resource Path to the archive + * @param AdapterInterface $adapter An archive adapter + * @param ResourceManager $manager The resource manager + */ + public function __construct(ResourceInterface $resource, AdapterInterface $adapter, ResourceManager $manager) + { + $this->resource = $resource; + $this->adapter = $adapter; + $this->manager = $manager; + } + + /** + * @inheritdoc + */ + public function count() + { + return count($this->getMembers()); + } + + /** + * Returns an Iterator for the current archive + * + * This method implements the IteratorAggregate interface. + * + * @return \ArrayIterator|MemberInterface[] An iterator + */ + public function getIterator() + { + return new \ArrayIterator($this->getMembers()); + } + + /** + * @inheritdoc + */ + public function getMembers() + { + return $this->members = $this->adapter->listMembers($this->resource); + } + + /** + * @inheritdoc + */ + public function addMembers($sources, $recursive = true) + { + $this->adapter->add($this->resource, $sources, $recursive); + + return $this; + } + + /** + * @inheritdoc + */ + public function removeMembers($sources) + { + $this->adapter->remove($this->resource, $sources); + + return $this; + } + + /** + * @inheritdoc + */ + public function extract($toDirectory) + { + $this->adapter->extract($this->resource, $toDirectory); + + return $this; + } + + /** + * @inheritdoc + */ + public function extractMembers($members, $toDirectory = null) + { + $this->adapter->extractMembers($this->resource, $members, $toDirectory); + + return $this; + } +} diff --git a/old.vendor/alchemy/zippy/src/Archive/ArchiveInterface.php b/old.vendor/alchemy/zippy/src/Archive/ArchiveInterface.php new file mode 100644 index 00000000..b4dfa801 --- /dev/null +++ b/old.vendor/alchemy/zippy/src/Archive/ArchiveInterface.php @@ -0,0 +1,74 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Alchemy\Zippy\Archive; + +use Alchemy\Zippy\Exception\RuntimeException; +use Alchemy\Zippy\Exception\InvalidArgumentException; + +interface ArchiveInterface extends \IteratorAggregate, \Countable +{ + /** + * Adds a file or a folder into the archive + * + * @param string|array|\SplFileInfo $sources The path to the file or a folder + * @param bool $recursive Recurse into sub-directories + * + * @return ArchiveInterface + * + * @throws InvalidArgumentException In case the provided source path is not valid + * @throws RuntimeException In case of failure + */ + public function addMembers($sources, $recursive = true); + + /** + * Removes a file from the archive + * + * @param string|array $sources The path to an archive or a folder member + * + * @return ArchiveInterface + * + * @throws RuntimeException In case of failure + */ + public function removeMembers($sources); + + /** + * Lists files and directories archive members + * + * @return MemberInterface[] An array of File + * + * @throws RuntimeException In case archive could not be read + */ + public function getMembers(); + + /** + * Extracts current archive to the given directory + * + * @param string $toDirectory The path the extracted archive + * + * @return ArchiveInterface + * + * @throws RuntimeException In case archive could not be extracted + */ + public function extract($toDirectory); + + /** + * Extracts specific members from the archive + * + * @param string|MemberInterface[] $members An array of members path + * @param string $toDirectory The destination $directory + * + * @return ArchiveInterface + * + * @throws RuntimeException In case member could not be extracted + */ + public function extractMembers($members, $toDirectory = null); +} diff --git a/old.vendor/alchemy/zippy/src/Archive/Member.php b/old.vendor/alchemy/zippy/src/Archive/Member.php new file mode 100644 index 00000000..24691c6d --- /dev/null +++ b/old.vendor/alchemy/zippy/src/Archive/Member.php @@ -0,0 +1,147 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Alchemy\Zippy\Archive; + +use Alchemy\Zippy\Adapter\AdapterInterface; +use Alchemy\Zippy\Adapter\Resource\ResourceInterface; + +/** + * Represents a member of an archive. + */ +class Member implements MemberInterface +{ + /** + * The location of the file + * + * @var string + */ + private $location; + + /** + * Tells whether the archive member is a directory or not + * + * @var bool + */ + private $isDir; + + /** + * The uncompressed size of the file + * + * @var int + */ + private $size; + + /** + * The last modified date of the file + * + * @var \DateTime + */ + private $lastModifiedDate; + + /** + * The resource to the actual archive + * + * @var string + */ + private $resource; + + /** + * An adapter + * + * @var AdapterInterface + */ + private $adapter; + + /** + * Constructor + * + * @param ResourceInterface $resource The path of the archive which contain the member + * @param AdapterInterface $adapter The archive adapter interface + * @param string $location The path of the archive member + * @param int $fileSize The uncompressed file size + * @param \DateTime $lastModifiedDate The last modified date of the member + * @param bool $isDir Tells whether the member is a directory or not + */ + public function __construct( + ResourceInterface $resource, + AdapterInterface $adapter, + $location, + $fileSize, + \DateTime $lastModifiedDate, + $isDir + ) { + $this->resource = $resource; + $this->adapter = $adapter; + $this->location = $location; + $this->isDir = $isDir; + $this->size = $fileSize; + $this->lastModifiedDate = $lastModifiedDate; + } + + /** + * {@inheritdoc} + */ + public function getLocation() + { + return $this->location; + } + + /** + * {@inheritdoc} + */ + public function isDir() + { + return $this->isDir; + } + + /** + * {@inheritdoc} + */ + public function getLastModifiedDate() + { + return $this->lastModifiedDate; + } + + /** + * {@inheritdoc} + */ + public function getSize() + { + return $this->size; + } + + /** + * {@inheritdoc} + */ + public function __toString() + { + return $this->location; + } + + /** + * {@inheritdoc} + */ + public function extract($to = null, $overwrite = false) + { + $this->adapter->extractMembers($this->resource, $this->location, $to, (bool) $overwrite); + + return new \SplFileInfo(sprintf('%s/%s', rtrim(null === $to ? getcwd() : $to, '/'), ltrim($this->location, '/'))); + } + + /** + * @inheritdoc + * */ + public function getResource() + { + return $this->resource; + } +} diff --git a/old.vendor/alchemy/zippy/src/Archive/MemberInterface.php b/old.vendor/alchemy/zippy/src/Archive/MemberInterface.php new file mode 100644 index 00000000..be41fc1c --- /dev/null +++ b/old.vendor/alchemy/zippy/src/Archive/MemberInterface.php @@ -0,0 +1,78 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Alchemy\Zippy\Archive; + +use Alchemy\Zippy\Adapter\Resource\ResourceInterface; +use Alchemy\Zippy\Exception\InvalidArgumentException; +use Alchemy\Zippy\Exception\RuntimeException; + +interface MemberInterface +{ + /** + * Gets the location of an archive member + * + * @return string + */ + public function getLocation(); + + /** + * Tells whether the member is a directory or not + * + * @return bool + */ + public function isDir(); + + /** + * Returns the last modified date of the member + * + * @return \DateTime + */ + public function getLastModifiedDate(); + + /** + * Returns the (uncompressed) size of the member + * + * If the size is unknown, returns -1 + * + * @return integer + */ + public function getSize(); + + /** + * Extract the member from its archive + * + * Be careful using this method within a loop + * This will execute one extraction process for each file + * Prefer the use of ArchiveInterface::extractMembers in that use case + * + * @param string|null $to The path where to extract the member, if no path is not provided the member is extracted in the same directory of its archive + * @param bool $overwrite Whether to overwrite destination file if it already exists. Defaults to false + * + * @return \SplFileInfo The extracted file + * + * @throws RuntimeException In case of failure + * @throws InvalidArgumentException In case no members could be removed or provide extract target directory is not valid + */ + public function extract($to = null, $overwrite = false); + + /** + * Get resource. + * + * @return ResourceInterface + * */ + public function getResource(); + + /** + * @inheritdoc + */ + public function __toString(); +} diff --git a/old.vendor/alchemy/zippy/src/Exception/ExceptionInterface.php b/old.vendor/alchemy/zippy/src/Exception/ExceptionInterface.php new file mode 100644 index 00000000..832d2eb6 --- /dev/null +++ b/old.vendor/alchemy/zippy/src/Exception/ExceptionInterface.php @@ -0,0 +1,16 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Alchemy\Zippy\Exception; + +interface ExceptionInterface +{ +} diff --git a/old.vendor/alchemy/zippy/src/Exception/FormatNotSupportedException.php b/old.vendor/alchemy/zippy/src/Exception/FormatNotSupportedException.php new file mode 100644 index 00000000..681ac739 --- /dev/null +++ b/old.vendor/alchemy/zippy/src/Exception/FormatNotSupportedException.php @@ -0,0 +1,16 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Alchemy\Zippy\Exception; + +class FormatNotSupportedException extends RuntimeException +{ +} diff --git a/old.vendor/alchemy/zippy/src/Exception/IOException.php b/old.vendor/alchemy/zippy/src/Exception/IOException.php new file mode 100644 index 00000000..6da5dd21 --- /dev/null +++ b/old.vendor/alchemy/zippy/src/Exception/IOException.php @@ -0,0 +1,16 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Alchemy\Zippy\Exception; + +class IOException extends RuntimeException +{ +} diff --git a/old.vendor/alchemy/zippy/src/Exception/InvalidArgumentException.php b/old.vendor/alchemy/zippy/src/Exception/InvalidArgumentException.php new file mode 100644 index 00000000..c901135f --- /dev/null +++ b/old.vendor/alchemy/zippy/src/Exception/InvalidArgumentException.php @@ -0,0 +1,16 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Alchemy\Zippy\Exception; + +class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface +{ +} diff --git a/old.vendor/alchemy/zippy/src/Exception/NoAdapterOnPlatformException.php b/old.vendor/alchemy/zippy/src/Exception/NoAdapterOnPlatformException.php new file mode 100644 index 00000000..40f86365 --- /dev/null +++ b/old.vendor/alchemy/zippy/src/Exception/NoAdapterOnPlatformException.php @@ -0,0 +1,16 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Alchemy\Zippy\Exception; + +class NoAdapterOnPlatformException extends RuntimeException +{ +} diff --git a/old.vendor/alchemy/zippy/src/Exception/NotSupportedException.php b/old.vendor/alchemy/zippy/src/Exception/NotSupportedException.php new file mode 100644 index 00000000..3d2626e0 --- /dev/null +++ b/old.vendor/alchemy/zippy/src/Exception/NotSupportedException.php @@ -0,0 +1,16 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Alchemy\Zippy\Exception; + +class NotSupportedException extends RuntimeException implements ExceptionInterface +{ +} diff --git a/old.vendor/alchemy/zippy/src/Exception/RuntimeException.php b/old.vendor/alchemy/zippy/src/Exception/RuntimeException.php new file mode 100644 index 00000000..a6aa5174 --- /dev/null +++ b/old.vendor/alchemy/zippy/src/Exception/RuntimeException.php @@ -0,0 +1,16 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Alchemy\Zippy\Exception; + +class RuntimeException extends \RuntimeException implements ExceptionInterface +{ +} diff --git a/old.vendor/alchemy/zippy/src/Exception/TargetLocatorException.php b/old.vendor/alchemy/zippy/src/Exception/TargetLocatorException.php new file mode 100644 index 00000000..720c9e78 --- /dev/null +++ b/old.vendor/alchemy/zippy/src/Exception/TargetLocatorException.php @@ -0,0 +1,28 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Alchemy\Zippy\Exception; + +class TargetLocatorException extends RuntimeException +{ + private $resource; + + public function __construct($resource, $message, $code = 0, $previous = null) + { + $this->resource = $resource; + parent::__construct($message, $code, $previous); + } + + public function getResource() + { + return $this->resource; + } +} diff --git a/old.vendor/alchemy/zippy/src/FileStrategy/AbstractFileStrategy.php b/old.vendor/alchemy/zippy/src/FileStrategy/AbstractFileStrategy.php new file mode 100644 index 00000000..f6f65df0 --- /dev/null +++ b/old.vendor/alchemy/zippy/src/FileStrategy/AbstractFileStrategy.php @@ -0,0 +1,49 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Alchemy\Zippy\FileStrategy; + +use Alchemy\Zippy\Adapter\AdapterContainer; +use Alchemy\Zippy\Exception\RuntimeException; + +abstract class AbstractFileStrategy implements FileStrategyInterface +{ + protected $container; + + public function __construct(AdapterContainer $container) + { + $this->container = $container; + } + + /** + * {@inheritdoc} + */ + public function getAdapters() + { + $services = array(); + foreach ($this->getServiceNames() as $serviceName) { + try { + $services[] = $this->container[$serviceName]; + } catch (RuntimeException $e) { + + } + } + + return $services; + } + + /** + * Returns an array of service names that defines adapters. + * + * @return string[] + */ + abstract protected function getServiceNames(); +} diff --git a/old.vendor/alchemy/zippy/src/FileStrategy/FileStrategyInterface.php b/old.vendor/alchemy/zippy/src/FileStrategy/FileStrategyInterface.php new file mode 100644 index 00000000..1b24f5b5 --- /dev/null +++ b/old.vendor/alchemy/zippy/src/FileStrategy/FileStrategyInterface.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Alchemy\Zippy\FileStrategy; + +use Alchemy\Zippy\Adapter\AdapterInterface; + +interface FileStrategyInterface +{ + /** + * Returns an array of adapters that match the strategy + * + * @return AdapterInterface[] + */ + public function getAdapters(); + + /** + * Returns the file extension that match the strategy + * + * @return string + */ + public function getFileExtension(); +} diff --git a/old.vendor/alchemy/zippy/src/FileStrategy/TB2FileStrategy.php b/old.vendor/alchemy/zippy/src/FileStrategy/TB2FileStrategy.php new file mode 100644 index 00000000..45c55b54 --- /dev/null +++ b/old.vendor/alchemy/zippy/src/FileStrategy/TB2FileStrategy.php @@ -0,0 +1,34 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Alchemy\Zippy\FileStrategy; + +class TB2FileStrategy extends AbstractFileStrategy +{ + /** + * {@inheritdoc} + */ + protected function getServiceNames() + { + return array( + 'Alchemy\\Zippy\\Adapter\\GNUTar\\TarBz2GNUTarAdapter', + 'Alchemy\\Zippy\\Adapter\\BSDTar\\TarBz2BSDTarAdapter' + ); + } + + /** + * {@inheritdoc} + */ + public function getFileExtension() + { + return 'tb2'; + } +} diff --git a/old.vendor/alchemy/zippy/src/FileStrategy/TBz2FileStrategy.php b/old.vendor/alchemy/zippy/src/FileStrategy/TBz2FileStrategy.php new file mode 100644 index 00000000..a99b5453 --- /dev/null +++ b/old.vendor/alchemy/zippy/src/FileStrategy/TBz2FileStrategy.php @@ -0,0 +1,34 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Alchemy\Zippy\FileStrategy; + +class TBz2FileStrategy extends AbstractFileStrategy +{ + /** + * {@inheritdoc} + */ + protected function getServiceNames() + { + return array( + 'Alchemy\\Zippy\\Adapter\\GNUTar\\TarBz2GNUTarAdapter', + 'Alchemy\\Zippy\\Adapter\\BSDTar\\TarBz2BSDTarAdapter' + ); + } + + /** + * {@inheritdoc} + */ + public function getFileExtension() + { + return 'tbz2'; + } +} diff --git a/old.vendor/alchemy/zippy/src/FileStrategy/TGzFileStrategy.php b/old.vendor/alchemy/zippy/src/FileStrategy/TGzFileStrategy.php new file mode 100644 index 00000000..f1e6ca31 --- /dev/null +++ b/old.vendor/alchemy/zippy/src/FileStrategy/TGzFileStrategy.php @@ -0,0 +1,34 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Alchemy\Zippy\FileStrategy; + +class TGzFileStrategy extends AbstractFileStrategy +{ + /** + * {@inheritdoc} + */ + protected function getServiceNames() + { + return array( + 'Alchemy\\Zippy\\Adapter\\GNUTar\\TarGzGNUTarAdapter', + 'Alchemy\\Zippy\\Adapter\\BSDTar\\TarGzBSDTarAdapter' + ); + } + + /** + * {@inheritdoc} + */ + public function getFileExtension() + { + return 'tgz'; + } +} diff --git a/old.vendor/alchemy/zippy/src/FileStrategy/TarBz2FileStrategy.php b/old.vendor/alchemy/zippy/src/FileStrategy/TarBz2FileStrategy.php new file mode 100644 index 00000000..fa4b1e4b --- /dev/null +++ b/old.vendor/alchemy/zippy/src/FileStrategy/TarBz2FileStrategy.php @@ -0,0 +1,34 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Alchemy\Zippy\FileStrategy; + +class TarBz2FileStrategy extends AbstractFileStrategy +{ + /** + * {@inheritdoc} + */ + protected function getServiceNames() + { + return array( + 'Alchemy\\Zippy\\Adapter\\GNUTar\\TarBz2GNUTarAdapter', + 'Alchemy\\Zippy\\Adapter\\BSDTar\\TarBz2BSDTarAdapter' + ); + } + + /** + * {@inheritdoc} + */ + public function getFileExtension() + { + return 'tar.bz2'; + } +} diff --git a/old.vendor/alchemy/zippy/src/FileStrategy/TarFileStrategy.php b/old.vendor/alchemy/zippy/src/FileStrategy/TarFileStrategy.php new file mode 100644 index 00000000..b5fdae06 --- /dev/null +++ b/old.vendor/alchemy/zippy/src/FileStrategy/TarFileStrategy.php @@ -0,0 +1,34 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Alchemy\Zippy\FileStrategy; + +class TarFileStrategy extends AbstractFileStrategy +{ + /** + * {@inheritdoc} + */ + protected function getServiceNames() + { + return array( + 'Alchemy\\Zippy\\Adapter\\GNUTar\\TarGNUTarAdapter', + 'Alchemy\\Zippy\\Adapter\\BSDTar\\TarBSDTarAdapter' + ); + } + + /** + * {@inheritdoc} + */ + public function getFileExtension() + { + return 'tar'; + } +} diff --git a/old.vendor/alchemy/zippy/src/FileStrategy/TarGzFileStrategy.php b/old.vendor/alchemy/zippy/src/FileStrategy/TarGzFileStrategy.php new file mode 100644 index 00000000..a136e624 --- /dev/null +++ b/old.vendor/alchemy/zippy/src/FileStrategy/TarGzFileStrategy.php @@ -0,0 +1,34 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Alchemy\Zippy\FileStrategy; + +class TarGzFileStrategy extends AbstractFileStrategy +{ + /** + * {@inheritdoc} + */ + protected function getServiceNames() + { + return array( + 'Alchemy\\Zippy\\Adapter\\GNUTar\\TarGzGNUTarAdapter', + 'Alchemy\\Zippy\\Adapter\\BSDTar\\TarGzBSDTarAdapter' + ); + } + + /** + * {@inheritdoc} + */ + public function getFileExtension() + { + return 'tar.gz'; + } +} diff --git a/old.vendor/alchemy/zippy/src/FileStrategy/ZipFileStrategy.php b/old.vendor/alchemy/zippy/src/FileStrategy/ZipFileStrategy.php new file mode 100644 index 00000000..dfeb5c76 --- /dev/null +++ b/old.vendor/alchemy/zippy/src/FileStrategy/ZipFileStrategy.php @@ -0,0 +1,34 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Alchemy\Zippy\FileStrategy; + +class ZipFileStrategy extends AbstractFileStrategy +{ + /** + * {@inheritdoc} + */ + protected function getServiceNames() + { + return array( + 'Alchemy\\Zippy\\Adapter\\ZipAdapter', + 'Alchemy\\Zippy\\Adapter\\ZipExtensionAdapter' + ); + } + + /** + * {@inheritdoc} + */ + public function getFileExtension() + { + return 'zip'; + } +} diff --git a/old.vendor/alchemy/zippy/src/Parser/BSDTarOutputParser.php b/old.vendor/alchemy/zippy/src/Parser/BSDTarOutputParser.php new file mode 100644 index 00000000..e3fa0769 --- /dev/null +++ b/old.vendor/alchemy/zippy/src/Parser/BSDTarOutputParser.php @@ -0,0 +1,115 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace Alchemy\Zippy\Parser; + +use Alchemy\Zippy\Exception\RuntimeException; + +/** + * This class is responsible of parsing GNUTar command line output + */ +class BSDTarOutputParser implements ParserInterface +{ + const PERMISSIONS = '([ldrwx-]+)'; + const HARD_LINK = '(\d+)'; + const OWNER = '([a-z][-a-z0-9]*)'; + const GROUP = '([a-z][-a-z0-9]*)'; + const FILESIZE = '(\d*)'; + const DATE = '([a-zA-Z0-9]+\s+[a-z0-9]+\s+[a-z0-9:]+)'; + const FILENAME = '(.*)'; + + /** + * @inheritdoc + */ + public function parseFileListing($output) + { + $lines = array_values(array_filter(explode("\n", $output))); + $members = array(); + + // BSDTar outputs two differents format of date according to the mtime + // of the member. If the member is younger than six months the year is not shown. + // On 4.5+ FreeBSD system the day is displayed first + $dateFormats = array('M d Y', 'M d H:i', 'd M Y', 'd M H:i'); + + foreach ($lines as $line) { + $matches = array(); + + // drw-rw-r-- 0 toto titi 0 Jan 3 1980 practice/ + // -rw-rw-r-- 0 toto titi 10240 Jan 22 13:31 practice/records + if (!preg_match_all("#" . + self::PERMISSIONS . "\s+" . // match (drw-r--r--) + self::HARD_LINK . "\s+" . // match (1) + self::OWNER . "\s" . // match (toto) + self::GROUP . "\s+" . // match (titi) + self::FILESIZE . "\s+" . // match (0) + self::DATE . "\s+" . // match (Jan 3 1980) + self::FILENAME . // match (practice) + "#", $line, $matches, PREG_SET_ORDER + )) { + continue; + } + + $chunks = array_shift($matches); + + if (8 !== count($chunks)) { + continue; + } + + $date = null; + + foreach ($dateFormats as $format) { + $date = \DateTime::createFromFormat($format, $chunks[6]); + + if (false === $date) { + continue; + } else { + break; + } + } + + if (false === $date) { + throw new RuntimeException(sprintf('Failed to parse mtime date from %s', $line)); + } + + $members[] = array( + 'location' => $chunks[7], + 'size' => $chunks[5], + 'mtime' => $date, + 'is_dir' => 'd' === $chunks[1][0] + ); + } + + return $members; + } + + /** + * @inheritdoc + */ + public function parseInflatorVersion($output) + { + $chunks = explode(' ', $output, 3); + + if (2 > count($chunks)) { + return null; + } + + list(, $version) = explode(' ', $output, 3); + + return $version; + } + + /** + * @inheritdoc + */ + public function parseDeflatorVersion($output) + { + return $this->parseInflatorVersion($output); + } +} diff --git a/old.vendor/alchemy/zippy/src/Parser/GNUTarOutputParser.php b/old.vendor/alchemy/zippy/src/Parser/GNUTarOutputParser.php new file mode 100644 index 00000000..b28f9a22 --- /dev/null +++ b/old.vendor/alchemy/zippy/src/Parser/GNUTarOutputParser.php @@ -0,0 +1,98 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace Alchemy\Zippy\Parser; + +use Alchemy\Zippy\Exception\RuntimeException; + +/** + * This class is responsible of parsing GNUTar command line output + */ +class GNUTarOutputParser implements ParserInterface +{ + const PERMISSIONS = '([ldrwx-]+)'; + const OWNER = '([a-z][-a-z0-9]*)'; + const GROUP = '([a-z][-a-z0-9]*)'; + const FILESIZE = '(\d*)'; + const ISO_DATE = '([0-9]+-[0-9]+-[0-9]+\s+[0-9]+:[0-9]+)'; + const FILENAME = '(.*)'; + + /** + * @inheritdoc + */ + public function parseFileListing($output) + { + $lines = array_values(array_filter(explode("\n", $output))); + $members = array(); + + foreach ($lines as $line) { + $matches = array(); + + // -rw-r--r-- gray/staff 62373 2006-06-09 12:06 apple + if (!preg_match_all("#". + self::PERMISSIONS . "\s+" . // match (-rw-r--r--) + self::OWNER . "/" . // match (gray) + self::GROUP . "\s+" . // match (staff) + self::FILESIZE . "\s+" . // match (62373) + self::ISO_DATE . "\s+" . // match (2006-06-09 12:06) + self::FILENAME . // match (apple) + "#", + $line, $matches, PREG_SET_ORDER + )) { + continue; + } + + $chunks = array_shift($matches); + + if (7 !== count($chunks)) { + continue; + } + + $date = \DateTime::createFromFormat("Y-m-d H:i", $chunks[5]); + + if (false === $date) { + throw new RuntimeException(sprintf('Failed to parse mtime date from %s', $line)); + } + + $members[] = array( + 'location' => $chunks[6], + 'size' => $chunks[4], + 'mtime' => $date, + 'is_dir' => 'd' === $chunks[1][0] + ); + } + + return $members; + } + + /** + * @inheritdoc + */ + public function parseInflatorVersion($output) + { + $chunks = explode(' ', $output, 3); + + if (2 > count($chunks)) { + return null; + } + + list(, $version) = $chunks; + + return $version; + } + + /** + * @inheritdoc + */ + public function parseDeflatorVersion($output) + { + return $this->parseInflatorVersion($output); + } +} diff --git a/old.vendor/alchemy/zippy/src/Parser/ParserFactory.php b/old.vendor/alchemy/zippy/src/Parser/ParserFactory.php new file mode 100644 index 00000000..8b395c72 --- /dev/null +++ b/old.vendor/alchemy/zippy/src/Parser/ParserFactory.php @@ -0,0 +1,56 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Alchemy\Zippy\Parser; + +use Alchemy\Zippy\Exception\InvalidArgumentException; + +class ParserFactory +{ + + private static $zipDateFormat = 'Y-m-d H:i'; + + /** + * @param string $format Date format used to parse ZIP file listings + */ + public static function setZipDateFormat($format) + { + self::$zipDateFormat = $format; + } + + /** + * Maps the corresponding parser to the selected adapter + * + * @param string $adapterName An adapter name + * + * @return ParserInterface + * + * @throws InvalidArgumentException In case no parser were found + */ + public static function create($adapterName) + { + switch ($adapterName) { + case 'gnu-tar': + return new GNUTarOutputParser(); + break; + case 'bsd-tar': + return new BSDTarOutputParser(); + break; + case 'zip': + return new ZipOutputParser(self::$zipDateFormat); + break; + + default: + throw new InvalidArgumentException(sprintf('No parser available for %s adapter', $adapterName)); + break; + } + } +} diff --git a/old.vendor/alchemy/zippy/src/Parser/ParserInterface.php b/old.vendor/alchemy/zippy/src/Parser/ParserInterface.php new file mode 100644 index 00000000..c3024a1e --- /dev/null +++ b/old.vendor/alchemy/zippy/src/Parser/ParserInterface.php @@ -0,0 +1,46 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Alchemy\Zippy\Parser; + +use Alchemy\Zippy\Exception\RuntimeException; + +interface ParserInterface +{ + /** + * Parses a file listing + * + * @param string $output The string to parse + * + * @return array An array of Member properties (location, mtime, size & is_dir) + * + * @throws RuntimeException In case the parsing process failed + */ + public function parseFileListing($output); + + /** + * Parses the inflator binary version + * + * @param string $output + * + * @return string The version + */ + public function parseInflatorVersion($output); + + /** + * Parses the deflator binary version + * + * @param string $output + * + * @return string The version + */ + public function parseDeflatorVersion($output); +} diff --git a/old.vendor/alchemy/zippy/src/Parser/ZipOutputParser.php b/old.vendor/alchemy/zippy/src/Parser/ZipOutputParser.php new file mode 100644 index 00000000..a0ca6a22 --- /dev/null +++ b/old.vendor/alchemy/zippy/src/Parser/ZipOutputParser.php @@ -0,0 +1,120 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace Alchemy\Zippy\Parser; + +/** + * This class is responsible of parsing GNUTar command line output + */ +class ZipOutputParser implements ParserInterface +{ + const LENGTH = '(\d*)'; + const ISO_DATE = '([0-9]+-[0-9]+-[0-9]+\s+[0-9]+:[0-9]+)'; + const FILENAME = '(.*)'; + + /** + * @var string + */ + private $dateFormat; + + /** + * @param string $dateFormat + */ + public function __construct($dateFormat = "Y-m-d H:i") + { + $this->dateFormat = $dateFormat; + } + + /** + * @inheritdoc + */ + public function parseFileListing($output) + { + $lines = array_values(array_filter(explode("\n", $output))); + $members = array(); + + foreach ($lines as $line) { + $matches = array(); + + // 785 2012-10-24 10:39 file + if (!preg_match_all("#" . + self::LENGTH . "\s+" . // match (785) + self::ISO_DATE . "\s+" . // match (2012-10-24 10:39) + self::FILENAME . // match (file) + "#", + $line, $matches, PREG_SET_ORDER + )) { + continue; + } + + $chunks = array_shift($matches); + + if (4 !== count($chunks)) { + continue; + } + + $mtime = \DateTime::createFromFormat($this->dateFormat, $chunks[2]); + + if ($mtime === false) { + // See https://github.com/alchemy-fr/Zippy/issues/111#issuecomment-251668427 + $mtime = \DateTime::createFromFormat('H:i Y-m-d', $chunks[2]); + } + + if ($mtime === false) { + $mtime = new \DateTime($chunks[2]); + } + + $members[] = array( + 'location' => $chunks[3], + 'size' => $chunks[1], + 'mtime' => $mtime, + 'is_dir' => '/' === substr($chunks[3], -1) + ); + } + + return $members; + } + + /** + * @inheritdoc + */ + public function parseInflatorVersion($output) + { + $lines = array_values(array_filter(explode("\n", $output, 3))); + + $chunks = explode(' ', $lines[1], 3); + + if (2 > count($chunks)) { + return null; + } + + list(, $version) = $chunks; + + return $version; + } + + /** + * @inheritdoc + */ + public function parseDeflatorVersion($output) + { + $lines = array_values(array_filter(explode("\n", $output, 2))); + $firstLine = array_shift($lines); + $chunks = explode(' ', $firstLine, 3); + + if (2 > count($chunks)) { + return null; + } + + list(, $version) = $chunks; + + return $version; + } +} diff --git a/old.vendor/alchemy/zippy/src/ProcessBuilder/ProcessBuilderFactory.php b/old.vendor/alchemy/zippy/src/ProcessBuilder/ProcessBuilderFactory.php new file mode 100644 index 00000000..0caaf6a8 --- /dev/null +++ b/old.vendor/alchemy/zippy/src/ProcessBuilder/ProcessBuilderFactory.php @@ -0,0 +1,71 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Alchemy\Zippy\ProcessBuilder; + +use Alchemy\Zippy\Exception\InvalidArgumentException; +use Symfony\Component\Process\ProcessBuilder; + +class ProcessBuilderFactory implements ProcessBuilderFactoryInterface +{ + /** + * The binary path + * + * @var string + */ + protected $binary; + + /** + * Constructor + * + * @param string $binary The path to the binary + * + * @throws InvalidArgumentException In case binary path is invalid + */ + public function __construct($binary) + { + $this->useBinary($binary); + } + + /** + * @inheritdoc + */ + public function getBinary() + { + return $this->binary; + } + + /** + * @inheritdoc + */ + public function useBinary($binary) + { + if (!is_executable($binary)) { + throw new InvalidArgumentException(sprintf('`%s` is not an executable binary', $binary)); + } + + $this->binary = $binary; + + return $this; + } + + /** + * @inheritdoc + */ + public function create() + { + if (null === $this->binary) { + throw new InvalidArgumentException('No binary set'); + } + + return ProcessBuilder::create(array($this->binary))->setTimeout(null); + } +} diff --git a/old.vendor/alchemy/zippy/src/ProcessBuilder/ProcessBuilderFactoryInterface.php b/old.vendor/alchemy/zippy/src/ProcessBuilder/ProcessBuilderFactoryInterface.php new file mode 100644 index 00000000..a93e5a80 --- /dev/null +++ b/old.vendor/alchemy/zippy/src/ProcessBuilder/ProcessBuilderFactoryInterface.php @@ -0,0 +1,45 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Alchemy\Zippy\ProcessBuilder; + +use Alchemy\Zippy\Exception\InvalidArgumentException; +use Symfony\Component\Process\ProcessBuilder; + +interface ProcessBuilderFactoryInterface +{ + /** + * Returns a new instance of Symfony ProcessBuilder + * + * @return ProcessBuilder + * + * @throws InvalidArgumentException + */ + public function create(); + + /** + * Returns the binary path + * + * @return string + */ + public function getBinary(); + + /** + * Sets the binary path + * + * @param string $binary A binary path + * + * @return ProcessBuilderFactoryInterface + * + * @throws InvalidArgumentException In case binary is not executable + */ + public function useBinary($binary); +} diff --git a/old.vendor/alchemy/zippy/src/Resource/PathUtil.php b/old.vendor/alchemy/zippy/src/Resource/PathUtil.php new file mode 100644 index 00000000..ec7a46a6 --- /dev/null +++ b/old.vendor/alchemy/zippy/src/Resource/PathUtil.php @@ -0,0 +1,20 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Alchemy\Zippy\Resource; + +abstract class PathUtil +{ + public static function basename($path) + { + return (false === $pos = strrpos(strtr($path, '\\', '/'), '/')) ? $path : substr($path, $pos + 1); + } +} \ No newline at end of file diff --git a/old.vendor/alchemy/zippy/src/Resource/Reader/Guzzle/GuzzleReader.php b/old.vendor/alchemy/zippy/src/Resource/Reader/Guzzle/GuzzleReader.php new file mode 100644 index 00000000..46785cdd --- /dev/null +++ b/old.vendor/alchemy/zippy/src/Resource/Reader/Guzzle/GuzzleReader.php @@ -0,0 +1,59 @@ +resource = $resource; + $this->client = $client; + } + + /** + * @return string + */ + public function getContents() + { + return $this->buildRequest()->getBody()->getContents(); + } + + /** + * @return resource + */ + public function getContentsAsStream() + { + $response = $this->buildRequest()->getBody()->getContents(); + $stream = fopen('php://temp', 'r+'); + + if ($response != '') { + fwrite($stream, $response); + fseek($stream, 0); + } + + return $stream; + } + + private function buildRequest() + { + return $this->client->request('GET', $this->resource->getOriginal()); + } +} diff --git a/old.vendor/alchemy/zippy/src/Resource/Reader/Guzzle/GuzzleReaderFactory.php b/old.vendor/alchemy/zippy/src/Resource/Reader/Guzzle/GuzzleReaderFactory.php new file mode 100644 index 00000000..79eb27c5 --- /dev/null +++ b/old.vendor/alchemy/zippy/src/Resource/Reader/Guzzle/GuzzleReaderFactory.php @@ -0,0 +1,37 @@ +client = $client; + + if (! $this->client) { + $this->client = new Client(); + } + } + + /** + * @param ZippyResource $resource + * @param string $context + * + * @return ResourceReader + */ + public function getReader(ZippyResource $resource, $context) + { + return new GuzzleReader($resource, $this->client); + } +} diff --git a/old.vendor/alchemy/zippy/src/Resource/Reader/Guzzle/LegacyGuzzleReader.php b/old.vendor/alchemy/zippy/src/Resource/Reader/Guzzle/LegacyGuzzleReader.php new file mode 100644 index 00000000..79ef97a1 --- /dev/null +++ b/old.vendor/alchemy/zippy/src/Resource/Reader/Guzzle/LegacyGuzzleReader.php @@ -0,0 +1,67 @@ +client = $client ?: new Client(); + $this->resource = $resource; + } + + /** + * @return string + */ + public function getContents() + { + return $this->buildRequest()->send()->getBody(true); + } + + /** + * @return resource + */ + public function getContentsAsStream() + { + if (!$this->stream) { + $this->stream = $this->buildRequest()->send()->getBody(false); + } + + return $this->stream->getStream(); + } + + /** + * @return \Guzzle\Http\Message\RequestInterface + */ + private function buildRequest() + { + return $this->client->get($this->resource->getOriginal()); + } +} diff --git a/old.vendor/alchemy/zippy/src/Resource/Reader/Guzzle/LegacyGuzzleReaderFactory.php b/old.vendor/alchemy/zippy/src/Resource/Reader/Guzzle/LegacyGuzzleReaderFactory.php new file mode 100644 index 00000000..500f59a6 --- /dev/null +++ b/old.vendor/alchemy/zippy/src/Resource/Reader/Guzzle/LegacyGuzzleReaderFactory.php @@ -0,0 +1,47 @@ +client = $client; + + if (!$this->client) { + $this->client = new Client(); + + $this->client->getEventDispatcher()->addListener('request.error', function(Event $event) { + // override guzzle default behavior of throwing exceptions + // when 4xx & 5xx responses are encountered + $event->stopPropagation(); + }, -254); + + $this->client->addSubscriber(BackoffPlugin::getExponentialBackoff(5, array(500, 502, 503, 408))); + } + } + + /** + * @param ZippyResource $resource + * @param string $context + * + * @return ResourceReader + */ + public function getReader(ZippyResource $resource, $context) + { + return new LegacyGuzzleReader($resource, $this->client); + } +} diff --git a/old.vendor/alchemy/zippy/src/Resource/Reader/Stream/StreamReader.php b/old.vendor/alchemy/zippy/src/Resource/Reader/Stream/StreamReader.php new file mode 100644 index 00000000..c07062b1 --- /dev/null +++ b/old.vendor/alchemy/zippy/src/Resource/Reader/Stream/StreamReader.php @@ -0,0 +1,41 @@ +resource = $resource; + } + + /** + * @return string + */ + public function getContents() + { + return file_get_contents($this->resource->getOriginal()); + } + + /** + * @return resource + */ + public function getContentsAsStream() + { + $stream = is_resource($this->resource->getOriginal()) ? + $this->resource->getOriginal() : @fopen($this->resource->getOriginal(), 'rb'); + + return $stream; + } +} diff --git a/old.vendor/alchemy/zippy/src/Resource/Reader/Stream/StreamReaderFactory.php b/old.vendor/alchemy/zippy/src/Resource/Reader/Stream/StreamReaderFactory.php new file mode 100644 index 00000000..ca1d9865 --- /dev/null +++ b/old.vendor/alchemy/zippy/src/Resource/Reader/Stream/StreamReaderFactory.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Alchemy\Zippy\Resource; + +class RequestMapper +{ + private $locator; + + /** + * Constructor + * + * @param TargetLocator $locator + */ + public function __construct(TargetLocator $locator) + { + $this->locator = $locator; + } + + /** + * Maps resources request to a ResourceCollection + * + * @param $context + * @param array $resources + * + * @return ResourceCollection + */ + public function map($context, array $resources) + { + $data = array(); + + foreach ($resources as $location => $resource) { + if (is_int($location)) { + $data[] = new Resource($resource, $this->locator->locate($context, $resource)); + } else { + $data[] = new Resource($resource, ltrim($location, '/')); + } + } + + if (count($data) === 1) { + $context = $data[0]->getOriginal(); + } + + $collection = new ResourceCollection($context, $data, false); + + return $collection; + } + + /** + * Creates the default RequestMapper + * + * @return RequestMapper + */ + public static function create() + { + return new static(new TargetLocator()); + } +} diff --git a/old.vendor/alchemy/zippy/src/Resource/Resource.php b/old.vendor/alchemy/zippy/src/Resource/Resource.php new file mode 100644 index 00000000..7fb64aae --- /dev/null +++ b/old.vendor/alchemy/zippy/src/Resource/Resource.php @@ -0,0 +1,116 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Alchemy\Zippy\Resource; + +class Resource +{ + private $original; + private $target; + + /** + * Constructor + * + * @param string $original + * @param string $target + */ + public function __construct($original, $target) + { + $this->original = $original; + $this->target = $target; + } + + /** + * Returns the target + * + * @return string + */ + public function getTarget() + { + return $this->target; + } + + /** + * Returns the original path + * + * @return string + */ + public function getOriginal() + { + return $this->original; + } + + /** + * Returns whether the resource can be processed in place given a context or not. + * + * For example : + * - /path/to/file1 can be processed to file1 in /path/to context + * - /path/to/subdir/file2 can be processed to subdir/file2 in /path/to context + * + * @param string $context + * + * @return bool + */ + public function canBeProcessedInPlace($context) + { + if (!is_string($this->original)) { + return false; + } + + if (!$this->isLocal()) { + return false; + } + + $data = parse_url($this->original); + + return sprintf('%s/%s', rtrim($context, '/'), $this->target) === $data['path']; + } + + /** + * Returns a context for computing this resource in case it is possible. + * + * Useful to avoid teleporting. + * + * @return null|string + */ + public function getContextForProcessInSinglePlace() + { + if (!is_string($this->original)) { + return null; + } + + if (!$this->isLocal()) { + return null; + } + + if (PathUtil::basename($this->original) === $this->target) { + return dirname($this->original); + } + + return null; + } + + /** + * Returns true if the resource is local. + * + * @return bool + */ + private function isLocal() + { + if (!is_string($this->original)) { + return false; + } + + $data = parse_url($this->original); + + return isset($data['path']); + } +} diff --git a/old.vendor/alchemy/zippy/src/Resource/ResourceCollection.php b/old.vendor/alchemy/zippy/src/Resource/ResourceCollection.php new file mode 100644 index 00000000..f2ce1cad --- /dev/null +++ b/old.vendor/alchemy/zippy/src/Resource/ResourceCollection.php @@ -0,0 +1,89 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Alchemy\Zippy\Resource; + +use Alchemy\Zippy\Exception\InvalidArgumentException; +use Doctrine\Common\Collections\ArrayCollection; + +class ResourceCollection extends ArrayCollection +{ + private $context; + /** + * @var bool + */ + private $temporary; + + /** + * Constructor + * @param string $context + * @param Resource[] $elements An array of Resource + * @param bool $temporary + */ + public function __construct($context, array $elements, $temporary) + { + array_walk($elements, function($element) { + if (!$element instanceof Resource) { + throw new InvalidArgumentException('ResourceCollection only accept Resource elements'); + } + }); + + $this->context = $context; + $this->temporary = (bool) $temporary; + parent::__construct($elements); + } + + /** + * Returns the context related to the collection + * + * @return string + */ + public function getContext() + { + return $this->context; + } + + /** + * Tells whether the collection is temporary or not. + * + * A ResourceCollection is temporary when it required a temporary folder to + * fetch data + * + * @return bool + */ + public function isTemporary() + { + return $this->temporary; + } + + /** + * Returns true if all resources can be processed in place, false otherwise + * + * @return bool + */ + public function canBeProcessedInPlace() + { + if (count($this) === 1) { + if (null !== $context = $this->first()->getContextForProcessInSinglePlace()) { + $this->context = $context; + return true; + } + } + + foreach ($this as $resource) { + if (!$resource->canBeProcessedInPlace($this->context)) { + return false; + } + } + + return true; + } +} diff --git a/old.vendor/alchemy/zippy/src/Resource/ResourceLocator.php b/old.vendor/alchemy/zippy/src/Resource/ResourceLocator.php new file mode 100644 index 00000000..24edb13c --- /dev/null +++ b/old.vendor/alchemy/zippy/src/Resource/ResourceLocator.php @@ -0,0 +1,13 @@ +getTarget(); + } +} diff --git a/old.vendor/alchemy/zippy/src/Resource/ResourceManager.php b/old.vendor/alchemy/zippy/src/Resource/ResourceManager.php new file mode 100644 index 00000000..38cfd1fc --- /dev/null +++ b/old.vendor/alchemy/zippy/src/Resource/ResourceManager.php @@ -0,0 +1,105 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Alchemy\Zippy\Resource; + +use Alchemy\Zippy\Exception\IOException; +use Symfony\Component\Filesystem\Filesystem; +use Symfony\Component\Filesystem\Exception\IOException as SfIOException; + +class ResourceManager +{ + private $mapper; + private $teleporter; + private $filesystem; + + /** + * Constructor + * + * @param RequestMapper $mapper + * @param ResourceTeleporter $teleporter + * @param Filesystem $filesystem + */ + public function __construct(RequestMapper $mapper, ResourceTeleporter $teleporter, Filesystem $filesystem) + { + $this->mapper = $mapper; + $this->filesystem = $filesystem; + $this->teleporter = $teleporter; + } + + /** + * Handles an archival request. + * + * The request is an array of string|streams to compute in a context (current + * working directory most of the time) + * Some keys can be associative. In these cases, the key is used the target + * for the file. + * + * @param string $context + * @param array $request + * + * @return ResourceCollection + * + * @throws IOException In case of write failure + */ + public function handle($context, array $request) + { + $collection = $this->mapper->map($context, $request); + + if (!$collection->canBeProcessedInPlace()) { + $context = sprintf('%s/%s', sys_get_temp_dir(), uniqid('zippy_')); + + try { + $this->filesystem->mkdir($context); + } catch (SfIOException $e) { + throw new IOException(sprintf('Could not create temporary folder %s', $context), $e->getCode(), $e); + } + + foreach ($collection as $resource) { + $this->teleporter->teleport($context, $resource); + } + + $collection = new ResourceCollection($context, $collection->toArray(), true); + } + + return $collection; + } + + /** + * This method must be called once the ResourceCollection has been processed. + * + * It will remove temporary files + * + * @todo this should be done in the __destruct method of ResourceCollection + * + * @param ResourceCollection $collection + */ + public function cleanup(ResourceCollection $collection) + { + if ($collection->isTemporary()) { + try { + $this->filesystem->remove($collection->getContext()); + } catch (IOException $e) { + // log this ? + } + } + } + + /** + * Creates a default ResourceManager + * + * @return ResourceManager + */ + public static function create() + { + return new static(RequestMapper::create(), ResourceTeleporter::create(), new Filesystem()); + } +} diff --git a/old.vendor/alchemy/zippy/src/Resource/ResourceReader.php b/old.vendor/alchemy/zippy/src/Resource/ResourceReader.php new file mode 100644 index 00000000..34d4f583 --- /dev/null +++ b/old.vendor/alchemy/zippy/src/Resource/ResourceReader.php @@ -0,0 +1,16 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace Alchemy\Zippy\Resource; + +use Alchemy\Zippy\Resource\Resource as ZippyResource; + +class ResourceTeleporter +{ + private $container; + + /** + * Constructor + * + * @param TeleporterContainer $container + */ + public function __construct(TeleporterContainer $container) + { + $this->container = $container; + } + + /** + * Teleports a resource to its target in the context + * + * @param string $context + * @param ZippyResource $resource + * + * @return ResourceTeleporter + */ + public function teleport($context, ZippyResource $resource) + { + $this + ->container + ->fromResource($resource) + ->teleport($resource, $context); + + return $this; + } + + /** + * Creates the ResourceTeleporter with the default TeleporterContainer + * + * @return ResourceTeleporter + */ + public static function create() + { + return new static(TeleporterContainer::load()); + } +} diff --git a/old.vendor/alchemy/zippy/src/Resource/ResourceWriter.php b/old.vendor/alchemy/zippy/src/Resource/ResourceWriter.php new file mode 100644 index 00000000..00fcbae1 --- /dev/null +++ b/old.vendor/alchemy/zippy/src/Resource/ResourceWriter.php @@ -0,0 +1,8 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Alchemy\Zippy\Resource; + +use Alchemy\Zippy\Exception\TargetLocatorException; + +class TargetLocator +{ + /** + * Locates the target for a resource in a context + * + * For example, adding /path/to/file where the context (current working + * directory) is /path/to will return `file` as target + * + * @param string $context + * @param string|resource $resource + * + * @return string + * + * @throws TargetLocatorException when the resource is invalid + */ + public function locate($context, $resource) + { + switch (true) { + case is_resource($resource): + return $this->locateResource($resource); + case is_string($resource): + return $this->locateString($context, $resource); + case $resource instanceof \SplFileInfo: + return $this->locateString($context, $resource->getRealPath()); + default: + throw new TargetLocatorException($resource, 'Unknown resource format'); + } + } + + /** + * Locate the target for a resource. + * + * @param resource $resource + * + * @return string + * + * @throws TargetLocatorException + */ + private function locateResource($resource) + { + $meta = stream_get_meta_data($resource); + $data = parse_url($meta['uri']); + + if (!isset($data['path'])) { + throw new TargetLocatorException($resource, 'Unable to retrieve path from resource'); + } + + return PathUtil::basename($data['path']); + } + + /** + * Locate the target for a string. + * + * @param $context + * @param string $resource + * + * @return string + * + * @throws TargetLocatorException + */ + private function locateString($context, $resource) + { + $url = parse_url($resource); + + if (isset($url['scheme']) && $this->isLocalFilesystem($url['scheme'])) { + $resource = $url['path'] = $this->cleanupPath($url['path']); + } + + // resource is a URI + if (isset($url['scheme'])) { + if ($this->isLocalFilesystem($url['scheme']) && $this->isFileInContext($url['path'], $context)) { + return $this->getRelativePathFromContext($url['path'], $context); + } + + return PathUtil::basename($resource); + } + + // resource is a local path + if ($this->isFileInContext($resource, $context)) { + $resource = $this->cleanupPath($resource); + + return $this->getRelativePathFromContext($resource, $context); + } else { + return PathUtil::basename($resource); + } + } + + /** + * Removes backward path sequences (..) + * + * @param string $path + * + * @return string + * + * @throws TargetLocatorException In case the path is invalid + */ + private function cleanupPath($path) + { + if (false === $cleanPath = realpath($path)) { + throw new TargetLocatorException($path, sprintf('%s is an invalid location', $path)); + } + + return $cleanPath; + } + + /** + * Checks whether the path belong to the context + * + * @param string $path A resource path + * @param string $context + * + * @return bool + */ + private function isFileInContext($path, $context) + { + return 0 === strpos($path, $context); + } + + /** + * Gets the relative path from the context for the given path + * + * @param string $path A resource path + * @param string $context + * + * @return string + */ + private function getRelativePathFromContext($path, $context) + { + return ltrim(str_replace($context, '', $path), '/\\'); + } + + /** + * Checks if a scheme refers to a local filesystem + * + * @param string $scheme + * + * @return bool + */ + private function isLocalFilesystem($scheme) + { + return 'plainfile' === $scheme || 'file' === $scheme; + } +} diff --git a/old.vendor/alchemy/zippy/src/Resource/Teleporter/AbstractTeleporter.php b/old.vendor/alchemy/zippy/src/Resource/Teleporter/AbstractTeleporter.php new file mode 100644 index 00000000..401aed8d --- /dev/null +++ b/old.vendor/alchemy/zippy/src/Resource/Teleporter/AbstractTeleporter.php @@ -0,0 +1,64 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Alchemy\Zippy\Resource\Teleporter; + +use Alchemy\Zippy\Exception\IOException; +use Alchemy\Zippy\Resource\Resource as ZippyResource; + +/** + * Class AbstractTeleporter + * @package Alchemy\Zippy\Resource\Teleporter + * + * @deprecated Typehint against TeleporterInterface instead and use GenericTeleporter +* with custom reader/writers instead. This class will be removed in v0.5.x + */ +abstract class AbstractTeleporter implements TeleporterInterface +{ + /** + * Writes the target + * + * @param string $data + * @param ZippyResource $resource + * @param string $context + * + * @return TeleporterInterface + * + * @throws IOException + */ + protected function writeTarget($data, ZippyResource $resource, $context) + { + $target = $this->getTarget($context, $resource); + + if (!file_exists(dirname($target)) && false === mkdir(dirname($target))) { + throw new IOException(sprintf('Could not create parent directory %s', dirname($target))); + } + + if (false === file_put_contents($target, $data)) { + throw new IOException(sprintf('Could not write to %s', $target)); + } + + return $this; + } + + /** + * Returns the relative target of a Resource + * + * @param string $context + * @param ZippyResource $resource + * + * @return string + */ + protected function getTarget($context, ZippyResource $resource) + { + return sprintf('%s/%s', rtrim($context, '/'), $resource->getTarget()); + } +} diff --git a/old.vendor/alchemy/zippy/src/Resource/Teleporter/GenericTeleporter.php b/old.vendor/alchemy/zippy/src/Resource/Teleporter/GenericTeleporter.php new file mode 100644 index 00000000..ed7b51b2 --- /dev/null +++ b/old.vendor/alchemy/zippy/src/Resource/Teleporter/GenericTeleporter.php @@ -0,0 +1,60 @@ +readerFactory = $readerFactory; + $this->resourceWriter = $resourceWriter; + $this->resourceLocator = $resourceLocator ?: new ResourceLocator(); + } + + /** + * Teleports a file from a destination to an other + * + * @param ZippyResource $resource A Resource + * @param string $context The current context + * + * @throws IOException when file could not be written on local + * @throws InvalidArgumentException when path to file is not valid + */ + public function teleport(ZippyResource $resource, $context) + { + $reader = $this->readerFactory->getReader($resource, $context); + $target = $this->resourceLocator->mapResourcePath($resource, $context); + + $this->resourceWriter->writeFromReader($reader, $target); + } +} diff --git a/old.vendor/alchemy/zippy/src/Resource/Teleporter/GuzzleTeleporter.php b/old.vendor/alchemy/zippy/src/Resource/Teleporter/GuzzleTeleporter.php new file mode 100644 index 00000000..b2e14cbe --- /dev/null +++ b/old.vendor/alchemy/zippy/src/Resource/Teleporter/GuzzleTeleporter.php @@ -0,0 +1,45 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Alchemy\Zippy\Resource\Teleporter; + +use Alchemy\Zippy\Resource\Reader\Guzzle\GuzzleReaderFactory; +use Alchemy\Zippy\Resource\ResourceLocator; +use Alchemy\Zippy\Resource\ResourceReaderFactory; +use Alchemy\Zippy\Resource\Writer\FilesystemWriter; + +/** + * Guzzle Teleporter implementation for HTTP resources + * + * @deprecated Use \Alchemy\Zippy\Resource\GenericTeleporter instead. This class will be removed in v0.5.x + */ +class GuzzleTeleporter extends GenericTeleporter +{ + /** + * @param ResourceReaderFactory $readerFactory + * @param ResourceLocator $resourceLocator + */ + public function __construct(ResourceReaderFactory $readerFactory = null, ResourceLocator $resourceLocator = null) + { + parent::__construct($readerFactory ?: new GuzzleReaderFactory(), new FilesystemWriter(), $resourceLocator); + } + + /** + * Creates the GuzzleTeleporter + * + * @deprecated This method will be removed in v0.5.x + * @return GuzzleTeleporter + */ + public static function create() + { + return new static(); + } +} diff --git a/old.vendor/alchemy/zippy/src/Resource/Teleporter/LegacyGuzzleTeleporter.php b/old.vendor/alchemy/zippy/src/Resource/Teleporter/LegacyGuzzleTeleporter.php new file mode 100644 index 00000000..4d604d5c --- /dev/null +++ b/old.vendor/alchemy/zippy/src/Resource/Teleporter/LegacyGuzzleTeleporter.php @@ -0,0 +1,51 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Alchemy\Zippy\Resource\Teleporter; + +use Alchemy\Zippy\Resource\Reader\Guzzle\LegacyGuzzleReaderFactory; +use Alchemy\Zippy\Resource\ResourceLocator; +use Alchemy\Zippy\Resource\ResourceReaderFactory; +use Alchemy\Zippy\Resource\Writer\FilesystemWriter; +use Guzzle\Http\Client; + +/** + * Guzzle Teleporter implementation for HTTP resources + * + * @deprecated Use \Alchemy\Zippy\Resource\GenericTeleporter instead. This class will be removed in v0.5.x + */ +class LegacyGuzzleTeleporter extends GenericTeleporter +{ + /** + * @param Client $client + * @param ResourceReaderFactory $readerFactory + * @param ResourceLocator $resourceLocator + */ + public function __construct( + Client $client = null, + ResourceReaderFactory $readerFactory = null, + ResourceLocator $resourceLocator = null + ) { + parent::__construct($readerFactory ?: new LegacyGuzzleReaderFactory($client), new FilesystemWriter(), + $resourceLocator); + } + + /** + * Creates the GuzzleTeleporter + * + * @deprecated + * @return LegacyGuzzleTeleporter + */ + public static function create() + { + return new static(); + } +} diff --git a/old.vendor/alchemy/zippy/src/Resource/Teleporter/LocalTeleporter.php b/old.vendor/alchemy/zippy/src/Resource/Teleporter/LocalTeleporter.php new file mode 100644 index 00000000..2e3c5df7 --- /dev/null +++ b/old.vendor/alchemy/zippy/src/Resource/Teleporter/LocalTeleporter.php @@ -0,0 +1,82 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Alchemy\Zippy\Resource\Teleporter; + +use Alchemy\Zippy\Exception\InvalidArgumentException; +use Alchemy\Zippy\Exception\IOException; +use Alchemy\Zippy\Resource\Resource as ZippyResource; +use Alchemy\Zippy\Resource\ResourceLocator; +use Symfony\Component\Filesystem\Exception\IOException as SfIOException; +use Symfony\Component\Filesystem\Filesystem; + +/** + * This class transports an object using the local filesystem + */ +class LocalTeleporter extends AbstractTeleporter +{ + /** + * @var Filesystem + */ + private $filesystem; + + /** + * @var ResourceLocator + */ + private $resourceLocator; + + /** + * Constructor + * + * @param Filesystem $filesystem + */ + public function __construct(Filesystem $filesystem) + { + $this->filesystem = $filesystem; + $this->resourceLocator = new ResourceLocator(); + } + + /** + * {@inheritdoc} + */ + public function teleport(ZippyResource $resource, $context) + { + $target = $this->resourceLocator->mapResourcePath($resource, $context); + $path = $resource->getOriginal(); + + if (!file_exists($path)) { + throw new InvalidArgumentException(sprintf('Invalid path %s', $path)); + } + + try { + if (is_file($path)) { + $this->filesystem->copy($path, $target); + } elseif (is_dir($path)) { + $this->filesystem->mirror($path, $target); + } else { + throw new InvalidArgumentException(sprintf('Invalid file or directory %s', $path)); + } + } catch (SfIOException $e) { + throw new IOException(sprintf('Could not write %s', $target), $e->getCode(), $e); + } + } + + /** + * Creates the LocalTeleporter + * + * @return LocalTeleporter + * @deprecated This method will be removed in a future release (0.5.x) + */ + public static function create() + { + return new static(new Filesystem()); + } +} diff --git a/old.vendor/alchemy/zippy/src/Resource/Teleporter/StreamTeleporter.php b/old.vendor/alchemy/zippy/src/Resource/Teleporter/StreamTeleporter.php new file mode 100644 index 00000000..8b964ad9 --- /dev/null +++ b/old.vendor/alchemy/zippy/src/Resource/Teleporter/StreamTeleporter.php @@ -0,0 +1,38 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Alchemy\Zippy\Resource\Teleporter; + +use Alchemy\Zippy\Resource\Reader\Stream\StreamReaderFactory; +use Alchemy\Zippy\Resource\ResourceLocator; +use Alchemy\Zippy\Resource\Writer\StreamWriter; + +/** + * This class transport an object using php stream wrapper + */ +class StreamTeleporter extends GenericTeleporter +{ + public function __construct() + { + parent::__construct(new StreamReaderFactory(), new StreamWriter(), new ResourceLocator()); + } + + /** + * Creates the StreamTeleporter + * + * @return StreamTeleporter + * @deprecated This method will be removed in a future release (0.5.x) + */ + public static function create() + { + return new static(); + } +} diff --git a/old.vendor/alchemy/zippy/src/Resource/Teleporter/TeleporterInterface.php b/old.vendor/alchemy/zippy/src/Resource/Teleporter/TeleporterInterface.php new file mode 100644 index 00000000..afc2d043 --- /dev/null +++ b/old.vendor/alchemy/zippy/src/Resource/Teleporter/TeleporterInterface.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Alchemy\Zippy\Resource\Teleporter; + +use Alchemy\Zippy\Exception\InvalidArgumentException; +use Alchemy\Zippy\Exception\IOException; +use Alchemy\Zippy\Resource\Resource as ZippyResource; + +interface TeleporterInterface +{ + /** + * Teleports a file from a destination to an other + * + * @param ZippyResource $resource A Resource + * @param string $context The current context + * + * @throws IOException when file could not be written on local + * @throws InvalidArgumentException when path to file is not valid + */ + public function teleport(ZippyResource $resource, $context); +} diff --git a/old.vendor/alchemy/zippy/src/Resource/TeleporterContainer.php b/old.vendor/alchemy/zippy/src/Resource/TeleporterContainer.php new file mode 100644 index 00000000..57ddfdfe --- /dev/null +++ b/old.vendor/alchemy/zippy/src/Resource/TeleporterContainer.php @@ -0,0 +1,189 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Alchemy\Zippy\Resource; + +use Alchemy\Zippy\Exception\InvalidArgumentException; +use Alchemy\Zippy\Resource\Reader\Guzzle\GuzzleReaderFactory; +use Alchemy\Zippy\Resource\Reader\Guzzle\LegacyGuzzleReaderFactory; +use Alchemy\Zippy\Resource\Resource as ZippyResource; +use Alchemy\Zippy\Resource\Teleporter\GenericTeleporter; +use Alchemy\Zippy\Resource\Teleporter\LocalTeleporter; +use Alchemy\Zippy\Resource\Teleporter\StreamTeleporter; +use Alchemy\Zippy\Resource\Teleporter\TeleporterInterface; +use Alchemy\Zippy\Resource\Writer\FilesystemWriter; +use Symfony\Component\Filesystem\Filesystem; + +/** + * A container of TeleporterInterface + */ +class TeleporterContainer implements \ArrayAccess, \Countable +{ + /** + * @var TeleporterInterface[] + */ + private $teleporters = array(); + + /** + * @var callable[] + */ + private $factories = array(); + + /** + * Returns the appropriate TeleporterInterface for a given Resource + * + * @param ZippyResource $resource + * + * @return TeleporterInterface + */ + public function fromResource(ZippyResource $resource) + { + switch (true) { + case is_resource($resource->getOriginal()): + $teleporter = 'stream-teleporter'; + break; + case is_string($resource->getOriginal()): + $data = parse_url($resource->getOriginal()); + + if (!isset($data['scheme']) || 'file' === $data['scheme']) { + $teleporter = 'local-teleporter'; + } elseif (in_array($data['scheme'], array('http', 'https')) && isset($this->factories['guzzle-teleporter'])) { + $teleporter = 'guzzle-teleporter'; + } else { + $teleporter = 'stream-teleporter'; + } + break; + default: + throw new InvalidArgumentException('No teleporter found'); + } + + return $this->getTeleporter($teleporter); + } + + private function getTeleporter($typeName) + { + if (!isset($this->teleporters[$typeName])) { + $factory = $this->factories[$typeName]; + $this->teleporters[$typeName] = $factory(); + } + + return $this->teleporters[$typeName]; + } + + /** + * Instantiates TeleporterContainer and register default teleporters + * + * @return TeleporterContainer + */ + public static function load() + { + $container = new static(); + + $container->factories['stream-teleporter'] = function () { + return new StreamTeleporter(); + }; + + $container->factories['local-teleporter'] = function () { + return new LocalTeleporter(new Filesystem()); + }; + + if (class_exists('GuzzleHttp\Client')) { + $container->factories['guzzle-teleporter'] = function () { + return new GenericTeleporter( + new GuzzleReaderFactory(), + new FilesystemWriter(), + new ResourceLocator() + ); + }; + } + elseif (class_exists('Guzzle\Http\Client')) { + $container->factories['guzzle-teleporter'] = function () { + return new GenericTeleporter( + new LegacyGuzzleReaderFactory(), + new FilesystemWriter(), + new ResourceLocator() + ); + }; + } + + return $container; + } + + /** + * (PHP 5 >= 5.0.0)
+ * Whether a offset exists + * + * @link http://php.net/manual/en/arrayaccess.offsetexists.php + * + * @param mixed $offset

+ * An offset to check for. + *

+ * + * @return bool true on success or false on failure. + *

+ *

+ * The return value will be casted to boolean if non-boolean was returned. + */ + public function offsetExists($offset) + { + return isset($this->teleporters[$offset]); + } + + /** + * (PHP 5 >= 5.0.0)
+ * Offset to retrieve + * @link http://php.net/manual/en/arrayaccess.offsetget.php + * @param mixed $offset

+ * The offset to retrieve. + *

+ * @return mixed Can return all value types. + */ + public function offsetGet($offset) + { + return $this->getTeleporter($offset); + } + + /** + * (PHP 5 >= 5.0.0)
+ * Offset to set + * @link http://php.net/manual/en/arrayaccess.offsetset.php + * @param mixed $offset

+ * The offset to assign the value to. + *

+ * @param mixed $value

+ * The value to set. + *

+ * @return void + */ + public function offsetSet($offset, $value) + { + throw new \BadMethodCallException(); + } + + /** + * (PHP 5 >= 5.0.0)
+ * Offset to unset + * @link http://php.net/manual/en/arrayaccess.offsetunset.php + * @param mixed $offset

+ * The offset to unset. + *

+ * @return void + */ + public function offsetUnset($offset) + { + throw new \BadMethodCallException(); + } + + public function count() + { + return count($this->teleporters); + } +} diff --git a/old.vendor/alchemy/zippy/src/Resource/Writer/FilesystemWriter.php b/old.vendor/alchemy/zippy/src/Resource/Writer/FilesystemWriter.php new file mode 100644 index 00000000..2bba475d --- /dev/null +++ b/old.vendor/alchemy/zippy/src/Resource/Writer/FilesystemWriter.php @@ -0,0 +1,23 @@ +getContentsAsStream()); + } +} diff --git a/old.vendor/alchemy/zippy/src/Resource/Writer/StreamWriter.php b/old.vendor/alchemy/zippy/src/Resource/Writer/StreamWriter.php new file mode 100644 index 00000000..d5780c92 --- /dev/null +++ b/old.vendor/alchemy/zippy/src/Resource/Writer/StreamWriter.php @@ -0,0 +1,27 @@ +getContentsAsStream(); + + stream_copy_to_stream($sourceResource, $targetResource); + fclose($targetResource); + } +} diff --git a/old.vendor/alchemy/zippy/src/Zippy.php b/old.vendor/alchemy/zippy/src/Zippy.php new file mode 100644 index 00000000..e9f2f660 --- /dev/null +++ b/old.vendor/alchemy/zippy/src/Zippy.php @@ -0,0 +1,222 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Alchemy\Zippy; + +use Alchemy\Zippy\Adapter\AdapterContainer; +use Alchemy\Zippy\Adapter\AdapterInterface; +use Alchemy\Zippy\Archive\ArchiveInterface; +use Alchemy\Zippy\Exception\ExceptionInterface; +use Alchemy\Zippy\Exception\FormatNotSupportedException; +use Alchemy\Zippy\Exception\NoAdapterOnPlatformException; +use Alchemy\Zippy\Exception\RuntimeException; +use Alchemy\Zippy\FileStrategy\FileStrategyInterface; +use Alchemy\Zippy\FileStrategy\TarBz2FileStrategy; +use Alchemy\Zippy\FileStrategy\TarFileStrategy; +use Alchemy\Zippy\FileStrategy\TarGzFileStrategy; +use Alchemy\Zippy\FileStrategy\TB2FileStrategy; +use Alchemy\Zippy\FileStrategy\TBz2FileStrategy; +use Alchemy\Zippy\FileStrategy\TGzFileStrategy; +use Alchemy\Zippy\FileStrategy\ZipFileStrategy; + +class Zippy +{ + /** + * @var AdapterContainer + */ + public $adapters; + + /** + * @var FileStrategyInterface[][] + */ + private $strategies = array(); + + public function __construct(AdapterContainer $adapters) + { + $this->adapters = $adapters; + } + + /** + * Creates an archive + * + * @param string $path + * @param string|array|\Traversable|null $files + * @param bool $recursive + * @param string|null $type + * + * @return ArchiveInterface + * + * @throws RuntimeException In case of failure + */ + public function create($path, $files = null, $recursive = true, $type = null) + { + if (null === $type) { + $type = $this->guessAdapterExtension($path); + } + + try { + return $this + ->getAdapterFor($this->sanitizeExtension($type)) + ->create($path, $files, $recursive); + } catch (ExceptionInterface $e) { + throw new RuntimeException('Unable to create archive', $e->getCode(), $e); + } + } + + /** + * Opens an archive. + * + * @param string $path + * + * @return ArchiveInterface + * + * @throws RuntimeException In case of failure + */ + public function open($path, $type = null) + { + if (null === $type) { + $type = $this->guessAdapterExtension($path); + } + + try { + return $this + ->getAdapterFor($this->sanitizeExtension($type)) + ->open($path); + } catch (ExceptionInterface $e) { + throw new RuntimeException('Unable to open archive', $e->getCode(), $e); + } + } + + /** + * Adds a strategy. + * + * The last strategy added is preferred over the other ones. + * You can add a strategy twice ; when doing this, the first one is removed + * when inserting the second one. + * + * @param FileStrategyInterface $strategy + * + * @return Zippy + */ + public function addStrategy(FileStrategyInterface $strategy) + { + $extension = $this->sanitizeExtension($strategy->getFileExtension()); + + if (!isset($this->strategies[$extension])) { + $this->strategies[$extension] = array(); + } + + if (false !== $key = array_search($strategy, $this->strategies[$extension], true)) { + unset($this->strategies[$extension][$key]); + } + + array_unshift($this->strategies[$extension], $strategy); + + return $this; + } + + /** + * Returns the strategies as they are stored + * + * @return array + */ + public function getStrategies() + { + return $this->strategies; + } + + /** + * Returns an adapter for a file extension + * + * @param string $extension The extension + * + * @return AdapterInterface + * + * @throws FormatNotSupportedException When no strategy is defined for this extension + * @throws NoAdapterOnPlatformException When no adapter is supported for this extension on this platform + */ + public function getAdapterFor($extension) + { + $extension = $this->sanitizeExtension($extension); + + if (!$extension || !isset($this->strategies[$extension])) { + throw new FormatNotSupportedException(sprintf('No strategy for %s extension', $extension)); + } + + foreach ($this->strategies[$extension] as $strategy) { + foreach ($strategy->getAdapters() as $adapter) { + if ($adapter->isSupported()) { + return $adapter; + } + } + } + + throw new NoAdapterOnPlatformException(sprintf('No adapter available for %s on this platform', $extension)); + } + + /** + * Creates Zippy and loads default strategies + * + * @return Zippy + */ + public static function load() + { + $adapters = AdapterContainer::load(); + $factory = new static($adapters); + + $factory->addStrategy(new ZipFileStrategy($adapters)); + $factory->addStrategy(new TarFileStrategy($adapters)); + $factory->addStrategy(new TarGzFileStrategy($adapters)); + $factory->addStrategy(new TarBz2FileStrategy($adapters)); + $factory->addStrategy(new TB2FileStrategy($adapters)); + $factory->addStrategy(new TBz2FileStrategy($adapters)); + $factory->addStrategy(new TGzFileStrategy($adapters)); + + return $factory; + } + + /** + * Sanitize an extension. + * + * Strips dot from the beginning, converts to lowercase and remove trailing + * whitespaces + * + * @param string $extension + * + * @return string + */ + private function sanitizeExtension($extension) + { + return ltrim(trim(mb_strtolower($extension)), '.'); + } + + /** + * Finds an extension that has strategy registered given a file path + * + * Returns null if no matching strategy found. + * + * @param string $path + * + * @return string|null + */ + private function guessAdapterExtension($path) + { + $path = strtolower(trim($path)); + + foreach ($this->strategies as $extension => $strategy) { + if ($extension === substr($path, (strlen($extension) * -1))) { + return $extension; + } + } + + return null; + } +} diff --git a/old.vendor/asm89/stack-cors/LICENSE b/old.vendor/asm89/stack-cors/LICENSE new file mode 100644 index 00000000..d9f2067d --- /dev/null +++ b/old.vendor/asm89/stack-cors/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2013-2017 Alexander + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +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. diff --git a/old.vendor/asm89/stack-cors/README.md b/old.vendor/asm89/stack-cors/README.md new file mode 100644 index 00000000..40b60e5b --- /dev/null +++ b/old.vendor/asm89/stack-cors/README.md @@ -0,0 +1,83 @@ +# Stack/Cors + +Library and middleware enabling cross-origin resource sharing for your +http-{foundation,kernel} using application. It attempts to implement the +[W3C Recommendation] for cross-origin resource sharing. + +[W3C Recommendation]: http://www.w3.org/TR/cors/ + +Master [![Build Status](https://secure.travis-ci.org/asm89/stack-cors.png?branch=master)](http://travis-ci.org/asm89/stack-cors) + +## Installation + +Require `asm89/stack-cors` using composer. + +## Usage + +This package can be used as a library or as [stack middleware]. + +[stack middleware]: http://stackphp.com/ + +### Options + +| Option | Description | Default value | +|------------------------|------------------------------------------------------------|---------------| +| allowedMethods | Matches the request method. | `array()` | +| allowedOrigins | Matches the request origin. | `array()` | +| allowedOriginsPatterns | Matches the request origin with `preg_match`. | `array()` | +| allowedHeaders | Sets the Access-Control-Allow-Headers response header. | `array()` | +| exposedHeaders | Sets the Access-Control-Expose-Headers response header. | `false` | +| maxAge | Sets the Access-Control-Max-Age response header. | `false` | +| supportsCredentials | Sets the Access-Control-Allow-Credentials header. | `false` | + +The _allowedMethods_ and _allowedHeaders_ options are case-insensitive. + +You don't need to provide both _allowedOrigins_ and _allowedOriginsPatterns_. If one of the strings passed matches, it is considered a valid origin. + +If `array('*')` is provided to _allowedMethods_, _allowedOrigins_ or _allowedHeaders_ all methods / origins / headers are allowed. + +### Example: using the library + +```php + array('x-allowed-header', 'x-other-allowed-header'), + 'allowedMethods' => array('DELETE', 'GET', 'POST', 'PUT'), + 'allowedOrigins' => array('localhost'), + 'allowedOriginsPatterns' => array('/localhost:\d/'), + 'exposedHeaders' => false, + 'maxAge' => false, + 'supportsCredentials' => false, +)); + +$cors->addActualRequestHeaders(Response $response, $origin); +$cors->handlePreflightRequest(Request $request); +$cors->isActualRequestAllowed(Request $request); +$cors->isCorsRequest(Request $request); +$cors->isPreflightRequest(Request $request); +``` + +## Example: using the stack middleware + +```php + array('x-allowed-header', 'x-other-allowed-header'), + // you can use array('*') to allow any methods + 'allowedMethods' => array('DELETE', 'GET', 'POST', 'PUT'), + // you can use array('*') to allow requests from any origin + 'allowedOrigins' => array('localhost'), + // you can enter regexes that are matched to the origin request header + 'allowedOriginsPatterns' => array('/localhost:\d/'), + 'exposedHeaders' => false, + 'maxAge' => false, + 'supportsCredentials' => false, +)); +``` diff --git a/old.vendor/asm89/stack-cors/composer.json b/old.vendor/asm89/stack-cors/composer.json new file mode 100644 index 00000000..b629bf19 --- /dev/null +++ b/old.vendor/asm89/stack-cors/composer.json @@ -0,0 +1,43 @@ +{ + "name": "asm89/stack-cors", + "description": "Cross-origin resource sharing library and stack middleware", + "keywords": ["stack", "cors"], + "homepage": "https://github.com/asm89/stack-cors", + "type": "library", + "license": "MIT", + "authors": [ + { + "name": "Alexander", + "email": "iam.asm89@gmail.com" + } + ], + "require": { + "php": ">=5.5.9", + "symfony/http-foundation": "~2.7|~3.0|~4.0|~5.0", + "symfony/http-kernel": "~2.7|~3.0|~4.0|~5.0" + }, + "require-dev": { + "phpunit/phpunit": "^5.0 || ^4.8.10", + "squizlabs/php_codesniffer": "^2.3" + }, + "autoload": { + "psr-4": { + "Asm89\\Stack\\": "src/Asm89/Stack/" + } + }, + "autoload-dev": { + "psr-4": { + "Asm89\\Stack\\": "test/Asm89/Stack/" + } + }, + "scripts": { + "test": "phpunit", + "check-style": "phpcs -p --standard=PSR2 --runtime-set ignore_errors_on_exit 1 --runtime-set ignore_warnings_on_exit 1 src", + "fix-style": "phpcbf -p --standard=PSR2 --runtime-set ignore_errors_on_exit 1 --runtime-set ignore_warnings_on_exit 1 src" + }, + "extra": { + "branch-alias": { + "dev-master": "1.2-dev" + } + } +} diff --git a/old.vendor/asm89/stack-cors/src/Asm89/Stack/Cors.php b/old.vendor/asm89/stack-cors/src/Asm89/Stack/Cors.php new file mode 100644 index 00000000..e5735f91 --- /dev/null +++ b/old.vendor/asm89/stack-cors/src/Asm89/Stack/Cors.php @@ -0,0 +1,64 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Asm89\Stack; + +use Symfony\Component\HttpKernel\HttpKernelInterface; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; + +class Cors implements HttpKernelInterface +{ + /** + * @var \Symfony\Component\HttpKernel\HttpKernelInterface + */ + private $app; + + /** + * @var \Asm89\Stack\CorsService + */ + private $cors; + + private $defaultOptions = array( + 'allowedHeaders' => array(), + 'allowedMethods' => array(), + 'allowedOrigins' => array(), + 'allowedOriginsPatterns' => array(), + 'exposedHeaders' => false, + 'maxAge' => false, + 'supportsCredentials' => false, + ); + + public function __construct(HttpKernelInterface $app, array $options = array()) + { + $this->app = $app; + $this->cors = new CorsService(array_merge($this->defaultOptions, $options)); + } + + public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true) + { + if (!$this->cors->isCorsRequest($request)) { + return $this->app->handle($request, $type, $catch); + } + + if ($this->cors->isPreflightRequest($request)) { + return $this->cors->handlePreflightRequest($request); + } + + if (!$this->cors->isActualRequestAllowed($request)) { + return new Response('Not allowed.', 403); + } + + $response = $this->app->handle($request, $type, $catch); + + return $this->cors->addActualRequestHeaders($response, $request); + } +} diff --git a/old.vendor/asm89/stack-cors/src/Asm89/Stack/CorsService.php b/old.vendor/asm89/stack-cors/src/Asm89/Stack/CorsService.php new file mode 100644 index 00000000..3ce324a9 --- /dev/null +++ b/old.vendor/asm89/stack-cors/src/Asm89/Stack/CorsService.php @@ -0,0 +1,205 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Asm89\Stack; + +use Symfony\Component\HttpKernel\HttpKernelInterface; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; + +class CorsService +{ + private $options; + + public function __construct(array $options = array()) + { + $this->options = $this->normalizeOptions($options); + } + + private function normalizeOptions(array $options = array()) + { + $options += array( + 'allowedOrigins' => array(), + 'allowedOriginsPatterns' => array(), + 'supportsCredentials' => false, + 'allowedHeaders' => array(), + 'exposedHeaders' => array(), + 'allowedMethods' => array(), + 'maxAge' => 0, + ); + + // normalize array('*') to true + if (in_array('*', $options['allowedOrigins'])) { + $options['allowedOrigins'] = true; + } + if (in_array('*', $options['allowedHeaders'])) { + $options['allowedHeaders'] = true; + } else { + $options['allowedHeaders'] = array_map('strtolower', $options['allowedHeaders']); + } + + if (in_array('*', $options['allowedMethods'])) { + $options['allowedMethods'] = true; + } else { + $options['allowedMethods'] = array_map('strtoupper', $options['allowedMethods']); + } + + return $options; + } + + public function isActualRequestAllowed(Request $request) + { + return $this->checkOrigin($request); + } + + public function isCorsRequest(Request $request) + { + return $request->headers->has('Origin') && !$this->isSameHost($request); + } + + public function isPreflightRequest(Request $request) + { + return $this->isCorsRequest($request) + && $request->getMethod() === 'OPTIONS' + && $request->headers->has('Access-Control-Request-Method'); + } + + public function addActualRequestHeaders(Response $response, Request $request) + { + if (!$this->checkOrigin($request)) { + return $response; + } + + $response->headers->set('Access-Control-Allow-Origin', $request->headers->get('Origin')); + + if (!$response->headers->has('Vary')) { + $response->headers->set('Vary', 'Origin'); + } else { + $response->headers->set('Vary', $response->headers->get('Vary') . ', Origin'); + } + + if ($this->options['supportsCredentials']) { + $response->headers->set('Access-Control-Allow-Credentials', 'true'); + } + + if ($this->options['exposedHeaders']) { + $response->headers->set('Access-Control-Expose-Headers', implode(', ', $this->options['exposedHeaders'])); + } + + return $response; + } + + public function handlePreflightRequest(Request $request) + { + if (true !== $check = $this->checkPreflightRequestConditions($request)) { + return $check; + } + + return $this->buildPreflightCheckResponse($request); + } + + private function buildPreflightCheckResponse(Request $request) + { + $response = new Response(); + + if ($this->options['supportsCredentials']) { + $response->headers->set('Access-Control-Allow-Credentials', 'true'); + } + + $response->headers->set('Access-Control-Allow-Origin', $request->headers->get('Origin')); + + if ($this->options['maxAge']) { + $response->headers->set('Access-Control-Max-Age', $this->options['maxAge']); + } + + $allowMethods = $this->options['allowedMethods'] === true + ? strtoupper($request->headers->get('Access-Control-Request-Method')) + : implode(', ', $this->options['allowedMethods']); + $response->headers->set('Access-Control-Allow-Methods', $allowMethods); + + $allowHeaders = $this->options['allowedHeaders'] === true + ? strtoupper($request->headers->get('Access-Control-Request-Headers')) + : implode(', ', $this->options['allowedHeaders']); + $response->headers->set('Access-Control-Allow-Headers', $allowHeaders); + + $response->setStatusCode(204); + + return $response; + } + + private function checkPreflightRequestConditions(Request $request) + { + if (!$this->checkOrigin($request)) { + return $this->createBadRequestResponse(403, 'Origin not allowed'); + } + + if (!$this->checkMethod($request)) { + return $this->createBadRequestResponse(405, 'Method not allowed'); + } + + $requestHeaders = array(); + // if allowedHeaders has been set to true ('*' allow all flag) just skip this check + if ($this->options['allowedHeaders'] !== true && $request->headers->has('Access-Control-Request-Headers')) { + $headers = strtolower($request->headers->get('Access-Control-Request-Headers')); + $requestHeaders = array_filter(explode(',', $headers)); + + foreach ($requestHeaders as $header) { + if (!in_array(trim($header), $this->options['allowedHeaders'])) { + return $this->createBadRequestResponse(403, 'Header not allowed'); + } + } + } + + return true; + } + + private function createBadRequestResponse($code, $reason = '') + { + return new Response($reason, $code); + } + + private function isSameHost(Request $request) + { + return $request->headers->get('Origin') === $request->getSchemeAndHttpHost(); + } + + private function checkOrigin(Request $request) + { + if ($this->options['allowedOrigins'] === true) { + // allow all '*' flag + return true; + } + $origin = $request->headers->get('Origin'); + + if (in_array($origin, $this->options['allowedOrigins'])) { + return true; + } + + foreach ($this->options['allowedOriginsPatterns'] as $pattern) { + if (preg_match($pattern, $origin)) { + return true; + } + } + + return false; + } + + private function checkMethod(Request $request) + { + if ($this->options['allowedMethods'] === true) { + // allow all '*' flag + return true; + } + + $requestMethod = strtoupper($request->headers->get('Access-Control-Request-Method')); + return in_array($requestMethod, $this->options['allowedMethods']); + } +} diff --git a/old.vendor/autoload.php b/old.vendor/autoload.php new file mode 100644 index 00000000..06d22ded --- /dev/null +++ b/old.vendor/autoload.php @@ -0,0 +1,7 @@ + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. diff --git a/old.vendor/chi-teck/drupal-code-generator/README.md b/old.vendor/chi-teck/drupal-code-generator/README.md new file mode 100644 index 00000000..c2a140b2 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/README.md @@ -0,0 +1,46 @@ +# Drupal Code Generator + +[![Build Status](https://travis-ci.org/Chi-teck/drupal-code-generator.svg?branch=master)](https://travis-ci.org/Chi-teck/drupal-code-generator) + +A command line code generator for Drupal. + +## Installation + +1. Download the latest [stable release](https://github.com/Chi-teck/drupal-code-generator/releases/latest) of the code generator. +2. Make the file executable. +3. Move it to a directory that is part of your `PATH`. + +```shell +release_url=https://api.github.com/repos/chi-teck/drupal-code-generator/releases/latest +wget $(wget -qO- $release_url | awk -F'"' '/browser_download_url/ { print $4 }') +chmod +x dcg.phar +sudo mv dcg.phar /usr/local/bin/dcg +dcg --version +``` +Installation using Composer is also supported. + +## Upgrade +Simply repeat installation commands. + +## Usage +```shell +# Display main menu. +dcg + +# Display Drupal 8 submenu. +dcg d8 + +# Call generator directly. +dcg d8:plugin:field:widget + +# Generate code non-interactively. +dcg twig-extension -a '{"name": "Example", "machine_name": "example", "class": "ExampleTwigExtension"}' +``` +## Extending +All custom generators should be placed to _$HOME/.dcg/Command_ directory. The following command will help you to get started with creating own generators. +```bash +# Create custom DCG command. +dcg dcg-command -d $HOME/.dcg/Command +``` +## License +GNU General Public License, version 2 or later. diff --git a/old.vendor/chi-teck/drupal-code-generator/bin/dcg b/old.vendor/chi-teck/drupal-code-generator/bin/dcg new file mode 100755 index 00000000..272d182f --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/bin/dcg @@ -0,0 +1,35 @@ +#!/usr/bin/env php +addPsr4('DrupalCodeGenerator\\', $home . '/.dcg'); +} +$generators = $discovery->getGenerators($commands_directories); +$application->addCommands($generators); + +// Add the navigation command. +$application->add(new Navigation($generators)); +$application->setDefaultCommand('navigation'); + +// Run. +$application->run(); diff --git a/old.vendor/chi-teck/drupal-code-generator/composer.json b/old.vendor/chi-teck/drupal-code-generator/composer.json new file mode 100644 index 00000000..0b31319a --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/composer.json @@ -0,0 +1,29 @@ +{ + "name": "chi-teck/drupal-code-generator", + "description": "Drupal code generator", + "require": { + "php": ">=5.5.9", + "ext-json": "*", + "symfony/console": "^3.4 || ^4.0", + "symfony/filesystem": "^2.7 || ^3.4 || ^4.0", + "twig/twig": "^1.41 || ^2.12" + }, + "conflict": { + "drush/drush": "< 10.3.2" + }, + "bin": [ + "bin/dcg" + ], + "autoload": { + "files": ["src/bootstrap.php"], + "psr-4": { + "DrupalCodeGenerator\\": "src" + } + }, + "license": "GPL-2.0-or-later", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + } +} diff --git a/old.vendor/chi-teck/drupal-code-generator/resources/service-definitions.json b/old.vendor/chi-teck/drupal-code-generator/resources/service-definitions.json new file mode 100644 index 00000000..587ee39b --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/resources/service-definitions.json @@ -0,0 +1 @@ +{"access_arguments_resolver_factory":{"type":"Drupal\\Core\\Access\\AccessArgumentsResolverFactoryInterface","name":"arguments_resolver_factory","description":"The access arguments resolver."},"access_check.book.removable":{"type":"Drupal\\Core\\Routing\\Access\\AccessInterface","name":"access_check_book_removable","description":"The access_check.book.removable service."},"access_check.contact_personal":{"type":"Drupal\\Core\\Routing\\Access\\AccessInterface","name":"access_check_contact_personal","description":"The access_check.contact_personal service."},"access_check.cron":{"type":"Drupal\\Core\\Routing\\Access\\AccessInterface","name":"access_check_cron","description":"The access_check.cron service."},"access_check.csrf":{"type":"Drupal\\Core\\Routing\\Access\\AccessInterface","name":"access_check_csrf","description":"The access_check.csrf service."},"access_check.custom":{"type":"Drupal\\Core\\Routing\\Access\\AccessInterface","name":"access_check_custom","description":"The access_check.custom service."},"access_check.db_update":{"type":"Drupal\\Core\\Routing\\Access\\AccessInterface","name":"access_check_db_update","description":"The access_check.db_update service."},"access_check.default":{"type":"Drupal\\Core\\Routing\\Access\\AccessInterface","name":"access_check_default","description":"The access_check.default service."},"access_check.entity":{"type":"Drupal\\Core\\Routing\\Access\\AccessInterface","name":"access_check_entity","description":"The access_check.entity service."},"access_check.entity.layout":{"type":"Drupal\\Core\\Routing\\Access\\AccessInterface","name":"access_check_entity_layout","description":"The access_check.entity.layout service."},"access_check.entity.layout_builder_access":{"type":"Drupal\\Core\\Routing\\Access\\AccessInterface","name":"access_check_entity_layout_builder_access","description":"The access_check.entity.layout_builder_access service."},"access_check.entity_create":{"type":"Drupal\\Core\\Routing\\Access\\AccessInterface","name":"access_check_entity_create","description":"The access_check.entity_create service."},"access_check.entity_create_any":{"type":"Drupal\\Core\\Routing\\Access\\AccessInterface","name":"access_check_entity_create_any","description":"The access_check.entity_create_any service."},"access_check.entity_delete_multiple":{"type":"Drupal\\Core\\Routing\\Access\\AccessInterface","name":"access_check_entity_delete_multiple","description":"The access_check.entity_delete_multiple service."},"access_check.field_ui.form_mode":{"type":"Drupal\\Core\\Routing\\Access\\AccessInterface","name":"access_check_field_ui_form_mode","description":"The access_check.field_ui.form_mode service."},"access_check.field_ui.view_mode":{"type":"Drupal\\Core\\Routing\\Access\\AccessInterface","name":"access_check_field_ui_view_mode","description":"The access_check.field_ui.view_mode service."},"access_check.header.csrf":{"type":"Drupal\\Core\\Access\\AccessCheckInterface","name":"access_check_header_csrf","description":"The access_check.header.csrf service."},"access_check.jsonapi.relationship_field_access":{"type":"Drupal\\Core\\Routing\\Access\\AccessInterface","name":"access_check_jsonapi_relationship_field_access","description":"The access_check.jsonapi.relationship_field_access service."},"access_check.latest_revision":{"type":"Drupal\\Core\\Routing\\Access\\AccessInterface","name":"access_check_latest_revision","description":"The access_check.latest_revision service."},"access_check.media.revision":{"type":"Drupal\\Core\\Routing\\Access\\AccessInterface","name":"access_check_media_revision","description":"The access_check.media.revision service."},"access_check.node.add":{"type":"Drupal\\Core\\Routing\\Access\\AccessInterface","name":"access_check_node_add","description":"The access_check.node.add service."},"access_check.node.preview":{"type":"Drupal\\Core\\Routing\\Access\\AccessInterface","name":"access_check_node_preview","description":"The access_check.node.preview service."},"access_check.node.revision":{"type":"Drupal\\Core\\Routing\\Access\\AccessInterface","name":"access_check_node_revision","description":"The access_check.node.revision service."},"access_check.permission":{"type":"Drupal\\Core\\Routing\\Access\\AccessInterface","name":"access_check_permission","description":"The access_check.permission service."},"access_check.quickedit.entity_field":{"type":"Drupal\\quickedit\\Access\\QuickEditEntityFieldAccessCheckInterface","name":"access_checker","description":"An object that checks if a user has access to edit a given field."},"access_check.settings_tray.block.has_overrides":{"type":"Drupal\\Core\\Routing\\Access\\AccessInterface","name":"access_check_settings_tray_block_has_overrides","description":"The access_check.settings_tray.block.has_overrides service."},"access_check.settings_tray.block.settings_tray_form":{"type":"Drupal\\Core\\Routing\\Access\\AccessInterface","name":"access_check_settings_tray_block_settings_tray_form","description":"The access_check.settings_tray.block.settings_tray_form service."},"access_check.theme":{"type":"Drupal\\Core\\Theme\\ThemeAccessCheck","name":"theme_access","description":"The access checker for themes."},"access_check.update.manager_access":{"type":"Drupal\\Core\\Routing\\Access\\AccessInterface","name":"access_check_update_manager_access","description":"The access_check.update.manager_access service."},"access_check.user.login_status":{"type":"Drupal\\Core\\Routing\\Access\\AccessInterface","name":"access_check_user_login_status","description":"The access_check.user.login_status service."},"access_check.user.register":{"type":"Drupal\\Core\\Routing\\Access\\AccessInterface","name":"access_check_user_register","description":"The access_check.user.register service."},"access_check.user.role":{"type":"Drupal\\Core\\Routing\\Access\\AccessInterface","name":"access_check_user_role","description":"The access_check.user.role service."},"access_manager":{"type":"Drupal\\Core\\Access\\AccessManagerInterface","name":"access_manager","description":"The access manager."},"account_switcher":{"type":"Drupal\\Core\\Session\\AccountSwitcherInterface","name":"account_switcher","description":"The account switching service."},"aggregator.items.importer":{"type":"Drupal\\aggregator\\ItemsImporterInterface","name":"aggregator_items_importer","description":"The aggregator.items.importer service."},"ajax_response.attachments_processor":{"type":"Drupal\\Core\\Render\\AttachmentsResponseProcessorInterface","name":"ajax_response_attachments_processor","description":"The AJAX response attachments processor service."},"ajax_response.subscriber":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"ajax_response_subscriber","description":"The ajax_response.subscriber service."},"anonymous_user_response_subscriber":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"anonymous_user_response_subscriber","description":"The anonymous_user_response_subscriber service."},"asset.css.collection_grouper":{"type":"Drupal\\Core\\Asset\\AssetCollectionGrouperInterface","name":"grouper","description":"The grouper for CSS assets."},"asset.css.collection_optimizer":{"type":"Drupal\\Core\\Asset\\AssetCollectionOptimizerInterface","name":"css_collection_optimizer","description":"The CSS asset collection optimizer service."},"asset.css.collection_renderer":{"type":"Drupal\\Core\\Asset\\AssetCollectionRendererInterface","name":"css_collection_renderer","description":"The CSS asset collection renderer."},"asset.css.dumper":{"type":"Drupal\\Core\\Asset\\AssetDumperInterface","name":"dumper","description":"The dumper for optimized CSS assets."},"asset.css.optimizer":{"type":"Drupal\\Core\\Asset\\AssetOptimizerInterface","name":"optimizer","description":"The optimizer for a single CSS asset."},"asset.js.collection_grouper":{"type":"Drupal\\Core\\Asset\\AssetCollectionGrouperInterface","name":"grouper","description":"The grouper for JS assets."},"asset.js.collection_optimizer":{"type":"Drupal\\Core\\Asset\\AssetCollectionOptimizerInterface","name":"asset_js_collection_optimizer","description":"The asset.js.collection_optimizer service."},"asset.js.collection_renderer":{"type":"Drupal\\Core\\Asset\\AssetCollectionRendererInterface","name":"js_collection_renderer","description":"The JS asset collection renderer."},"asset.js.dumper":{"type":"Drupal\\Core\\Asset\\AssetDumperInterface","name":"dumper","description":"The dumper for optimized JS assets."},"asset.js.optimizer":{"type":"Drupal\\Core\\Asset\\AssetOptimizerInterface","name":"optimizer","description":"The optimizer for a single JS asset."},"asset.resolver":{"type":"Drupal\\Core\\Asset\\AssetResolverInterface","name":"asset_resolver","description":"An asset resolver."},"authentication":{"type":"Drupal\\Core\\Authentication\\AuthenticationProviderInterface","name":"authentication_provider","description":"An authentication provider."},"authentication_collector":{"type":"Drupal\\Core\\Authentication\\AuthenticationCollectorInterface","name":"auth_collector","description":"The authentication provider collector."},"authentication_subscriber":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"authentication_subscriber","description":"The authentication_subscriber service."},"automated_cron.subscriber":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"automated_cron_subscriber","description":"The automated_cron.subscriber service."},"ban.ip_manager":{"type":"Drupal\\ban\\BanIpManagerInterface","name":"manager","description":"The ban IP manager."},"ban.middleware":{"type":"Symfony\\Component\\HttpKernel\\HttpKernelInterface","name":"http_kernel","description":"The decorated kernel."},"bare_html_page_renderer":{"type":"Drupal\\Core\\Render\\BareHtmlPageRendererInterface","name":"bare_html_page_renderer","description":"The bare HTML page renderer."},"basic_auth.authentication.basic_auth":{"type":"Drupal\\Core\\Authentication\\AuthenticationProviderInterface","name":"basic_auth_authentication_basic_auth","description":"The basic_auth.authentication.basic_auth service."},"batch.storage":{"type":"Drupal\\Core\\Batch\\BatchStorageInterface","name":"batch_storage","description":"The batch storage."},"big_pipe":{"type":"Drupal\\big_pipe\\Render\\BigPipe","name":"big_pipe","description":"The BigPipe service."},"block.page_display_variant_subscriber":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"block_page_display_variant_subscriber","description":"The block.page_display_variant_subscriber service."},"block.repository":{"type":"Drupal\\block\\BlockRepositoryInterface","name":"block_repository","description":"The block.repository service."},"block_content.uuid_lookup":{"type":"Drupal\\Core\\DestructableInterface","name":"block_content_uuid_lookup","description":"The block_content.uuid_lookup service."},"book.breadcrumb":{"type":"Drupal\\Core\\Breadcrumb\\BreadcrumbBuilderInterface","name":"book_breadcrumb","description":"The book.breadcrumb service."},"book.manager":{"type":"Drupal\\book\\BookManagerInterface","name":"book_manager","description":"The book manager."},"book.outline":{"type":"Drupal\\book\\BookOutline","name":"book_outline","description":"The book.outline service."},"book.outline_storage":{"type":"Drupal\\book\\BookOutlineStorageInterface","name":"book_outline_storage","description":"The book outline storage."},"book.uninstall_validator":{"type":"Drupal\\Core\\Extension\\ModuleUninstallValidatorInterface","name":"book_uninstall_validator","description":"The book.uninstall_validator service."},"breadcrumb":{"type":"Drupal\\Core\\Breadcrumb\\ChainBreadcrumbBuilderInterface","name":"breadcrumb","description":"The breadcrumb service."},"breakpoint.manager":{"type":"Drupal\\Core\\Cache\\CacheableDependencyInterface","name":"breakpoint_manager","description":"The breakpoint.manager service."},"cache.backend.apcu":{"type":"Drupal\\Core\\Cache\\CacheFactoryInterface","name":"cache_backend_apcu","description":"The cache.backend.apcu service."},"cache.backend.chainedfast":{"type":"Drupal\\Core\\Cache\\CacheFactoryInterface","name":"cache_backend_chainedfast","description":"The cache.backend.chainedfast service."},"cache.backend.database":{"type":"Drupal\\Core\\Cache\\CacheFactoryInterface","name":"cache_backend_database","description":"The cache.backend.database service."},"cache.backend.memory":{"type":"Drupal\\Core\\Cache\\CacheFactoryInterface","name":"cache_backend_memory","description":"The cache.backend.memory service."},"cache.backend.null":{"type":"Drupal\\Core\\Cache\\CacheFactoryInterface","name":"cache_backend_null","description":"The cache.backend.null service."},"cache.backend.php":{"type":"Drupal\\Core\\Cache\\CacheFactoryInterface","name":"cache_backend_php","description":"The cache.backend.php service."},"cache.bootstrap":{"type":"Drupal\\Core\\Cache\\CacheBackendInterface","name":"cache","description":"The cache backend."},"cache.config":{"type":"Drupal\\Core\\Cache\\CacheBackendInterface","name":"cache","description":"A cache backend used to store configuration."},"cache.data":{"type":"Drupal\\Core\\Cache\\CacheBackendInterface","name":"cache","description":"The cache backend."},"cache.default":{"type":"Drupal\\Core\\Cache\\CacheBackendInterface","name":"cache","description":"The cache."},"cache.discovery":{"type":"Drupal\\Core\\Cache\\CacheBackendInterface","name":"cache_backend","description":"Cache backend instance to use."},"cache.discovery_migration":{"type":"Drupal\\Core\\Cache\\CacheBackendInterface","name":"cache_backend","description":"The cache backend."},"cache.dynamic_page_cache":{"type":"Drupal\\Core\\Cache\\CacheBackendInterface","name":"cache_dynamic_page_cache","description":"The cache.dynamic_page_cache service."},"cache.entity":{"type":"Drupal\\Core\\Cache\\CacheBackendInterface","name":"cache_entity","description":"The cache.entity service."},"cache.jsonapi_resource_types":{"type":"Drupal\\Core\\Cache\\CacheBackendInterface","name":"static_cache","description":"The static cache backend."},"cache.menu":{"type":"Drupal\\Core\\Cache\\CacheBackendInterface","name":"cache","description":"The cache backend."},"cache.migrate":{"type":"Drupal\\Core\\Cache\\CacheBackendInterface","name":"cache_migrate","description":"The cache.migrate service."},"cache.page":{"type":"Drupal\\Core\\Cache\\CacheBackendInterface","name":"cache","description":"The cache bin."},"cache.render":{"type":"Drupal\\Core\\Cache\\CacheBackendInterface","name":"cache_render","description":"The cache.render service."},"cache.rest":{"type":"Drupal\\Core\\Cache\\CacheBackendInterface","name":"cache_rest","description":"The cache.rest service."},"cache.static":{"type":"Drupal\\Core\\Cache\\CacheBackendInterface","name":"static","description":"The cache backend interface to use for the static cache."},"cache.toolbar":{"type":"Drupal\\Core\\Cache\\CacheBackendInterface","name":"cache_toolbar","description":"The cache.toolbar service."},"cache_context.cookies":{"type":"Drupal\\Core\\Cache\\Context\\CalculatedCacheContextInterface","name":"cache_context_cookies","description":"The cache_context.cookies service."},"cache_context.headers":{"type":"Drupal\\Core\\Cache\\Context\\CalculatedCacheContextInterface","name":"cache_context_headers","description":"The cache_context.headers service."},"cache_context.ip":{"type":"Drupal\\Core\\Cache\\Context\\CacheContextInterface","name":"cache_context_ip","description":"The cache_context.ip service."},"cache_context.languages":{"type":"Drupal\\Core\\Cache\\Context\\CalculatedCacheContextInterface","name":"cache_context_languages","description":"The cache_context.languages service."},"cache_context.layout_builder_is_active":{"type":"Drupal\\Core\\Cache\\Context\\CalculatedCacheContextInterface","name":"cache_context_layout_builder_is_active","description":"The cache_context.layout_builder_is_active service."},"cache_context.request_format":{"type":"Drupal\\Core\\Cache\\Context\\RequestFormatCacheContext","name":"cache_context_request_format","description":"The cache_context.request_format service."},"cache_context.route":{"type":"Drupal\\Core\\Cache\\Context\\CacheContextInterface","name":"cache_context_route","description":"The cache_context.route service."},"cache_context.route.book_navigation":{"type":"Drupal\\Core\\Cache\\Context\\CacheContextInterface","name":"cache_context_route_book_navigation","description":"The cache_context.route.book_navigation service."},"cache_context.route.menu_active_trails":{"type":"Drupal\\Core\\Cache\\Context\\CalculatedCacheContextInterface","name":"cache_context_route_menu_active_trails","description":"The cache_context.route.menu_active_trails service."},"cache_context.route.name":{"type":"Drupal\\Core\\Cache\\Context\\CacheContextInterface","name":"cache_context_route_name","description":"The cache_context.route.name service."},"cache_context.route.name.is_layout_builder_ui":{"type":"Drupal\\Core\\Cache\\Context\\CacheContextInterface","name":"cache_context_route_name_is_layout_builder_ui","description":"The cache_context.route.name.is_layout_builder_ui service."},"cache_context.session":{"type":"Drupal\\Core\\Cache\\Context\\SessionCacheContext","name":"cache_context_session","description":"The cache_context.session service."},"cache_context.session.exists":{"type":"Drupal\\Core\\Cache\\Context\\CacheContextInterface","name":"cache_context_session_exists","description":"The cache_context.session.exists service."},"cache_context.test_discovery":{"type":"Drupal\\Core\\Cache\\Context\\CacheContextInterface","name":"cache_context_test_discovery","description":"The cache_context.test_discovery service."},"cache_context.theme":{"type":"Drupal\\Core\\Cache\\Context\\CacheContextInterface","name":"cache_context_theme","description":"The cache_context.theme service."},"cache_context.timezone":{"type":"Drupal\\Core\\Cache\\Context\\CacheContextInterface","name":"cache_context_timezone","description":"The cache_context.timezone service."},"cache_context.url":{"type":"Drupal\\Core\\Cache\\Context\\CacheContextInterface","name":"cache_context_url","description":"The cache_context.url service."},"cache_context.url.path":{"type":"Drupal\\Core\\Cache\\Context\\CacheContextInterface","name":"cache_context_url_path","description":"The cache_context.url.path service."},"cache_context.url.path.is_front":{"type":"Drupal\\Core\\Cache\\Context\\CacheContextInterface","name":"cache_context_url_path_is_front","description":"The cache_context.url.path.is_front service."},"cache_context.url.path.parent":{"type":"Drupal\\Core\\Cache\\Context\\CacheContextInterface","name":"cache_context_url_path_parent","description":"The cache_context.url.path.parent service."},"cache_context.url.query_args":{"type":"Drupal\\Core\\Cache\\Context\\CalculatedCacheContextInterface","name":"cache_context_url_query_args","description":"The cache_context.url.query_args service."},"cache_context.url.query_args.pagers":{"type":"Drupal\\Core\\Cache\\Context\\CalculatedCacheContextInterface","name":"cache_context_url_query_args_pagers","description":"The cache_context.url.query_args.pagers service."},"cache_context.url.site":{"type":"Drupal\\Core\\Cache\\Context\\CacheContextInterface","name":"cache_context_url_site","description":"The cache_context.url.site service."},"cache_context.user":{"type":"Drupal\\Core\\Cache\\Context\\CacheContextInterface","name":"cache_context_user","description":"The cache_context.user service."},"cache_context.user.is_super_user":{"type":"Drupal\\Core\\Cache\\Context\\CacheContextInterface","name":"cache_context_user_is_super_user","description":"The cache_context.user.is_super_user service."},"cache_context.user.node_grants":{"type":"Drupal\\Core\\Cache\\Context\\CalculatedCacheContextInterface","name":"cache_context_user_node_grants","description":"The cache_context.user.node_grants service."},"cache_context.user.permissions":{"type":"Drupal\\Core\\Cache\\Context\\CacheContextInterface","name":"cache_context_user_permissions","description":"The cache_context.user.permissions service."},"cache_context.user.roles":{"type":"Drupal\\Core\\Cache\\Context\\CalculatedCacheContextInterface","name":"cache_context_user_roles","description":"The cache_context.user.roles service."},"cache_contexts_manager":{"type":"Drupal\\Core\\Cache\\Context\\CacheContextsManager","name":"cache_contexts_manager","description":"The cache contexts manager service."},"cache_factory":{"type":"Drupal\\Core\\Cache\\CacheFactoryInterface","name":"cache_factory","description":"The cache factory."},"cache_router_rebuild_subscriber":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"cache_router_rebuild_subscriber","description":"The cache_router_rebuild_subscriber service."},"cache_tags.invalidator":{"type":"Drupal\\Core\\Cache\\CacheTagsInvalidatorInterface","name":"cache_tags_invalidator","description":"The cache tags invalidator."},"cache_tags.invalidator.checksum":{"type":"Drupal\\Core\\Cache\\CacheTagsChecksumInterface","name":"checksum_provider","description":"The cache tags checksum provider."},"class_resolver":{"type":"Drupal\\Core\\DependencyInjection\\ClassResolverInterface","name":"class_resolver","description":"The class resolver."},"client_error_response_subscriber":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"client_error_response_subscriber","description":"The client_error_response_subscriber service."},"color.config_cache_invalidator":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"color_config_cache_invalidator","description":"The color.config_cache_invalidator service."},"comment.breadcrumb":{"type":"Drupal\\Core\\Breadcrumb\\BreadcrumbBuilderInterface","name":"comment_breadcrumb","description":"The comment.breadcrumb service."},"comment.lazy_builders":{"type":"Drupal\\comment\\CommentLazyBuilders","name":"comment_lazy_builders","description":"The comment.lazy_builders service."},"comment.link_builder":{"type":"Drupal\\comment\\CommentLinkBuilderInterface","name":"comment_link_builder","description":"The comment.link_builder service."},"comment.manager":{"type":"Drupal\\comment\\CommentManagerInterface","name":"comment_manager","description":"The comment manager service."},"comment.statistics":{"type":"Drupal\\comment\\CommentStatisticsInterface","name":"comment_statistics","description":"The comment.statistics service."},"config.config_subscriber":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"config_config_subscriber","description":"The config.config_subscriber service."},"config.factory":{"type":"Drupal\\Core\\Config\\ConfigFactoryInterface","name":"config_factory","description":"The config factory."},"config.importer_subscriber":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"config_importer_subscriber","description":"The config.importer_subscriber service."},"config.installer":{"type":"Drupal\\Core\\Config\\ConfigInstallerInterface","name":"config_installer","description":"(optional) The config installer to install configuration. This optional"},"config.manager":{"type":"Drupal\\Core\\Config\\ConfigManagerInterface","name":"config_manager","description":"The configuration manager."},"config.storage":{"type":"Drupal\\Core\\Config\\StorageInterface","name":"storage","description":"The active configuration storage."},"config.storage.export":{"type":"Drupal\\Core\\Config\\StorageInterface","name":"config_storage_export","description":"The config.storage.export service."},"config.storage.schema":{"type":"Drupal\\Core\\Config\\StorageInterface","name":"schemaStorage","description":"The storage object to use for reading schema data"},"config.storage.snapshot":{"type":"Drupal\\Core\\Config\\StorageInterface","name":"config_storage_snapshot","description":"The config.storage.snapshot service."},"config.storage.staging":{"type":"Drupal\\Core\\Config\\StorageInterface","name":"config_storage_staging","description":"The config.storage.staging service."},"config.typed":{"type":"Drupal\\Core\\Config\\TypedConfigManagerInterface","name":"typed_config","description":"The typed configuration manager."},"config_import_subscriber":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"config_import_subscriber","description":"The config_import_subscriber service."},"config_translation.access.form":{"type":"Drupal\\Core\\Routing\\Access\\AccessInterface","name":"config_translation_access_form","description":"The config_translation.access.form service."},"config_translation.access.overview":{"type":"Drupal\\Core\\Routing\\Access\\AccessInterface","name":"config_translation_access_overview","description":"The config_translation.access.overview service."},"config_translation.route_subscriber":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"config_translation_route_subscriber","description":"The config_translation.route_subscriber service."},"contact.mail_handler":{"type":"Drupal\\contact\\MailHandlerInterface","name":"contact_mail_handler","description":"The contact.mail_handler service."},"container.namespaces":{"type":"Traversable","name":"namespaces","description":"An object that implements \\Traversable which contains the root paths"},"content_moderation.config_import_subscriber":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"content_moderation_config_import_subscriber","description":"The content_moderation.config_import_subscriber service."},"content_moderation.moderation_information":{"type":"Drupal\\content_moderation\\ModerationInformationInterface","name":"moderation_info","description":"The moderation information service."},"content_moderation.route_subscriber":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"content_moderation_route_subscriber","description":"The content_moderation.route_subscriber service."},"content_moderation.state_transition_validation":{"type":"Drupal\\content_moderation\\StateTransitionValidationInterface","name":"content_moderation_state_transition_validation","description":"The content_moderation.state_transition_validation service."},"content_translation.delete_access":{"type":"Drupal\\Core\\Routing\\Access\\AccessInterface","name":"content_translation_delete_access","description":"The content_translation.delete_access service."},"content_translation.manage_access":{"type":"Drupal\\Core\\Routing\\Access\\AccessInterface","name":"content_translation_manage_access","description":"The content_translation.manage_access service."},"content_translation.manager":{"type":"Drupal\\content_translation\\ContentTranslationManagerInterface","name":"content_translation_manager","description":"The content translation manager."},"content_translation.overview_access":{"type":"Drupal\\Core\\Routing\\Access\\AccessInterface","name":"content_translation_overview_access","description":"The content_translation.overview_access service."},"content_translation.subscriber":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"content_translation_subscriber","description":"The content_translation.subscriber service."},"content_translation.synchronizer":{"type":"Drupal\\content_translation\\FieldTranslationSynchronizerInterface","name":"content_translation_synchronizer","description":"The content_translation.synchronizer service."},"content_translation.updates_manager":{"type":"Drupal\\content_translation\\ContentTranslationUpdatesManager","name":"content_translation_updates_manager","description":"The content_translation.updates_manager service."},"content_type_header_matcher":{"type":"Drupal\\Core\\Routing\\FilterInterface","name":"content_type_header_matcher","description":"The content_type_header_matcher service."},"content_uninstall_validator":{"type":"Drupal\\Core\\Extension\\ModuleUninstallValidatorInterface","name":"content_uninstall_validator","description":"The content_uninstall_validator service."},"context.handler":{"type":"Drupal\\Core\\Plugin\\Context\\ContextHandlerInterface","name":"context_handler","description":"The plugin context handler."},"context.repository":{"type":"Drupal\\Core\\Plugin\\Context\\ContextRepositoryInterface","name":"context_repository","description":"The context repository service."},"controller.entity_form":{"type":"Drupal\\Core\\Entity\\HtmlEntityFormController","name":"controller_entity_form","description":"The controller.entity_form service."},"controller.form":{"type":"Drupal\\Core\\Controller\\HtmlFormController","name":"controller_form","description":"The controller.form service."},"controller_resolver":{"type":"Drupal\\Core\\Controller\\ControllerResolverInterface","name":"controller_resolver","description":"The controller resolver."},"country_manager":{"type":"Drupal\\Core\\Locale\\CountryManagerInterface","name":"country_manager","description":"The country_manager service."},"cron":{"type":"Drupal\\Core\\CronInterface","name":"cron","description":"The cron service."},"csrf_token":{"type":"Drupal\\Core\\Access\\CsrfTokenGenerator","name":"csrf_token","description":"The CSRF token generator."},"current_route_match":{"type":"Drupal\\Core\\Routing\\RouteMatchInterface","name":"route_match","description":"The current route match."},"current_user":{"type":"Drupal\\Core\\Session\\AccountInterface","name":"current_user","description":"The current user."},"database":{"type":"Drupal\\Core\\Database\\Connection","name":"connection","description":"The database connection."},"database.replica":{"type":"Drupal\\Core\\Database\\Connection","name":"database_replica","description":"(Optional) the replica database connection."},"database.replica_kill_switch":{"type":"Drupal\\Core\\Database\\ReplicaKillSwitch","name":"replica_kill_switch","description":"The replica kill switch."},"date.formatter":{"type":"Drupal\\Core\\Datetime\\DateFormatterInterface","name":"date_formatter","description":"The date formatter."},"datetime.time":{"type":"Drupal\\Component\\Datetime\\TimeInterface","name":"time","description":"The time service."},"diff.formatter":{"type":"Drupal\\Core\\Diff\\DiffFormatter","name":"diff_formatter","description":"The diff.formatter service."},"drupal.proxy_original_service.bare_html_page_renderer":{"type":"Drupal\\Core\\Render\\BareHtmlPageRendererInterface","name":"drupal_proxy_original_service_bare_html_page_renderer","description":"The drupal.proxy_original_service.bare_html_page_renderer service."},"drupal.proxy_original_service.batch.storage":{"type":"Drupal\\Core\\Batch\\BatchStorageInterface","name":"drupal_proxy_original_service_batch_storage","description":"The drupal.proxy_original_service.batch.storage service."},"drupal.proxy_original_service.book.uninstall_validator":{"type":"Drupal\\Core\\Extension\\ModuleUninstallValidatorInterface","name":"drupal_proxy_original_service_book_uninstall_validator","description":"The drupal.proxy_original_service.book.uninstall_validator service."},"drupal.proxy_original_service.config.installer":{"type":"Drupal\\Core\\Config\\ConfigInstallerInterface","name":"drupal_proxy_original_service_config_installer","description":"The drupal.proxy_original_service.config.installer service."},"drupal.proxy_original_service.content_uninstall_validator":{"type":"Drupal\\Core\\Extension\\ModuleUninstallValidatorInterface","name":"drupal_proxy_original_service_content_uninstall_validator","description":"The drupal.proxy_original_service.content_uninstall_validator service."},"drupal.proxy_original_service.cron":{"type":"Drupal\\Core\\CronInterface","name":"drupal_proxy_original_service_cron","description":"The drupal.proxy_original_service.cron service."},"drupal.proxy_original_service.dynamic_page_cache_response_policy":{"type":"Drupal\\Core\\PageCache\\ChainResponsePolicyInterface","name":"drupal_proxy_original_service_dynamic_page_cache_response_policy","description":"The drupal.proxy_original_service.dynamic_page_cache_response_policy service."},"drupal.proxy_original_service.field.uninstall_validator":{"type":"Drupal\\Core\\Extension\\ModuleUninstallValidatorInterface","name":"drupal_proxy_original_service_field_uninstall_validator","description":"The drupal.proxy_original_service.field.uninstall_validator service."},"drupal.proxy_original_service.file.mime_type.guesser":{"type":"Symfony\\Component\\HttpFoundation\\File\\MimeType\\MimeTypeGuesserInterface","name":"drupal_proxy_original_service_file_mime_type_guesser","description":"The drupal.proxy_original_service.file.mime_type.guesser service."},"drupal.proxy_original_service.file.mime_type.guesser.extension":{"type":"Symfony\\Component\\HttpFoundation\\File\\MimeType\\MimeTypeGuesserInterface","name":"drupal_proxy_original_service_file_mime_type_guesser_extension","description":"The drupal.proxy_original_service.file.mime_type.guesser.extension service."},"drupal.proxy_original_service.filter.uninstall_validator":{"type":"Drupal\\Core\\Extension\\ModuleUninstallValidatorInterface","name":"drupal_proxy_original_service_filter_uninstall_validator","description":"The drupal.proxy_original_service.filter.uninstall_validator service."},"drupal.proxy_original_service.forum.uninstall_validator":{"type":"Drupal\\Core\\Extension\\ModuleUninstallValidatorInterface","name":"drupal_proxy_original_service_forum_uninstall_validator","description":"The drupal.proxy_original_service.forum.uninstall_validator service."},"drupal.proxy_original_service.language_converter":{"type":"Drupal\\Core\\ParamConverter\\ParamConverterInterface","name":"drupal_proxy_original_service_language_converter","description":"The drupal.proxy_original_service.language_converter service."},"drupal.proxy_original_service.lock":{"type":"Drupal\\Core\\Lock\\LockBackendInterface","name":"drupal_proxy_original_service_lock","description":"The drupal.proxy_original_service.lock service."},"drupal.proxy_original_service.lock.persistent":{"type":"Drupal\\Core\\Lock\\LockBackendInterface","name":"drupal_proxy_original_service_lock_persistent","description":"The drupal.proxy_original_service.lock.persistent service."},"drupal.proxy_original_service.node_preview":{"type":"Drupal\\Core\\ParamConverter\\ParamConverterInterface","name":"drupal_proxy_original_service_node_preview","description":"The drupal.proxy_original_service.node_preview service."},"drupal.proxy_original_service.page_cache_response_policy":{"type":"Drupal\\Core\\PageCache\\ChainResponsePolicyInterface","name":"drupal_proxy_original_service_page_cache_response_policy","description":"The drupal.proxy_original_service.page_cache_response_policy service."},"drupal.proxy_original_service.paramconverter.menu_link":{"type":"Drupal\\Core\\ParamConverter\\ParamConverterInterface","name":"drupal_proxy_original_service_paramconverter_menu_link","description":"The drupal.proxy_original_service.paramconverter.menu_link service."},"drupal.proxy_original_service.plugin.cache_clearer":{"type":"Drupal\\Core\\Plugin\\CachedDiscoveryClearerInterface","name":"drupal_proxy_original_service_plugin_cache_clearer","description":"The drupal.proxy_original_service.plugin.cache_clearer service."},"drupal.proxy_original_service.required_module_uninstall_validator":{"type":"Drupal\\Core\\Extension\\ModuleUninstallValidatorInterface","name":"drupal_proxy_original_service_required_module_uninstall_validator","description":"The drupal.proxy_original_service.required_module_uninstall_validator service."},"drupal.proxy_original_service.router.builder":{"type":"Drupal\\Core\\Routing\\RouteBuilderInterface","name":"drupal_proxy_original_service_router_builder","description":"The drupal.proxy_original_service.router.builder service."},"drupal.proxy_original_service.router.dumper":{"type":"Drupal\\Core\\Routing\\MatcherDumperInterface","name":"drupal_proxy_original_service_router_dumper","description":"The drupal.proxy_original_service.router.dumper service."},"dynamic_page_cache_request_policy":{"type":"Drupal\\Core\\PageCache\\RequestPolicyInterface","name":"request_policy","description":"A policy rule determining the cacheability of a request."},"dynamic_page_cache_response_policy":{"type":"Drupal\\Core\\PageCache\\ResponsePolicyInterface","name":"response_policy","description":"A policy rule determining the cacheability of the response."},"dynamic_page_cache_subscriber":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"dynamic_page_cache_subscriber","description":"The dynamic_page_cache_subscriber service."},"early_rendering_controller_wrapper_subscriber":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"early_rendering_controller_wrapper_subscriber","description":"The early_rendering_controller_wrapper_subscriber service."},"element.editor":{"type":"Drupal\\editor\\Element","name":"element_editor","description":"The element.editor service."},"email.validator":{"type":"Drupal\\Component\\Utility\\EmailValidatorInterface","name":"email_validator","description":"The email.validator service."},"entity.autocomplete_matcher":{"type":"Drupal\\Core\\Entity\\EntityAutocompleteMatcher","name":"entity_autocomplete_matcher","description":"The entity.autocomplete_matcher service."},"entity.bundle_config_import_validator":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"entity_bundle_config_import_validator","description":"The entity.bundle_config_import_validator service."},"entity.definition_update_manager":{"type":"Drupal\\Core\\Entity\\EntityDefinitionUpdateManagerInterface","name":"update_manager","description":"The entity definition update manager."},"entity.form_builder":{"type":"Drupal\\Core\\Entity\\EntityFormBuilderInterface","name":"entity_form_builder","description":"The entity form builder service."},"entity.last_installed_schema.repository":{"type":"Drupal\\Core\\Entity\\EntityLastInstalledSchemaRepositoryInterface","name":"entity_last_installed_schema_repository","description":"The entity last installed schema repository."},"entity.manager":{"type":"Drupal\\Core\\Entity\\EntityManagerInterface","name":"entity_manager","description":"The entity.manager service."},"entity.memory_cache":{"type":"Drupal\\Core\\Cache\\CacheTagsInvalidatorInterface","name":"entity_memory_cache","description":"The entity.memory_cache service."},"entity.query":{"type":"Symfony\\Component\\DependencyInjection\\ContainerAwareInterface","name":"entity_query","description":"The entity.query service."},"entity.query.config":{"type":"Drupal\\Core\\Entity\\Query\\QueryFactoryInterface","name":"entity_query_config","description":"The entity.query.config service."},"entity.query.keyvalue":{"type":"Drupal\\Core\\Entity\\Query\\QueryFactoryInterface","name":"entity_query_keyvalue","description":"The entity.query.keyvalue service."},"entity.query.null":{"type":"Drupal\\Core\\Entity\\Query\\QueryFactoryInterface","name":"entity_query_null","description":"The entity.query.null service."},"entity.query.sql":{"type":"Drupal\\Core\\Entity\\Query\\QueryFactoryInterface","name":"entity_query_sql","description":"The entity.query.sql service."},"entity.repository":{"type":"Drupal\\Core\\Entity\\EntityRepositoryInterface","name":"entity_repository","description":"The entity repository."},"entity_bundle.listener":{"type":"Drupal\\Core\\Entity\\EntityBundleListenerInterface","name":"entity_bundle_listener","description":"The entity_bundle.listener service."},"entity_display.repository":{"type":"Drupal\\Core\\Entity\\EntityDisplayRepositoryInterface","name":"entity_display_repository","description":"The entity display repository."},"entity_field.deleted_fields_repository":{"type":"Drupal\\Core\\Field\\DeletedFieldsRepositoryInterface","name":"deleted_fields_repository","description":"The deleted fields repository."},"entity_field.manager":{"type":"Drupal\\Core\\Entity\\EntityFieldManagerInterface","name":"entity_field_manager","description":"The entity field manager."},"entity_route_subscriber":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"entity_route_subscriber","description":"The entity_route_subscriber service."},"entity_type.bundle.info":{"type":"Drupal\\Core\\Entity\\EntityTypeBundleInfoInterface","name":"entity_type_bundle_info","description":"The entity type bundle info."},"entity_type.listener":{"type":"Drupal\\Core\\Entity\\EntityTypeListenerInterface","name":"entity_type_listener","description":"The entity type listener interface."},"entity_type.manager":{"type":"Drupal\\Core\\Entity\\EntityTypeManagerInterface","name":"entity_type_manager","description":"The entity type manager."},"entity_type.repository":{"type":"Drupal\\Core\\Entity\\EntityTypeRepositoryInterface","name":"entity_type_repository","description":"The entity_type.repository service."},"event_dispatcher":{"type":"Symfony\\Component\\EventDispatcher\\EventDispatcherInterface","name":"event_dispatcher","description":"The event dispatcher."},"exception.custom_page_html":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"exception_custom_page_html","description":"The exception.custom_page_html service."},"exception.default_html":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"exception_default_html","description":"The exception.default_html service."},"exception.default_json":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"exception_default_json","description":"The exception.default_json service."},"exception.enforced_form_response":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"exception_enforced_form_response","description":"The exception.enforced_form_response service."},"exception.fast_404_html":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"exception_fast_404_html","description":"The exception.fast_404_html service."},"exception.final":{"type":"stdClass","name":"exception_final","description":"The exception.final service."},"exception.logger":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"exception_logger","description":"The exception.logger service."},"exception.needs_installer":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"exception_needs_installer","description":"The exception.needs_installer service."},"exception.test_site":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"exception_test_site","description":"The exception.test_site service."},"extension.list.module":{"type":"Drupal\\Core\\Extension\\ModuleExtensionList","name":"extension_list_module","description":"The module extension list."},"extension.list.profile":{"type":"Drupal\\Core\\Extension\\ExtensionList","name":"profile_list","description":"The site profile listing."},"extension.list.theme":{"type":"Drupal\\Core\\Extension\\ThemeExtensionList","name":"theme_list","description":"A extension discovery instance."},"extension.list.theme_engine":{"type":"Drupal\\Core\\Extension\\ThemeEngineExtensionList","name":"engine_list","description":"The theme engine extension listing."},"feed.bridge.reader":{"type":"Zend\\Feed\\Reader\\ExtensionManagerInterface","name":"feed_bridge_reader","description":"The feed.bridge.reader service."},"feed.bridge.writer":{"type":"Zend\\Feed\\Reader\\ExtensionManagerInterface","name":"feed_bridge_writer","description":"The feed.bridge.writer service."},"feed.reader.atomentry":{"type":"Zend\\Feed\\Reader\\Extension\\Atom\\Entry","name":"feed_reader_atomentry","description":"The feed.reader.atomentry service."},"feed.reader.atomfeed":{"type":"Zend\\Feed\\Reader\\Extension\\Atom\\Feed","name":"feed_reader_atomfeed","description":"The feed.reader.atomfeed service."},"feed.reader.contententry":{"type":"Zend\\Feed\\Reader\\Extension\\Content\\Entry","name":"feed_reader_contententry","description":"The feed.reader.contententry service."},"feed.reader.dublincoreentry":{"type":"Zend\\Feed\\Reader\\Extension\\DublinCore\\Entry","name":"feed_reader_dublincoreentry","description":"The feed.reader.dublincoreentry service."},"feed.reader.dublincorefeed":{"type":"Zend\\Feed\\Reader\\Extension\\DublinCore\\Feed","name":"feed_reader_dublincorefeed","description":"The feed.reader.dublincorefeed service."},"feed.reader.podcastentry":{"type":"Zend\\Feed\\Reader\\Extension\\Podcast\\Entry","name":"feed_reader_podcastentry","description":"The feed.reader.podcastentry service."},"feed.reader.podcastfeed":{"type":"Zend\\Feed\\Reader\\Extension\\Podcast\\Feed","name":"feed_reader_podcastfeed","description":"The feed.reader.podcastfeed service."},"feed.reader.slashentry":{"type":"Zend\\Feed\\Reader\\Extension\\Slash\\Entry","name":"feed_reader_slashentry","description":"The feed.reader.slashentry service."},"feed.reader.threadentry":{"type":"Zend\\Feed\\Reader\\Extension\\Thread\\Entry","name":"feed_reader_threadentry","description":"The feed.reader.threadentry service."},"feed.reader.wellformedwebentry":{"type":"Zend\\Feed\\Reader\\Extension\\WellFormedWeb\\Entry","name":"feed_reader_wellformedwebentry","description":"The feed.reader.wellformedwebentry service."},"feed.writer.atomrendererfeed":{"type":"Zend\\Feed\\Writer\\Extension\\RendererInterface","name":"feed_writer_atomrendererfeed","description":"The feed.writer.atomrendererfeed service."},"feed.writer.contentrendererentry":{"type":"Zend\\Feed\\Writer\\Extension\\RendererInterface","name":"feed_writer_contentrendererentry","description":"The feed.writer.contentrendererentry service."},"feed.writer.dublincorerendererentry":{"type":"Zend\\Feed\\Writer\\Extension\\RendererInterface","name":"feed_writer_dublincorerendererentry","description":"The feed.writer.dublincorerendererentry service."},"feed.writer.dublincorerendererfeed":{"type":"Zend\\Feed\\Writer\\Extension\\RendererInterface","name":"feed_writer_dublincorerendererfeed","description":"The feed.writer.dublincorerendererfeed service."},"feed.writer.itunesentry":{"type":"Zend\\Feed\\Writer\\Extension\\ITunes\\Entry","name":"feed_writer_itunesentry","description":"The feed.writer.itunesentry service."},"feed.writer.itunesfeed":{"type":"Zend\\Feed\\Writer\\Extension\\ITunes\\Feed","name":"feed_writer_itunesfeed","description":"The feed.writer.itunesfeed service."},"feed.writer.itunesrendererentry":{"type":"Zend\\Feed\\Writer\\Extension\\RendererInterface","name":"feed_writer_itunesrendererentry","description":"The feed.writer.itunesrendererentry service."},"feed.writer.itunesrendererfeed":{"type":"Zend\\Feed\\Writer\\Extension\\RendererInterface","name":"feed_writer_itunesrendererfeed","description":"The feed.writer.itunesrendererfeed service."},"feed.writer.slashrendererentry":{"type":"Zend\\Feed\\Writer\\Extension\\RendererInterface","name":"feed_writer_slashrendererentry","description":"The feed.writer.slashrendererentry service."},"feed.writer.threadingrendererentry":{"type":"Zend\\Feed\\Writer\\Extension\\RendererInterface","name":"feed_writer_threadingrendererentry","description":"The feed.writer.threadingrendererentry service."},"feed.writer.wellformedwebrendererentry":{"type":"Zend\\Feed\\Writer\\Extension\\RendererInterface","name":"feed_writer_wellformedwebrendererentry","description":"The feed.writer.wellformedwebrendererentry service."},"field.uninstall_validator":{"type":"Drupal\\Core\\Extension\\ModuleUninstallValidatorInterface","name":"field_uninstall_validator","description":"The field.uninstall_validator service."},"field_definition.listener":{"type":"Drupal\\Core\\Field\\FieldDefinitionListenerInterface","name":"field_definition_listener","description":"The field_definition.listener service."},"field_storage_definition.listener":{"type":"Drupal\\Core\\Field\\FieldStorageDefinitionListenerInterface","name":"field_storage_definition_listener","description":"The field storage definition listener service."},"field_ui.route_enhancer":{"type":"Drupal\\Core\\Routing\\EnhancerInterface","name":"field_ui_route_enhancer","description":"The field_ui.route_enhancer service."},"field_ui.subscriber":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"field_ui_subscriber","description":"The field_ui.subscriber service."},"file.mime_type.guesser":{"type":"Symfony\\Component\\HttpFoundation\\File\\MimeType\\MimeTypeGuesserInterface","name":"file_mime_type_guesser","description":"The file.mime_type.guesser service."},"file.mime_type.guesser.extension":{"type":"Symfony\\Component\\HttpFoundation\\File\\MimeType\\MimeTypeGuesserInterface","name":"file_mime_type_guesser_extension","description":"The file.mime_type.guesser.extension service."},"file.usage":{"type":"Drupal\\file\\FileUsage\\FileUsageInterface","name":"file_usage","description":"The file.usage service."},"file_system":{"type":"Drupal\\Core\\File\\FileSystemInterface","name":"file_system","description":"The file system service."},"filter.uninstall_validator":{"type":"Drupal\\Core\\Extension\\ModuleUninstallValidatorInterface","name":"filter_uninstall_validator","description":"The filter.uninstall_validator service."},"finish_response_subscriber":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"finish_response_subscriber","description":"The finish_response_subscriber service."},"flood":{"type":"Drupal\\Core\\Flood\\FloodInterface","name":"flood","description":"The flood service."},"form_ajax_response_builder":{"type":"Drupal\\Core\\Form\\FormAjaxResponseBuilderInterface","name":"form_ajax_response_builder","description":"The form AJAX response builder."},"form_ajax_subscriber":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"form_ajax_subscriber","description":"The form_ajax_subscriber service."},"form_builder":{"type":"Drupal\\Core\\Form\\FormBuilderInterface","name":"form_builder","description":"The form builder."},"form_error_handler":{"type":"Drupal\\Core\\Form\\FormErrorHandlerInterface","name":"form_error_handler","description":"The form error handler."},"form_submitter":{"type":"Drupal\\Core\\Form\\FormSubmitterInterface","name":"form_submitter","description":"The form submission processor."},"form_validator":{"type":"Drupal\\Core\\Form\\FormValidatorInterface","name":"form_validator","description":"The form validator."},"forum.breadcrumb.listing":{"type":"Drupal\\Core\\Breadcrumb\\BreadcrumbBuilderInterface","name":"forum_breadcrumb_listing","description":"The forum.breadcrumb.listing service."},"forum.breadcrumb.node":{"type":"Drupal\\Core\\Breadcrumb\\BreadcrumbBuilderInterface","name":"forum_breadcrumb_node","description":"The forum.breadcrumb.node service."},"forum.uninstall_validator":{"type":"Drupal\\Core\\Extension\\ModuleUninstallValidatorInterface","name":"forum_uninstall_validator","description":"The forum.uninstall_validator service."},"forum_manager":{"type":"Drupal\\forum\\ForumManagerInterface","name":"forum_manager","description":"The forum manager service."},"hal.link_manager":{"type":"Drupal\\hal\\LinkManager\\LinkManagerInterface","name":"hal_link_manager","description":"The hal.link_manager service."},"hal.link_manager.relation":{"type":"Drupal\\hal\\LinkManager\\RelationLinkManagerInterface","name":"relation_link_manager","description":"Manager for handling bundle URIs."},"hal.link_manager.type":{"type":"Drupal\\hal\\LinkManager\\TypeLinkManagerInterface","name":"type_link_manager","description":"Manager for handling bundle URIs."},"html_response.attachments_processor":{"type":"Drupal\\Core\\Render\\AttachmentsResponseProcessorInterface","name":"html_response_attachments_processor","description":"The HTML response attachments processor service."},"html_response.big_pipe_subscriber":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"html_response_big_pipe_subscriber","description":"The html_response.big_pipe_subscriber service."},"html_response.placeholder_strategy_subscriber":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"html_response_placeholder_strategy_subscriber","description":"The html_response.placeholder_strategy_subscriber service."},"html_response.subscriber":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"html_response_subscriber","description":"The html_response.subscriber service."},"http_client":{"type":"GuzzleHttp\\ClientInterface","name":"http_client","description":"The HTTP client."},"http_client_factory":{"type":"Drupal\\Core\\Http\\ClientFactory","name":"http_client_factory","description":"The http_client_factory service."},"http_kernel":{"type":"Symfony\\Component\\HttpKernel\\HttpKernelInterface","name":"http_kernel","description":"The HTTP kernel."},"http_kernel.basic":{"type":"Symfony\\Component\\HttpKernel\\HttpKernelInterface","name":"http_kernel","description":"The decorated kernel."},"http_kernel.controller.argument_resolver":{"type":"Symfony\\Component\\HttpKernel\\Controller\\ArgumentResolverInterface","name":"argument_resolver","description":"The argument resolver."},"http_middleware.kernel_pre_handle":{"type":"Symfony\\Component\\HttpKernel\\HttpKernelInterface","name":"http_kernel","description":"The decorated kernel."},"http_middleware.negotiation":{"type":"Symfony\\Component\\HttpKernel\\HttpKernelInterface","name":"http_middleware_negotiation","description":"The http_middleware.negotiation service."},"http_middleware.page_cache":{"type":"Symfony\\Component\\HttpKernel\\HttpKernelInterface","name":"http_kernel","description":"The decorated kernel."},"http_middleware.reverse_proxy":{"type":"Symfony\\Component\\HttpKernel\\HttpKernelInterface","name":"app","description":"The wrapper HTTP kernel"},"http_middleware.session":{"type":"Symfony\\Component\\HttpKernel\\HttpKernelInterface","name":"http_kernel","description":"The wrapped HTTP kernel."},"image.factory":{"type":"Drupal\\Core\\Image\\ImageFactory","name":"image_factory","description":"The image.factory service."},"image.toolkit.manager":{"type":"Drupal\\Core\\ImageToolkit\\ImageToolkitManager","name":"toolkit_manager","description":"The image toolkit manager."},"image.toolkit.operation.manager":{"type":"Drupal\\Core\\Cache\\CacheableDependencyInterface","name":"image_toolkit_operation_manager","description":"The image.toolkit.operation.manager service."},"info_parser":{"type":"Drupal\\Core\\Extension\\InfoParserInterface","name":"info_parser","description":"The info parser."},"inline_block.usage":{"type":"Drupal\\layout_builder\\InlineBlockUsageInterface","name":"usage","description":"The inline block usage service."},"jsonapi.custom_query_parameter_names_validator.subscriber":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"jsonapi_custom_query_parameter_names_validator_subscriber","description":"The jsonapi.custom_query_parameter_names_validator.subscriber service."},"jsonapi.entity_resource":{"type":"Drupal\\jsonapi\\Controller\\EntityResource","name":"jsonapi_entity_resource","description":"The jsonapi.entity_resource service."},"jsonapi.exception_subscriber":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"jsonapi_exception_subscriber","description":"The jsonapi.exception_subscriber service."},"jsonapi.field_resolver":{"type":"Drupal\\jsonapi\\Context\\FieldResolver","name":"field_resolver","description":"The JSON:API field resolver."},"jsonapi.file_upload":{"type":"Drupal\\jsonapi\\Controller\\FileUpload","name":"jsonapi_file_upload","description":"The jsonapi.file_upload service."},"jsonapi.include_resolver":{"type":"Drupal\\jsonapi\\IncludeResolver","name":"include_resolver","description":"The include resolver."},"jsonapi.resource_response.subscriber":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"jsonapi_resource_response_subscriber","description":"The jsonapi.resource_response.subscriber service."},"jsonapi.resource_response_validator.subscriber":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"jsonapi_resource_response_validator_subscriber","description":"The jsonapi.resource_response_validator.subscriber service."},"jsonapi.resource_type.repository":{"type":"Drupal\\jsonapi\\ResourceType\\ResourceTypeRepositoryInterface","name":"resource_type_repository","description":"The JSON:API resource type repository."},"jsonapi.route_enhancer":{"type":"Drupal\\Core\\Routing\\EnhancerInterface","name":"jsonapi_route_enhancer","description":"The jsonapi.route_enhancer service."},"jsonapi.route_filter.format_setter":{"type":"Symfony\\Cmf\\Component\\Routing\\NestedMatcher\\RouteFilterInterface","name":"jsonapi_route_filter_format_setter","description":"The jsonapi.route_filter.format_setter service."},"jsonapi.serializer":{"type":"Symfony\\Component\\Serializer\\SerializerInterface","name":"serializer","description":"The serializer."},"kernel":{"type":"Drupal\\Core\\DrupalKernelInterface","name":"drupal_kernel","description":"The main Drupal kernel."},"kernel_destruct_subscriber":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"kernel_destruct_subscriber","description":"The kernel_destruct_subscriber service."},"keyvalue":{"type":"Drupal\\Core\\KeyValueStore\\KeyValueFactoryInterface","name":"key_value_factory","description":"The key value factory."},"keyvalue.database":{"type":"Drupal\\Core\\KeyValueStore\\KeyValueFactoryInterface","name":"keyvalue_database","description":"The keyvalue.database service."},"keyvalue.expirable":{"type":"Drupal\\Core\\KeyValueStore\\KeyValueExpirableFactoryInterface","name":"storage_factory","description":"The key\/value store factory."},"keyvalue.expirable.database":{"type":"Drupal\\Core\\KeyValueStore\\KeyValueExpirableFactoryInterface","name":"keyvalue_expirable_database","description":"The keyvalue.expirable.database service."},"language.config_factory_override":{"type":"Drupal\\language\\Config\\LanguageConfigFactoryOverrideInterface","name":"config_override","description":"The language configuration override service."},"language.config_subscriber":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"language_config_subscriber","description":"The language.config_subscriber service."},"language.current_language_context":{"type":"Drupal\\Core\\Plugin\\Context\\ContextProviderInterface","name":"language_current_language_context","description":"The language.current_language_context service."},"language.default":{"type":"Drupal\\Core\\Language\\LanguageDefault","name":"default_language","description":"The default language."},"language_converter":{"type":"Drupal\\Core\\ParamConverter\\ParamConverterInterface","name":"language_converter","description":"The language_converter service."},"language_manager":{"type":"Drupal\\Core\\Language\\LanguageManagerInterface","name":"language_manager","description":"The language manager."},"language_negotiator":{"type":"Drupal\\language\\LanguageNegotiatorInterface","name":"language_negotiator","description":"The language negotiator."},"layout.icon_builder":{"type":"Drupal\\Core\\Layout\\Icon\\IconBuilderInterface","name":"layout_icon_builder","description":"The layout.icon_builder service."},"layout_builder.get_block_dependency_subscriber":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"layout_builder_get_block_dependency_subscriber","description":"The layout_builder.get_block_dependency_subscriber service."},"layout_builder.param_converter":{"type":"Drupal\\Core\\ParamConverter\\ParamConverterInterface","name":"layout_builder_param_converter","description":"The layout_builder.param_converter service."},"layout_builder.render_block_component_subscriber":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"layout_builder_render_block_component_subscriber","description":"The layout_builder.render_block_component_subscriber service."},"layout_builder.routes":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"layout_builder_routes","description":"The layout_builder.routes service."},"layout_builder.sample_entity_generator":{"type":"Drupal\\layout_builder\\Entity\\SampleEntityGeneratorInterface","name":"layout_builder_sample_entity_generator","description":"The layout_builder.sample_entity_generator service."},"layout_builder.tempstore_repository":{"type":"Drupal\\layout_builder\\LayoutTempstoreRepositoryInterface","name":"layout_tempstore_repository","description":"The layout tempstore repository."},"library.dependency_resolver":{"type":"Drupal\\Core\\Asset\\LibraryDependencyResolverInterface","name":"library_dependency_resolver","description":"The library dependency resolver."},"library.discovery":{"type":"Drupal\\Core\\Asset\\LibraryDiscoveryInterface","name":"library_discovery","description":"The library discovery service."},"library.discovery.collector":{"type":"Drupal\\Core\\Cache\\CacheCollectorInterface","name":"library_discovery_collector","description":"The library discovery cache collector."},"library.discovery.parser":{"type":"Drupal\\Core\\Asset\\LibraryDiscoveryParser","name":"discovery_parser","description":"The library discovery parser."},"link_generator":{"type":"Drupal\\Core\\Utility\\LinkGeneratorInterface","name":"link_generator","description":"The link_generator service."},"locale.config_manager":{"type":"Drupal\\locale\\LocaleConfigManager","name":"locale_config_manager","description":"The typed configuration manager."},"locale.config_subscriber":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"locale_config_subscriber","description":"The locale.config_subscriber service."},"locale.locale_translation_cache_tag":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"locale_locale_translation_cache_tag","description":"The locale.locale_translation_cache_tag service."},"locale.plural.formula":{"type":"Drupal\\locale\\PluralFormulaInterface","name":"locale_plural_formula","description":"The locale.plural.formula service."},"locale.project":{"type":"Drupal\\locale\\LocaleProjectStorageInterface","name":"locale_project","description":"The locale.project service."},"locale.storage":{"type":"Drupal\\locale\\StringStorageInterface","name":"locale_storage","description":"The locale storage to use for reading string translations."},"lock":{"type":"Drupal\\Core\\Lock\\LockBackendInterface","name":"lock","description":"The lock backend."},"lock.persistent":{"type":"Drupal\\Core\\Lock\\LockBackendInterface","name":"lock_persistent","description":"The lock.persistent service."},"logger.channel.aggregator":{"type":"Psr\\Log\\LoggerInterface","name":"logger","description":"A logger instance."},"logger.channel.contact":{"type":"Psr\\Log\\LoggerInterface","name":"logger","description":"A logger instance."},"logger.channel.cron":{"type":"Psr\\Log\\LoggerInterface","name":"logger","description":"A logger instance."},"logger.channel.default":{"type":"Psr\\Log\\LoggerInterface","name":"logger","description":"A logger instance."},"logger.channel.file":{"type":"Psr\\Log\\LoggerInterface","name":"logger","description":"The file logger channel."},"logger.channel.form":{"type":"Psr\\Log\\LoggerInterface","name":"logger","description":"A logger instance."},"logger.channel.image":{"type":"Psr\\Log\\LoggerInterface","name":"logger","description":"A logger instance."},"logger.channel.jsonapi":{"type":"Psr\\Log\\LoggerInterface","name":"logger","description":"The JSON:API logger channel."},"logger.channel.layout_builder":{"type":"Drupal\\Core\\Logger\\LoggerChannelInterface","name":"logger_channel_layout_builder","description":"The logger.channel.layout_builder service."},"logger.channel.migrate_drupal":{"type":"Drupal\\Core\\Logger\\LoggerChannelInterface","name":"logger","description":"The logger channel service."},"logger.channel.php":{"type":"Psr\\Log\\LoggerInterface","name":"logger","description":"The logger service."},"logger.channel.rest":{"type":"Psr\\Log\\LoggerInterface","name":"logger","description":"A logger instance."},"logger.dblog":{"type":"Psr\\Log\\LoggerInterface","name":"logger_dblog","description":"The logger.dblog service."},"logger.factory":{"type":"Drupal\\Core\\Logger\\LoggerChannelFactoryInterface","name":"logger","description":"The logger channel factory."},"logger.log_message_parser":{"type":"Drupal\\Core\\Logger\\LogMessageParserInterface","name":"parser","description":"The parser to use when extracting message variables."},"logger.syslog":{"type":"Psr\\Log\\LoggerInterface","name":"logger_syslog","description":"The logger.syslog service."},"main_content_renderer.ajax":{"type":"Drupal\\Core\\Render\\MainContent\\MainContentRendererInterface","name":"ajax_renderer","description":"The ajax renderer."},"main_content_renderer.dialog":{"type":"Drupal\\Core\\Render\\MainContent\\MainContentRendererInterface","name":"main_content_renderer_dialog","description":"The main_content_renderer.dialog service."},"main_content_renderer.html":{"type":"Drupal\\Core\\Render\\MainContent\\MainContentRendererInterface","name":"main_content_renderer_html","description":"The main_content_renderer.html service."},"main_content_renderer.modal":{"type":"Drupal\\Core\\Render\\MainContent\\MainContentRendererInterface","name":"main_content_renderer_modal","description":"The main_content_renderer.modal service."},"main_content_renderer.off_canvas":{"type":"Drupal\\Core\\Render\\MainContent\\MainContentRendererInterface","name":"main_content_renderer_off_canvas","description":"The main_content_renderer.off_canvas service."},"main_content_renderer.off_canvas_top":{"type":"Drupal\\Core\\Render\\MainContent\\MainContentRendererInterface","name":"main_content_renderer_off_canvas_top","description":"The main_content_renderer.off_canvas_top service."},"main_content_view_subscriber":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"main_content_view_subscriber","description":"The main_content_view_subscriber service."},"maintenance_mode":{"type":"Drupal\\Core\\Site\\MaintenanceModeInterface","name":"maintenance_mode","description":"The maintenance mode."},"maintenance_mode_subscriber":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"maintenance_mode_subscriber","description":"The maintenance_mode_subscriber service."},"media.config_subscriber":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"media_config_subscriber","description":"The media.config_subscriber service."},"media.oembed.iframe_url_helper":{"type":"Drupal\\media\\IFrameUrlHelper","name":"media_oembed_iframe_url_helper","description":"The media.oembed.iframe_url_helper service."},"media.oembed.provider_repository":{"type":"Drupal\\media\\OEmbed\\ProviderRepositoryInterface","name":"providers","description":"The oEmbed provider repository service."},"media.oembed.resource_fetcher":{"type":"Drupal\\media\\OEmbed\\ResourceFetcherInterface","name":"resource_fetcher","description":"The OEmbed resource fetcher service."},"media.oembed.url_resolver":{"type":"Drupal\\media\\OEmbed\\UrlResolverInterface","name":"media_oembed_url_resolver","description":"The media.oembed.url_resolver service."},"media_library.opener.field_widget":{"type":"Drupal\\media_library\\MediaLibraryOpenerInterface","name":"media_library_opener_field_widget","description":"The media_library.opener.field_widget service."},"media_library.opener_resolver":{"type":"Drupal\\media_library\\OpenerResolverInterface","name":"media_library_opener_resolver","description":"The media_library.opener_resolver service."},"media_library.route_subscriber":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"media_library_route_subscriber","description":"The media_library.route_subscriber service."},"media_library.ui_builder":{"type":"Drupal\\media_library\\MediaLibraryUiBuilder","name":"media_library_ui_builder","description":"The media_library.ui_builder service."},"menu.active_trail":{"type":"Drupal\\Core\\Menu\\MenuActiveTrailInterface","name":"menu_active_trail","description":"The active menu trail service."},"menu.default_tree_manipulators":{"type":"Drupal\\Core\\Menu\\DefaultMenuLinkTreeManipulators","name":"menu_default_tree_manipulators","description":"The menu.default_tree_manipulators service."},"menu.link_tree":{"type":"Drupal\\Core\\Menu\\MenuLinkTreeInterface","name":"menu_link_tree","description":"The menu link tree service."},"menu.parent_form_selector":{"type":"Drupal\\Core\\Menu\\MenuParentFormSelectorInterface","name":"menu_parent_form_selector","description":"The menu.parent_form_selector service."},"menu.rebuild_subscriber":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"menu_rebuild_subscriber","description":"The menu.rebuild_subscriber service."},"menu_link.static.overrides":{"type":"Drupal\\Core\\Menu\\StaticMenuLinkOverridesInterface","name":"overrides","description":"The service providing overrides for static links."},"messenger":{"type":"Drupal\\Core\\Messenger\\MessengerInterface","name":"messenger","description":"The messenger."},"method_filter":{"type":"Drupal\\Core\\Routing\\FilterInterface","name":"method_filter","description":"The method_filter service."},"migrate.plugin_event_subscriber":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"migrate_plugin_event_subscriber","description":"The migrate.plugin_event_subscriber service."},"migrate_drupal.field_discovery":{"type":"Drupal\\migrate_drupal\\FieldDiscoveryInterface","name":"migrate_drupal_field_discovery","description":"The migrate_drupal.field_discovery service."},"module_handler":{"type":"Drupal\\Core\\Extension\\ModuleHandlerInterface","name":"module_handler","description":"The module handler."},"node.admin_path.route_subscriber":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"node_admin_path_route_subscriber","description":"The node.admin_path.route_subscriber service."},"node.grant_storage":{"type":"Drupal\\node\\NodeGrantDatabaseStorageInterface","name":"node_grant_storage","description":"The node.grant_storage service."},"node.node_route_context":{"type":"Drupal\\Core\\Plugin\\Context\\ContextProviderInterface","name":"node_node_route_context","description":"The node.node_route_context service."},"node.node_translation_exception":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"node_node_translation_exception","description":"The node.node_translation_exception service."},"node.node_translation_migrate":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"node_node_translation_migrate","description":"The node.node_translation_migrate service."},"node.route_subscriber":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"node_route_subscriber","description":"The node.route_subscriber service."},"node_preview":{"type":"Drupal\\Core\\ParamConverter\\ParamConverterInterface","name":"node_preview","description":"The node_preview service."},"options_request_listener":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"options_request_listener","description":"The options_request_listener service."},"page_cache_kill_switch":{"type":"Drupal\\Core\\PageCache\\ResponsePolicy\\KillSwitch","name":"killSwitch","description":"The kill switch."},"page_cache_request_policy":{"type":"Drupal\\Core\\PageCache\\RequestPolicyInterface","name":"request_policy","description":"A policy rule determining the cacheability of a request."},"page_cache_response_policy":{"type":"Drupal\\Core\\PageCache\\ResponsePolicyInterface","name":"response_policy","description":"A policy rule determining the cacheability of a response."},"paramconverter.configentity_admin":{"type":"Drupal\\Core\\ParamConverter\\ParamConverterInterface","name":"paramconverter_configentity_admin","description":"The paramconverter.configentity_admin service."},"paramconverter.entity_revision":{"type":"Drupal\\Core\\ParamConverter\\ParamConverterInterface","name":"paramconverter_entity_revision","description":"The paramconverter.entity_revision service."},"paramconverter.jsonapi.resource_type":{"type":"Drupal\\Core\\ParamConverter\\ParamConverterInterface","name":"paramconverter_jsonapi_resource_type","description":"The paramconverter.jsonapi.resource_type service."},"paramconverter.menu_link":{"type":"Drupal\\Core\\ParamConverter\\ParamConverterInterface","name":"paramconverter_menu_link","description":"The paramconverter.menu_link service."},"paramconverter.views_ui":{"type":"Drupal\\Core\\ParamConverter\\ParamConverterInterface","name":"paramconverter_views_ui","description":"The paramconverter.views_ui service."},"paramconverter_manager":{"type":"Drupal\\Core\\ParamConverter\\ParamConverterManagerInterface","name":"param_converter_manager","description":"The parameter converter manager that will be responsible for upcasting"},"paramconverter_subscriber":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"paramconverter_subscriber","description":"The paramconverter_subscriber service."},"password":{"type":"Drupal\\Core\\Password\\PasswordInterface","name":"password_checker","description":"The password service."},"path.alias_manager":{"type":"Drupal\\Core\\Path\\AliasManagerInterface","name":"alias_manager","description":"The alias manager."},"path.alias_storage":{"type":"Drupal\\Core\\Path\\AliasStorageInterface","name":"alias_storage","description":"The alias storage service."},"path.alias_whitelist":{"type":"Drupal\\Core\\Path\\AliasWhitelistInterface","name":"whitelist","description":"The whitelist implementation to use."},"path.current":{"type":"Drupal\\Core\\Path\\CurrentPathStack","name":"current_path","description":"The current path."},"path.matcher":{"type":"Drupal\\Core\\Path\\PathMatcherInterface","name":"path_matcher","description":"The path matcher."},"path.validator":{"type":"Drupal\\Core\\Path\\PathValidatorInterface","name":"path_validator","description":"The path.validator service."},"path_processor.files":{"type":"Drupal\\Core\\PathProcessor\\InboundPathProcessorInterface","name":"path_processor_files","description":"The path_processor.files service."},"path_processor.image_styles":{"type":"Drupal\\Core\\PathProcessor\\InboundPathProcessorInterface","name":"path_processor_image_styles","description":"The path_processor.image_styles service."},"path_processor_alias":{"type":"Drupal\\Core\\PathProcessor\\InboundPathProcessorInterface","name":"path_processor_alias","description":"The path_processor_alias service."},"path_processor_decode":{"type":"Drupal\\Core\\PathProcessor\\InboundPathProcessorInterface","name":"path_processor_decode","description":"The path_processor_decode service."},"path_processor_front":{"type":"Drupal\\Core\\PathProcessor\\InboundPathProcessorInterface","name":"path_processor_front","description":"The path_processor_front service."},"path_processor_manager":{"type":"Drupal\\Core\\PathProcessor\\InboundPathProcessorInterface","name":"path_processor","description":"The path processor."},"path_subscriber":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"path_subscriber","description":"The path_subscriber service."},"pgsql.entity.query.sql":{"type":"Drupal\\Core\\Entity\\Query\\QueryFactoryInterface","name":"pgsql_entity_query_sql","description":"The pgsql.entity.query.sql service."},"placeholder_strategy":{"type":"Drupal\\Core\\Render\\Placeholder\\PlaceholderStrategyInterface","name":"placeholder_strategy","description":"The placeholder strategy to use."},"placeholder_strategy.big_pipe":{"type":"Drupal\\Core\\Render\\Placeholder\\PlaceholderStrategyInterface","name":"placeholder_strategy_big_pipe","description":"The placeholder_strategy.big_pipe service."},"placeholder_strategy.single_flush":{"type":"Drupal\\Core\\Render\\Placeholder\\PlaceholderStrategyInterface","name":"placeholder_strategy_single_flush","description":"The placeholder_strategy.single_flush service."},"plugin.cache_clearer":{"type":"Drupal\\Core\\Plugin\\CachedDiscoveryClearerInterface","name":"plugin_cache_clearer","description":"The plugin.cache_clearer service."},"plugin.manager.action":{"type":"Drupal\\Core\\Cache\\CacheableDependencyInterface","name":"plugin_manager_action","description":"The plugin.manager.action service."},"plugin.manager.aggregator.fetcher":{"type":"Drupal\\aggregator\\Plugin\\AggregatorPluginManager","name":"fetcher_manager","description":"The aggregator fetcher plugin manager."},"plugin.manager.aggregator.parser":{"type":"Drupal\\aggregator\\Plugin\\AggregatorPluginManager","name":"parser_manager","description":"The aggregator parser plugin manager."},"plugin.manager.aggregator.processor":{"type":"Drupal\\aggregator\\Plugin\\AggregatorPluginManager","name":"processor_manager","description":"The aggregator processor plugin manager."},"plugin.manager.archiver":{"type":"Drupal\\Core\\Cache\\CacheableDependencyInterface","name":"plugin_manager_archiver","description":"The plugin.manager.archiver service."},"plugin.manager.block":{"type":"Drupal\\Core\\Cache\\CacheableDependencyInterface","name":"plugin_manager_block","description":"The plugin.manager.block service."},"plugin.manager.ckeditor.plugin":{"type":"Drupal\\Core\\Cache\\CacheableDependencyInterface","name":"plugin_manager_ckeditor_plugin","description":"The plugin.manager.ckeditor.plugin service."},"plugin.manager.condition":{"type":"Drupal\\Core\\Cache\\CacheableDependencyInterface","name":"plugin_manager_condition","description":"The plugin.manager.condition service."},"plugin.manager.config_translation.mapper":{"type":"Drupal\\config_translation\\ConfigMapperManagerInterface","name":"config_mapper_manager","description":"The mapper plugin discovery service."},"plugin.manager.core.layout":{"type":"Drupal\\Core\\Cache\\CacheableDependencyInterface","name":"plugin_manager_core_layout","description":"The plugin.manager.core.layout service."},"plugin.manager.display_variant":{"type":"Drupal\\Component\\Plugin\\PluginManagerInterface","name":"display_variant_manager","description":"The display variant manager."},"plugin.manager.editor":{"type":"Drupal\\Component\\Plugin\\PluginManagerInterface","name":"plugin_manager","description":"The Text Editor plugin manager service."},"plugin.manager.element_info":{"type":"Drupal\\Core\\Render\\ElementInfoManagerInterface","name":"element_info","description":"The element info manager."},"plugin.manager.entity_reference_selection":{"type":"Drupal\\Core\\Entity\\EntityReferenceSelection\\SelectionPluginManagerInterface","name":"selection_manager","description":"The entity reference selection handler plugin manager."},"plugin.manager.field.field_type":{"type":"Drupal\\Core\\Field\\FieldTypePluginManagerInterface","name":"field_type_manager","description":"The 'field type' plugin manager."},"plugin.manager.field.formatter":{"type":"Drupal\\Core\\Field\\FormatterPluginManager","name":"formatter_manager","description":"The manager for formatter plugins."},"plugin.manager.field.widget":{"type":"Drupal\\Core\\Cache\\CacheableDependencyInterface","name":"plugin_manager_field_widget","description":"The plugin.manager.field.widget service."},"plugin.manager.filter":{"type":"Drupal\\Component\\Plugin\\PluginManagerInterface","name":"filter_manager","description":"The filter plugin manager."},"plugin.manager.help_section":{"type":"Drupal\\Core\\Cache\\CacheableDependencyInterface","name":"plugin_manager_help_section","description":"The plugin.manager.help_section service."},"plugin.manager.help_topic":{"type":"Drupal\\Core\\Cache\\CacheableDependencyInterface","name":"plugin_manager_help_topic","description":"The plugin.manager.help_topic service."},"plugin.manager.image.effect":{"type":"Drupal\\Core\\Cache\\CacheableDependencyInterface","name":"plugin_manager_image_effect","description":"The plugin.manager.image.effect service."},"plugin.manager.language_negotiation_method":{"type":"Drupal\\Component\\Plugin\\PluginManagerInterface","name":"negotiator_manager","description":"The language negotiation methods plugin manager"},"plugin.manager.layout_builder.section_storage":{"type":"Drupal\\layout_builder\\SectionStorage\\SectionStorageManagerInterface","name":"section_storage_manager","description":"The section storage manager."},"plugin.manager.link_relation_type":{"type":"Drupal\\Core\\Cache\\CacheableDependencyInterface","name":"plugin_manager_link_relation_type","description":"The plugin.manager.link_relation_type service."},"plugin.manager.mail":{"type":"Drupal\\Core\\Mail\\MailManagerInterface","name":"mail_manager","description":"Mail manager service."},"plugin.manager.media.source":{"type":"Drupal\\Core\\Cache\\CacheableDependencyInterface","name":"plugin_manager_media_source","description":"The plugin.manager.media.source service."},"plugin.manager.menu.contextual_link":{"type":"Drupal\\Core\\Cache\\CacheableDependencyInterface","name":"plugin_manager_menu_contextual_link","description":"The plugin.manager.menu.contextual_link service."},"plugin.manager.menu.link":{"type":"Drupal\\Core\\Menu\\MenuLinkManagerInterface","name":"menu_link_manager","description":"The menu link plugin manager."},"plugin.manager.menu.local_action":{"type":"Drupal\\Core\\Cache\\CacheableDependencyInterface","name":"plugin_manager_menu_local_action","description":"The plugin.manager.menu.local_action service."},"plugin.manager.menu.local_task":{"type":"Drupal\\Core\\Cache\\CacheableDependencyInterface","name":"plugin_manager_menu_local_task","description":"The plugin.manager.menu.local_task service."},"plugin.manager.migrate.cckfield":{"type":"Drupal\\migrate_drupal\\Plugin\\MigrateFieldPluginManagerInterface","name":"plugin_manager_migrate_cckfield","description":"The plugin.manager.migrate.cckfield service."},"plugin.manager.migrate.destination":{"type":"Drupal\\migrate\\Plugin\\MigratePluginManagerInterface","name":"plugin_manager_migrate_destination","description":"The plugin.manager.migrate.destination service."},"plugin.manager.migrate.field":{"type":"Drupal\\migrate_drupal\\Plugin\\MigrateFieldPluginManagerInterface","name":"field_plugin_manager","description":"The field plugin manager."},"plugin.manager.migrate.id_map":{"type":"Drupal\\Core\\Cache\\CacheableDependencyInterface","name":"plugin_manager_migrate_id_map","description":"The plugin.manager.migrate.id_map service."},"plugin.manager.migrate.process":{"type":"Drupal\\Core\\Cache\\CacheableDependencyInterface","name":"plugin_manager_migrate_process","description":"The plugin.manager.migrate.process service."},"plugin.manager.migrate.source":{"type":"Drupal\\migrate\\Plugin\\MigrateSourcePluginManager","name":"source_manager","description":"The Migrate source plugin manager service."},"plugin.manager.migration":{"type":"Drupal\\migrate\\Plugin\\MigrationPluginManagerInterface","name":"migration_plugin_manager","description":"The migration plugin manager."},"plugin.manager.queue_worker":{"type":"Drupal\\Core\\Queue\\QueueWorkerManagerInterface","name":"queue_manager","description":"The queue plugin manager."},"plugin.manager.quickedit.editor":{"type":"Drupal\\Component\\Plugin\\PluginManagerInterface","name":"editor_manager","description":"The manager for editor plugins."},"plugin.manager.rest":{"type":"Drupal\\rest\\Plugin\\Type\\ResourcePluginManager","name":"manager","description":"The resource plugin manager."},"plugin.manager.search":{"type":"Drupal\\Core\\Cache\\CacheableDependencyInterface","name":"plugin_manager_search","description":"The plugin.manager.search service."},"plugin.manager.tour.tip":{"type":"Drupal\\Core\\Cache\\CacheableDependencyInterface","name":"plugin_manager_tour_tip","description":"The plugin.manager.tour.tip service."},"plugin.manager.views.access":{"type":"Drupal\\Core\\Cache\\CacheableDependencyInterface","name":"plugin_manager_views_access","description":"The plugin.manager.views.access service."},"plugin.manager.views.area":{"type":"Drupal\\Core\\Cache\\CacheableDependencyInterface","name":"plugin_manager_views_area","description":"The plugin.manager.views.area service."},"plugin.manager.views.argument":{"type":"Drupal\\Core\\Cache\\CacheableDependencyInterface","name":"plugin_manager_views_argument","description":"The plugin.manager.views.argument service."},"plugin.manager.views.argument_default":{"type":"Drupal\\Core\\Cache\\CacheableDependencyInterface","name":"plugin_manager_views_argument_default","description":"The plugin.manager.views.argument_default service."},"plugin.manager.views.argument_validator":{"type":"Drupal\\Core\\Cache\\CacheableDependencyInterface","name":"plugin_manager_views_argument_validator","description":"The plugin.manager.views.argument_validator service."},"plugin.manager.views.cache":{"type":"Drupal\\Core\\Cache\\CacheableDependencyInterface","name":"plugin_manager_views_cache","description":"The plugin.manager.views.cache service."},"plugin.manager.views.display":{"type":"Drupal\\Core\\Cache\\CacheableDependencyInterface","name":"plugin_manager_views_display","description":"The plugin.manager.views.display service."},"plugin.manager.views.display_extender":{"type":"Drupal\\Core\\Cache\\CacheableDependencyInterface","name":"plugin_manager_views_display_extender","description":"The plugin.manager.views.display_extender service."},"plugin.manager.views.exposed_form":{"type":"Drupal\\Core\\Cache\\CacheableDependencyInterface","name":"plugin_manager_views_exposed_form","description":"The plugin.manager.views.exposed_form service."},"plugin.manager.views.field":{"type":"Drupal\\Core\\Cache\\CacheableDependencyInterface","name":"plugin_manager_views_field","description":"The plugin.manager.views.field service."},"plugin.manager.views.filter":{"type":"Drupal\\Core\\Cache\\CacheableDependencyInterface","name":"plugin_manager_views_filter","description":"The plugin.manager.views.filter service."},"plugin.manager.views.join":{"type":"Drupal\\Core\\Cache\\CacheableDependencyInterface","name":"plugin_manager_views_join","description":"The plugin.manager.views.join service."},"plugin.manager.views.pager":{"type":"Drupal\\Core\\Cache\\CacheableDependencyInterface","name":"plugin_manager_views_pager","description":"The plugin.manager.views.pager service."},"plugin.manager.views.query":{"type":"Drupal\\Core\\Cache\\CacheableDependencyInterface","name":"plugin_manager_views_query","description":"The plugin.manager.views.query service."},"plugin.manager.views.relationship":{"type":"Drupal\\Core\\Cache\\CacheableDependencyInterface","name":"plugin_manager_views_relationship","description":"The plugin.manager.views.relationship service."},"plugin.manager.views.row":{"type":"Drupal\\Core\\Cache\\CacheableDependencyInterface","name":"plugin_manager_views_row","description":"The plugin.manager.views.row service."},"plugin.manager.views.sort":{"type":"Drupal\\Core\\Cache\\CacheableDependencyInterface","name":"plugin_manager_views_sort","description":"The plugin.manager.views.sort service."},"plugin.manager.views.style":{"type":"Drupal\\Core\\Cache\\CacheableDependencyInterface","name":"plugin_manager_views_style","description":"The plugin.manager.views.style service."},"plugin.manager.views.wizard":{"type":"Drupal\\Core\\Cache\\CacheableDependencyInterface","name":"plugin_manager_views_wizard","description":"The plugin.manager.views.wizard service."},"plugin.manager.workflows.type":{"type":"Drupal\\Core\\Cache\\CacheableDependencyInterface","name":"plugin_manager_workflows_type","description":"The plugin.manager.workflows.type service."},"plugin_form.factory":{"type":"Drupal\\Core\\Plugin\\PluginFormFactoryInterface","name":"plugin_form_factory","description":"The plugin_form.factory service."},"private_key":{"type":"Drupal\\Core\\PrivateKey","name":"private_key","description":"The private key service."},"psr7.http_foundation_factory":{"type":"Symfony\\Bridge\\PsrHttpMessage\\HttpFoundationFactoryInterface","name":"http_foundation_factory","description":"The httpFoundation factory."},"psr7.http_message_factory":{"type":"Symfony\\Bridge\\PsrHttpMessage\\HttpMessageFactoryInterface","name":"http_message_factory","description":"The PSR-7 converter."},"psr_response_view_subscriber":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"psr_response_view_subscriber","description":"The psr_response_view_subscriber service."},"queue":{"type":"Drupal\\Core\\Queue\\QueueFactory","name":"queue_factory","description":"The queue factory"},"queue.database":{"type":"Drupal\\Core\\Queue\\QueueDatabaseFactory","name":"queue_database","description":"The queue.database service."},"quickedit.editor.selector":{"type":"Drupal\\quickedit\\EditorSelectorInterface","name":"editor_selector","description":"An object that determines which editor to attach to a given field."},"quickedit.metadata.generator":{"type":"Drupal\\quickedit\\MetadataGeneratorInterface","name":"quickedit_metadata_generator","description":"The quickedit.metadata.generator service."},"redirect.destination":{"type":"Drupal\\Core\\Routing\\RedirectDestinationInterface","name":"redirect_destination","description":"The redirect destination service."},"redirect_leading_slashes_subscriber":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"redirect_leading_slashes_subscriber","description":"The redirect_leading_slashes_subscriber service."},"redirect_response_subscriber":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"redirect_response_subscriber","description":"The redirect_response_subscriber service."},"render_cache":{"type":"Drupal\\Core\\Render\\RenderCacheInterface","name":"render_cache","description":"The render cache service."},"render_placeholder_generator":{"type":"Drupal\\Core\\Render\\PlaceholderGeneratorInterface","name":"placeholder_generator","description":"The placeholder generator."},"renderer":{"type":"Drupal\\Core\\Render\\RendererInterface","name":"renderer","description":"The renderer."},"renderer_non_html":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"renderer_non_html","description":"The renderer_non_html service."},"request_close_subscriber":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"request_close_subscriber","description":"The request_close_subscriber service."},"request_format_route_filter":{"type":"Drupal\\Core\\Routing\\FilterInterface","name":"request_format_route_filter","description":"The request_format_route_filter service."},"request_stack":{"type":"Symfony\\Component\\HttpFoundation\\RequestStack","name":"request_stack","description":"The request stack."},"required_module_uninstall_validator":{"type":"Drupal\\Core\\Extension\\ModuleUninstallValidatorInterface","name":"required_module_uninstall_validator","description":"The required_module_uninstall_validator service."},"resolver_manager.entity":{"type":"Drupal\\Core\\Entity\\EntityResolverManager","name":"entity_resolver_manager","description":"The entity resolver manager."},"response_filter.active_link":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"response_filter_active_link","description":"The response_filter.active_link service."},"response_filter.rss.relative_url":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"response_filter_rss_relative_url","description":"The response_filter.rss.relative_url service."},"response_generator_subscriber":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"response_generator_subscriber","description":"The response_generator_subscriber service."},"rest.config_subscriber":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"rest_config_subscriber","description":"The rest.config_subscriber service."},"rest.link_manager":{"type":"Drupal\\hal\\LinkManager\\TypeLinkManagerInterface","name":"rest_link_manager","description":"The rest.link_manager service."},"rest.link_manager.relation":{"type":"Drupal\\hal\\LinkManager\\ConfigurableLinkManagerInterface","name":"rest_link_manager_relation","description":"The rest.link_manager.relation service."},"rest.link_manager.type":{"type":"Drupal\\hal\\LinkManager\\ConfigurableLinkManagerInterface","name":"rest_link_manager_type","description":"The rest.link_manager.type service."},"rest.path_processor_entity_resource_bc":{"type":"Drupal\\Core\\PathProcessor\\InboundPathProcessorInterface","name":"rest_path_processor_entity_resource_bc","description":"The rest.path_processor_entity_resource_bc service."},"rest.resource.entity.post_route.subscriber":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"rest_resource_entity_post_route_subscriber","description":"The rest.resource.entity.post_route.subscriber service."},"rest.resource_response.subscriber":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"rest_resource_response_subscriber","description":"The rest.resource_response.subscriber service."},"rest.resource_routes":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"rest_resource_routes","description":"The rest.resource_routes service."},"rest.route_processor_get_bc":{"type":"Drupal\\Core\\RouteProcessor\\OutboundRouteProcessorInterface","name":"rest_route_processor_get_bc","description":"The rest.route_processor_get_bc service."},"route_access_response_subscriber":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"route_access_response_subscriber","description":"The route_access_response_subscriber service."},"route_enhancer.entity":{"type":"Drupal\\Core\\Routing\\EnhancerInterface","name":"route_enhancer_entity","description":"The route_enhancer.entity service."},"route_enhancer.entity_revision":{"type":"Drupal\\Core\\Routing\\EnhancerInterface","name":"route_enhancer_entity_revision","description":"The route_enhancer.entity_revision service."},"route_enhancer.form":{"type":"Drupal\\Core\\Routing\\EnhancerInterface","name":"route_enhancer_form","description":"The route_enhancer.form service."},"route_enhancer.param_conversion":{"type":"Drupal\\Core\\Routing\\EnhancerInterface","name":"route_enhancer_param_conversion","description":"The route_enhancer.param_conversion service."},"route_http_method_subscriber":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"route_http_method_subscriber","description":"The route_http_method_subscriber service."},"route_processor_csrf":{"type":"Drupal\\Core\\RouteProcessor\\OutboundRouteProcessorInterface","name":"route_processor_csrf","description":"The route_processor_csrf service."},"route_processor_current":{"type":"Drupal\\Core\\RouteProcessor\\OutboundRouteProcessorInterface","name":"route_processor_current","description":"The route_processor_current service."},"route_processor_manager":{"type":"Drupal\\Core\\RouteProcessor\\OutboundRouteProcessorInterface","name":"route_processor_manager","description":"The route_processor_manager service."},"route_special_attributes_subscriber":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"route_special_attributes_subscriber","description":"The route_special_attributes_subscriber service."},"route_subscriber.entity":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"route_subscriber_entity","description":"The route_subscriber.entity service."},"route_subscriber.module":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"route_subscriber_module","description":"The route_subscriber.module service."},"route_subscriber.no_big_pipe":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"route_subscriber_no_big_pipe","description":"The route_subscriber.no_big_pipe service."},"router":{"type":"Drupal\\Core\\Routing\\AccessAwareRouterInterface","name":"access_aware_router","description":"The access aware router."},"router.admin_context":{"type":"Drupal\\Core\\Routing\\AdminContext","name":"admin_context","description":"The route admin context to determine whether the route is an admin one."},"router.builder":{"type":"Drupal\\Core\\Routing\\RouteBuilderInterface","name":"router_builder","description":"The router builder service."},"router.dumper":{"type":"Drupal\\Core\\Routing\\MatcherDumperInterface","name":"dumper","description":"The matcher dumper used to store the route information."},"router.dynamic":{"type":"Symfony\\Component\\Routing\\RouterInterface","name":"router_dynamic","description":"The router.dynamic service."},"router.matcher.final_matcher":{"type":"Symfony\\Cmf\\Component\\Routing\\NestedMatcher\\FinalMatcherInterface","name":"router_matcher_final_matcher","description":"The router.matcher.final_matcher service."},"router.no_access_checks":{"type":"Symfony\\Component\\Routing\\Matcher\\UrlMatcherInterface","name":"access_unaware_router","description":"A router implementation which does not check access."},"router.path_roots_subscriber":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"router_path_roots_subscriber","description":"The router.path_roots_subscriber service."},"router.request_context":{"type":"Drupal\\Core\\Routing\\RequestContext","name":"request_context","description":"The request context."},"router.route_preloader":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"router_route_preloader","description":"The router.route_preloader service."},"router.route_provider":{"type":"Drupal\\Core\\Routing\\RouteProviderInterface","name":"route_provider","description":"The route provider."},"router.route_provider.lazy_builder":{"type":"Drupal\\Core\\Routing\\PreloadableRouteProviderInterface","name":"router_route_provider_lazy_builder","description":"The router.route_provider.lazy_builder service."},"router_listener":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"router_listener","description":"The router_listener service."},"search.search_page_repository":{"type":"Drupal\\search\\SearchPageRepositoryInterface","name":"search_search_page_repository","description":"The search.search_page_repository service."},"serialization.bc_config_subscriber":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"serialization_bc_config_subscriber","description":"The serialization.bc_config_subscriber service."},"serialization.entity_resolver.target_id":{"type":"Drupal\\serialization\\EntityResolver\\EntityResolverInterface","name":"serialization_entity_resolver_target_id","description":"The serialization.entity_resolver.target_id service."},"serialization.exception.default":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"serialization_exception_default","description":"The serialization.exception.default service."},"serialization.json":{"type":"Drupal\\Component\\Serialization\\SerializationInterface","name":"serialization_json","description":"The serialization.json service."},"serialization.phpserialize":{"type":"Drupal\\Component\\Serialization\\SerializationInterface","name":"serializer","description":"The serialization class to use."},"serialization.user_route_alter_subscriber":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"serialization_user_route_alter_subscriber","description":"The serialization.user_route_alter_subscriber service."},"serialization.yaml":{"type":"Drupal\\Component\\Serialization\\SerializationInterface","name":"serialization_yaml","description":"The serialization.yaml service."},"serializer":{"type":"Symfony\\Component\\Serializer\\SerializerInterface","name":"serializer","description":"The serializer."},"serializer.entity_resolver":{"type":"Drupal\\serialization\\EntityResolver\\ChainEntityResolverInterface","name":"serializer_entity_resolver","description":"The serializer.entity_resolver service."},"serializer.entity_resolver.uuid":{"type":"Drupal\\serialization\\EntityResolver\\EntityResolverInterface","name":"serializer_entity_resolver_uuid","description":"The serializer.entity_resolver.uuid service."},"serializer.normalizer.htt_exception.jsonapi":{"type":"Symfony\\Component\\Serializer\\SerializerAwareInterface","name":"serializer_normalizer_htt_exception_jsonapi","description":"The serializer.normalizer.htt_exception.jsonapi service."},"service_container":{"type":"Symfony\\Component\\DependencyInjection\\ContainerInterface","name":"container","description":"The container."},"session":{"type":"Symfony\\Component\\HttpFoundation\\Session\\SessionInterface","name":"session","description":"The session."},"session_configuration":{"type":"Drupal\\Core\\Session\\SessionConfigurationInterface","name":"session_configuration","description":"The session configuration."},"session_handler.storage":{"type":"SessionHandlerInterface","name":"wrapped_session_handler","description":"The underlying session handler."},"session_handler.write_safe":{"type":"Drupal\\Core\\Session\\WriteSafeSessionHandlerInterface","name":"write_safe_handler","description":"The write-safe session handler."},"session_manager.metadata_bag":{"type":"Drupal\\Core\\Session\\MetadataBag","name":"session_metadata","description":"The session metadata bag."},"settings":{"type":"Drupal\\Core\\Site\\Settings","name":"settings","description":"The site settings."},"state":{"type":"Drupal\\Core\\State\\StateInterface","name":"state","description":"The state service."},"statistics.storage.node":{"type":"Drupal\\statistics\\StatisticsStorageInterface","name":"statistics_storage_node","description":"The statistics.storage.node service."},"stream_wrapper.public":{"type":"Drupal\\Core\\StreamWrapper\\PhpStreamWrapperInterface","name":"stream_wrapper_public","description":"The stream_wrapper.public service."},"stream_wrapper.temporary":{"type":"Drupal\\Core\\StreamWrapper\\PhpStreamWrapperInterface","name":"stream_wrapper_temporary","description":"The stream_wrapper.temporary service."},"stream_wrapper.translations":{"type":"Drupal\\Core\\StreamWrapper\\PhpStreamWrapperInterface","name":"stream_wrapper_translations","description":"The stream_wrapper.translations service."},"stream_wrapper_manager":{"type":"Drupal\\Core\\StreamWrapper\\StreamWrapperManagerInterface","name":"stream_wrapper_manager","description":"The stream wrapper manager."},"string_translation":{"type":"Drupal\\Core\\StringTranslation\\TranslationInterface","name":"string_translation","description":"The string translation service."},"string_translator.custom_strings":{"type":"Drupal\\Core\\StringTranslation\\Translator\\TranslatorInterface","name":"string_translator_custom_strings","description":"The string_translator.custom_strings service."},"string_translator.locale.lookup":{"type":"Drupal\\Core\\StringTranslation\\Translator\\TranslatorInterface","name":"string_translator_locale_lookup","description":"The string_translator.locale.lookup service."},"system.admin_path.route_subscriber":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"system_admin_path_route_subscriber","description":"The system.admin_path.route_subscriber service."},"system.breadcrumb.default":{"type":"Drupal\\Core\\Breadcrumb\\BreadcrumbBuilderInterface","name":"system_breadcrumb_default","description":"The system.breadcrumb.default service."},"system.config_cache_tag":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"system_config_cache_tag","description":"The system.config_cache_tag service."},"system.config_subscriber":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"system_config_subscriber","description":"The system.config_subscriber service."},"system.manager":{"type":"Drupal\\system\\SystemManager","name":"system_manager","description":"The system.manager service."},"taxonomy_term.breadcrumb":{"type":"Drupal\\Core\\Breadcrumb\\BreadcrumbBuilderInterface","name":"taxonomy_term_breadcrumb","description":"The taxonomy_term.breadcrumb service."},"tempstore.private":{"type":"Drupal\\Core\\TempStore\\PrivateTempStoreFactory","name":"temp_store_factory","description":"The tempstore service."},"tempstore.shared":{"type":"Drupal\\Core\\TempStore\\SharedTempStoreFactory","name":"temp_store_factory","description":"The shared tempstore factory."},"test_discovery":{"type":"Drupal\\simpletest\\TestDiscovery","name":"test_discovery","description":"The test discovery service."},"theme.initialization":{"type":"Drupal\\Core\\Theme\\ThemeInitializationInterface","name":"theme_initialization","description":"The theme initialization."},"theme.manager":{"type":"Drupal\\Core\\Theme\\ThemeManagerInterface","name":"theme_manager","description":"The theme manager."},"theme.negotiator":{"type":"Drupal\\Core\\Theme\\ThemeNegotiatorInterface","name":"theme_negotiator","description":"The theme negotiator."},"theme.negotiator.admin_theme":{"type":"Drupal\\Core\\Theme\\ThemeNegotiatorInterface","name":"theme_negotiator_admin_theme","description":"The theme.negotiator.admin_theme service."},"theme.negotiator.ajax_base_page":{"type":"Drupal\\Core\\Theme\\ThemeNegotiatorInterface","name":"theme_negotiator_ajax_base_page","description":"The theme.negotiator.ajax_base_page service."},"theme.negotiator.block.admin_demo":{"type":"Drupal\\Core\\Theme\\ThemeNegotiatorInterface","name":"theme_negotiator_block_admin_demo","description":"The theme.negotiator.block.admin_demo service."},"theme.negotiator.default":{"type":"Drupal\\Core\\Theme\\ThemeNegotiatorInterface","name":"theme_negotiator_default","description":"The theme.negotiator.default service."},"theme.negotiator.system.batch":{"type":"Drupal\\Core\\Theme\\ThemeNegotiatorInterface","name":"theme_negotiator_system_batch","description":"The theme.negotiator.system.batch service."},"theme.negotiator.system.db_update":{"type":"Drupal\\Core\\Theme\\ThemeNegotiatorInterface","name":"theme_negotiator_system_db_update","description":"The theme.negotiator.system.db_update service."},"theme.registry":{"type":"Drupal\\Core\\Theme\\Registry","name":"theme_registry","description":"The theme registry."},"theme_handler":{"type":"Drupal\\Core\\Extension\\ThemeHandlerInterface","name":"theme_handler","description":"The theme handler."},"theme_installer":{"type":"Drupal\\Core\\Extension\\ThemeInstallerInterface","name":"theme_installer","description":"The theme_installer service."},"title_resolver":{"type":"Drupal\\Core\\Controller\\TitleResolverInterface","name":"title_resolver","description":"The title resolver."},"token":{"type":"Drupal\\Core\\Utility\\Token","name":"token","description":"The token service."},"toolbar.page_cache_request_policy.allow_toolbar_path":{"type":"Drupal\\Core\\PageCache\\RequestPolicyInterface","name":"toolbar_page_cache_request_policy_allow_toolbar_path","description":"The toolbar.page_cache_request_policy.allow_toolbar_path service."},"transliteration":{"type":"Drupal\\Component\\Transliteration\\TransliterationInterface","name":"transliteration","description":"The transliteration service."},"twig.extension":{"type":"Twig\\Extension\\ExtensionInterface","name":"twig_extension","description":"The twig.extension service."},"twig.extension.debug":{"type":"Twig\\Extension\\ExtensionInterface","name":"twig_extension_debug","description":"The twig.extension.debug service."},"twig.loader.filesystem":{"type":"Twig\\Loader\\SourceContextLoaderInterface","name":"twig_loader_filesystem","description":"The twig.loader.filesystem service."},"twig.loader.string":{"type":"Twig\\Loader\\LoaderInterface","name":"twig_loader_string","description":"The twig.loader.string service."},"twig.loader.theme_registry":{"type":"Twig\\Loader\\SourceContextLoaderInterface","name":"twig_loader_theme_registry","description":"The twig.loader.theme_registry service."},"typed_data_manager":{"type":"Drupal\\Core\\TypedData\\TypedDataManagerInterface","name":"typed_data_manager","description":"The typed data manager."},"unrouted_url_assembler":{"type":"Drupal\\Core\\Utility\\UnroutedUrlAssemblerInterface","name":"url_assembler","description":"The unrouted URL assembler service."},"update.fetcher":{"type":"Drupal\\update\\UpdateFetcherInterface","name":"update_fetcher","description":"The update fetcher service"},"update.manager":{"type":"Drupal\\update\\UpdateManagerInterface","name":"update_manager","description":"The update.manager service."},"update.post_update_registry":{"type":"Drupal\\Core\\Update\\UpdateRegistry","name":"update_post_update_registry","description":"The update.post_update_registry service."},"update.post_update_registry_factory":{"type":"Symfony\\Component\\DependencyInjection\\ContainerAwareInterface","name":"update_post_update_registry_factory","description":"The update.post_update_registry_factory service."},"update.processor":{"type":"Drupal\\update\\UpdateProcessorInterface","name":"update_processor","description":"The Update Processor service."},"url_generator":{"type":"Drupal\\Core\\Routing\\UrlGeneratorInterface","name":"url_generator","description":"The URL generator."},"user.auth":{"type":"Drupal\\user\\UserAuthInterface","name":"user_auth","description":"The user authentication service."},"user.authentication.cookie":{"type":"Drupal\\Core\\Authentication\\AuthenticationProviderInterface","name":"user_authentication_cookie","description":"The user.authentication.cookie service."},"user.current_user_context":{"type":"Drupal\\Core\\Plugin\\Context\\ContextProviderInterface","name":"user_current_user_context","description":"The user.current_user_context service."},"user.data":{"type":"Drupal\\user\\UserDataInterface","name":"user_data","description":"The user data service."},"user.permissions":{"type":"Drupal\\user\\PermissionHandlerInterface","name":"user_permissions","description":"The user.permissions service."},"user.private_tempstore":{"type":"Drupal\\user\\PrivateTempStoreFactory","name":"user_private_tempstore","description":"The user.private_tempstore service."},"user.shared_tempstore":{"type":"Drupal\\user\\SharedTempStoreFactory","name":"user_shared_tempstore","description":"The user.shared_tempstore service."},"user.toolbar_link_builder":{"type":"Drupal\\user\\ToolbarLinkBuilder","name":"user_toolbar_link_builder","description":"The user.toolbar_link_builder service."},"user_access_denied_subscriber":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"user_access_denied_subscriber","description":"The user_access_denied_subscriber service."},"user_last_access_subscriber":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"user_last_access_subscriber","description":"The user_last_access_subscriber service."},"user_maintenance_mode_subscriber":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"user_maintenance_mode_subscriber","description":"The user_maintenance_mode_subscriber service."},"user_permissions_hash_generator":{"type":"Drupal\\Core\\Session\\PermissionsHashGeneratorInterface","name":"permissions_hash_generator","description":"The permissions hash generator."},"uuid":{"type":"Drupal\\Component\\Uuid\\UuidInterface","name":"uuid","description":"The uuid service."},"validation.constraint":{"type":"Drupal\\Core\\Cache\\CacheableDependencyInterface","name":"validation_constraint","description":"The validation.constraint service."},"views.analyzer":{"type":"Drupal\\views\\Analyzer","name":"views_analyzer","description":"The views.analyzer service."},"views.date_sql":{"type":"Drupal\\views\\Plugin\\views\\query\\DateSqlInterface","name":"views_date_sql","description":"The views.date_sql service."},"views.entity_schema_subscriber":{"type":"Drupal\\Core\\Entity\\EntityTypeListenerInterface","name":"views_entity_schema_subscriber","description":"The views.entity_schema_subscriber service."},"views.executable":{"type":"Drupal\\views\\ViewExecutableFactory","name":"views_executable_factory","description":"The views executable factory."},"views.exposed_form_cache":{"type":"Drupal\\views\\ExposedFormCache","name":"views_exposed_form_cache","description":"The views.exposed_form_cache service."},"views.route_subscriber":{"type":"Symfony\\Component\\EventDispatcher\\EventSubscriberInterface","name":"views_route_subscriber","description":"The views.route_subscriber service."},"views.views_data":{"type":"Drupal\\views\\ViewsData","name":"views_data","description":"The views data cache."},"views.views_data_helper":{"type":"Drupal\\views\\ViewsDataHelper","name":"views_views_data_helper","description":"The views.views_data_helper service."},"workflows.access_check.delete_state":{"type":"Drupal\\Core\\Routing\\Access\\AccessInterface","name":"workflows_access_check_delete_state","description":"The workflows.access_check.delete_state service."},"workflows.access_check.extended_permissions":{"type":"Drupal\\Core\\Routing\\Access\\AccessInterface","name":"workflows_access_check_extended_permissions","description":"The workflows.access_check.extended_permissions service."}} \ No newline at end of file diff --git a/old.vendor/chi-teck/drupal-code-generator/src/ApplicationFactory.php b/old.vendor/chi-teck/drupal-code-generator/src/ApplicationFactory.php new file mode 100644 index 00000000..f3160e47 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/ApplicationFactory.php @@ -0,0 +1,56 @@ +setHelperSet($helper_set); + + return $application; + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Asset.php b/old.vendor/chi-teck/drupal-code-generator/src/Asset.php new file mode 100644 index 00000000..2aef27ae --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Asset.php @@ -0,0 +1,320 @@ +path, $this->getVars()); + } + + /** + * Getter for asset content. + * + * @return string + * Asset content. + */ + public function getContent() { + return $this->content; + } + + /** + * Getter for header template. + * + * @return string + * Asset header template. + */ + public function getHeaderTemplate() { + return $this->headerTemplate; + } + + /** + * Getter for template. + * + * @return string + * Asset template. + */ + public function getTemplate() { + return $this->template; + } + + /** + * Getter for asset vars. + * + * @return array + * Asset template variables. + */ + public function getVars() { + return $this->vars; + } + + /** + * Getter for asset action. + * + * @return string + * Asset action. + */ + public function getAction() { + return $this->action; + } + + /** + * Getter for asset header size. + * + * @return string + * Asset header size. + */ + public function getHeaderSize() { + return $this->headerSize; + } + + /** + * Getter for asset mode. + * + * @return string + * Asset file mode. + */ + public function getMode() { + return $this->mode ?: ($this->isDirectory() ? 0755 : 0644); + } + + /** + * Getter for asset type. + * + * @return string + * Asset type. + */ + public function getType() { + return $this->type; + } + + /** + * Setter for asset path. + * + * @param string $path + * Asset path. + * + * @return \DrupalCodeGenerator\Asset + * The asset. + */ + public function path($path) { + $this->path = $path; + return $this; + } + + /** + * Setter for asset content. + * + * @param string $content + * Asset content. + * + * @return \DrupalCodeGenerator\Asset + * The asset. + */ + public function content($content) { + $this->content = $content; + return $this; + } + + /** + * Setter for asset header template. + * + * @param string $header_template + * Asset template. + * + * @return \DrupalCodeGenerator\Asset + * The asset. + */ + public function headerTemplate($header_template) { + $this->headerTemplate = $header_template; + return $this; + } + + /** + * Setter for asset template. + * + * @param string $template + * Asset template. + * + * @return \DrupalCodeGenerator\Asset + * The asset. + */ + public function template($template) { + $this->template = $template; + return $this; + } + + /** + * Setter for asset vars. + * + * @param array $vars + * Asset template variables. + * + * @return \DrupalCodeGenerator\Asset + * The asset. + */ + public function vars(array $vars) { + $this->vars = $vars; + return $this; + } + + /** + * Setter for asset action. + * + * @param string $action + * Asset action. + * + * @return \DrupalCodeGenerator\Asset + * The asset. + */ + public function action($action) { + $this->action = $action; + return $this; + } + + /** + * Setter for asset header size. + * + * @param int $header_size + * Asset header size. + * + * @return \DrupalCodeGenerator\Asset + * The asset. + */ + public function headerSize($header_size) { + $this->headerSize = $header_size; + return $this; + } + + /** + * Setter for asset mode. + * + * @param string $mode + * Asset mode. + * + * @return \DrupalCodeGenerator\Asset + * The asset. + */ + public function mode($mode) { + $this->mode = $mode; + return $this; + } + + /** + * Setter for asset type. + * + * @param string $type + * Asset type. + * + * @return \DrupalCodeGenerator\Asset + * The asset. + */ + public function type($type) { + $this->type = $type; + return $this; + } + + /** + * Determines if the asset is a directory. + * + * @return bool + * True if the asset is a directory, false otherwise. + */ + public function isDirectory() { + return $this->getType() == 'directory'; + } + + /** + * Renders the asset template. + * + * @param \DrupalCodeGenerator\Helper\Renderer $renderer + * Renderer helper. + */ + public function render(Renderer $renderer) { + if (!$this->isDirectory() && is_null($this->getContent())) { + $content = ''; + if ($header_template = $this->getHeaderTemplate()) { + $content .= $renderer->render($header_template, $this->getVars()) . "\n"; + } + $content .= $renderer->render($this->getTemplate(), $this->getVars()); + $this->content($content); + } + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Box/PhpCompactor.php b/old.vendor/chi-teck/drupal-code-generator/src/Box/PhpCompactor.php new file mode 100644 index 00000000..b65e8845 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Box/PhpCompactor.php @@ -0,0 +1,30 @@ +setName($this->name) + ->setDescription($this->description) + ->addOption( + 'directory', + '-d', + InputOption::VALUE_OPTIONAL, + 'Working directory' + ) + ->addOption( + 'answers', + '-a', + InputOption::VALUE_OPTIONAL, + 'Default JSON formatted answers' + ); + + if ($this->alias) { + $this->setAliases([$this->alias]); + } + + if (!$this->templatePath) { + $this->templatePath = ApplicationFactory::getRoot() . '/templates'; + } + } + + /** + * {@inheritdoc} + */ + protected function initialize(InputInterface $input, OutputInterface $output) { + $this->getHelperSet()->setCommand($this); + $this->getHelper('dcg_renderer')->addPath($this->templatePath); + + $directory = $input->getOption('directory') ?: getcwd(); + // No need to look up for extension root when generating an extension. + $extension_destinations = ['modules', 'profiles', 'themes']; + $is_extension = in_array($this->destination, $extension_destinations); + $this->directory = $is_extension + ? $directory : (Utils::getExtensionRoot($directory) ?: $directory); + + // Display welcome message. + $header = sprintf( + "\n Welcome to %s generator!", + $this->getName() + ); + $output->writeln($header); + $header_length = strlen(trim(strip_tags($header))); + $output->writeln('–' . str_repeat('–', $header_length) . '–'); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) { + + // Render all assets. + $renderer = $this->getHelper('dcg_renderer'); + foreach ($this->getAssets() as $asset) { + // Supply the asset with all collected variables if it has no local ones. + if (!$asset->getVars()) { + $asset->vars($this->vars); + } + $asset->render($renderer); + } + + $dumped_files = $this->getHelper('dcg_dumper')->dump($input, $output); + $this->getHelper('dcg_output_handler')->printSummary($output, $dumped_files); + return 0; + } + + /** + * {@inheritdoc} + */ + public function getLabel() { + return $this->label; + } + + /** + * Returns list of rendered files. + * + * @return array + * An associative array where each key is path to a file and value is + * rendered content. + * + * @deprecated. + */ + public function getFiles() { + return $this->files; + } + + /** + * {@inheritdoc} + */ + public function getAssets() { + if ($this->files) { + // Convert files into assets for legacy commands. + $assets = []; + foreach ($this->getFiles() as $path => $file) { + $asset = new Asset(); + $asset->path($path); + if (!is_array($file)) { + $file = ['content' => $file]; + } + if (isset($file['content'])) { + $asset->content($file['content']); + } + else { + $asset->type('directory'); + } + if (isset($file['action'])) { + $asset->action($file['action']); + } + if (isset($file['header_size'])) { + $asset->headerSize($file['header_size']); + } + if (isset($file['mode'])) { + $asset->mode($file['mode']); + } + $assets[] = $asset; + } + return array_merge($assets, $this->assets); + } + + return $this->assets; + } + + /** + * {@inheritdoc} + */ + public function setDirectory($directory) { + $this->directory = $directory; + } + + /** + * {@inheritdoc} + */ + public function getDirectory() { + return $this->directory; + } + + /** + * {@inheritdoc} + */ + public function setDestination($destination) { + $this->destination = $destination; + } + + /** + * {@inheritdoc} + */ + public function getDestination() { + return $this->destination; + } + + /** + * Renders a template. + * + * @param string $template + * Twig template. + * @param array $vars + * Template variables. + * + * @return string + * A string representing the rendered output. + */ + protected function render($template, array $vars) { + return $this->getHelper('dcg_renderer')->render($template, $vars); + } + + /** + * Asks the user for template variables. + * + * @param \Symfony\Component\Console\Input\InputInterface $input + * Input instance. + * @param \Symfony\Component\Console\Output\OutputInterface $output + * Output instance. + * @param array $questions + * List of questions that the user should answer. + * @param array $vars + * Array of predefined template variables. + * + * @return array + * Template variables. + * + * @see \DrupalCodeGenerator\InputHandler::collectVars() + */ + protected function &collectVars(InputInterface $input, OutputInterface $output, array $questions, array $vars = []) { + $this->vars += $this->getHelper('dcg_input_handler')->collectVars($input, $output, $questions, $vars); + return $this->vars; + } + + /** + * Asks the user a single question and returns the answer. + * + * @param \Symfony\Component\Console\Input\InputInterface $input + * Input instance. + * @param \Symfony\Component\Console\Output\OutputInterface $output + * Output instance. + * @param \Symfony\Component\Console\Question\Question $question + * A question to ask. + * @param array $vars + * Array of predefined template variables. + * + * @return string + * The answer. + * + * @see \DrupalCodeGenerator\InputHandler::collectVars() + */ + protected function ask(InputInterface $input, OutputInterface $output, Question $question, array $vars = []) { + $key = mt_rand(); + $answers = $this->getHelper('dcg_input_handler')->collectVars($input, $output, [$key => $question], $vars); + return $answers[$key]; + } + + /** + * Creates an asset. + * + * @param string $type + * Asset type. + * + * @return \DrupalCodeGenerator\Asset + * The asset. + */ + protected function addAsset($type) { + $asset = (new Asset())->type($type); + $this->assets[] = $asset; + return $asset; + } + + /** + * Creates file asset. + * + * @param string $path + * (Optional) File path. + * + * @return \DrupalCodeGenerator\Asset + * The asset. + */ + protected function addFile($path = NULL) { + return $this->addAsset('file')->path($path); + } + + /** + * Creates directory asset. + * + * @param string $path + * (Optional) Directory path. + * + * @return \DrupalCodeGenerator\Asset + * The asset. + */ + protected function addDirectory($path = NULL) { + return $this->addAsset('directory')->path($path); + } + + /** + * Creates service file asset. + * + * @param string $path + * (Optional) File path. + * + * @return \DrupalCodeGenerator\Asset + * The asset. + */ + protected function addServicesFile($path = NULL) { + return $this->addFile() + ->path($path ?: '{machine_name}.services.yml') + ->action('append') + ->headerSize(1); + } + + /** + * Creates file asset. + * + * @param string $path + * Path to the file. + * @param string $template + * Twig template to render. + * @param array $vars + * Twig variables. + * + * @deprecated Use self::addFile() or self::addDirectory(). + */ + protected function setFile($path = NULL, $template = NULL, array $vars = []) { + $this->addFile() + ->path($path) + ->template($template) + ->vars($vars); + } + + /** + * Creates service file asset. + * + * @param string $path + * Path to the file. + * @param string $template + * Twig template to render. + * @param array $vars + * Twig variables. + * + * @deprecated Use self::addServiceFile(). + */ + protected function setServicesFile($path, $template, array $vars) { + $this->addServicesFile() + ->path($path) + ->template($template) + ->vars($vars); + } + + /** + * Collects services. + * + * @param \Symfony\Component\Console\Input\InputInterface $input + * Input instance. + * @param \Symfony\Component\Console\Output\OutputInterface $output + * Output instance. + * + * @return array + * List of collected services. + */ + protected function collectServices(InputInterface $input, OutputInterface $output) { + + $service_definitions = self::getServiceDefinitions(); + $service_ids = array_keys($service_definitions); + + $services = []; + while (TRUE) { + $question = new Question('Type the service name or use arrows up/down. Press enter to continue'); + $question->setValidator([Utils::class, 'validateServiceName']); + $question->setAutocompleterValues($service_ids); + $service = $this->ask($input, $output, $question); + if (!$service) { + break; + } + $services[] = $service; + } + + $this->vars['services'] = []; + foreach (array_unique($services) as $service_id) { + if (isset($service_definitions[$service_id])) { + $definition = $service_definitions[$service_id]; + } + else { + // Build the definition if the service is unknown. + $definition = [ + 'type' => 'Drupal\example\ExampleInterface', + 'name' => str_replace('.', '_', $service_id), + 'description' => "The $service_id service.", + ]; + } + $type_parts = explode('\\', $definition['type']); + $definition['short_type'] = end($type_parts); + $this->vars['services'][$service_id] = $definition; + } + return $this->vars['services']; + } + + /** + * Gets service definitions. + * + * @return array + * List of service definitions keyed by service ID. + */ + protected static function getServiceDefinitions() { + $data_encoded = file_get_contents(ApplicationFactory::getRoot() . '/resources/service-definitions.json'); + return json_decode($data_encoded, TRUE); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_7/CToolsPlugin/Access.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_7/CToolsPlugin/Access.php new file mode 100644 index 00000000..7ab809b3 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_7/CToolsPlugin/Access.php @@ -0,0 +1,15 @@ +setValidator([Utils::class, 'validateRequired']); + + $default_machine_name = function ($vars) { + return Utils::human2machine($vars['plugin_name']); + }; + $questions['plugin_machine_name'] = new Question('Plugin machine name', $default_machine_name); + $questions['plugin_machine_name']->setValidator([Utils::class, 'validateMachineName']); + + $questions['description'] = new Question('Plugin description', 'Plugin description.'); + $questions['category'] = new Question('Category', 'Custom'); + + $questions['context'] = new ChoiceQuestion( + 'Required context', + ['-', 'Node', 'User', 'Term'] + ); + + $this->collectVars($input, $output, $questions); + + $this->addFile() + ->path($this->subDirectory . '/{plugin_machine_name}.inc') + ->template($this->template); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_7/CToolsPlugin/ContentType.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_7/CToolsPlugin/ContentType.php new file mode 100644 index 00000000..65e31bce --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_7/CToolsPlugin/ContentType.php @@ -0,0 +1,15 @@ +setValidator(function ($value) { + if (!in_array($value, $this->getSupportedHooks())) { + throw new \UnexpectedValueException('The value is not correct hook name.'); + } + return $value; + }); + $questions['hook_name']->setAutocompleterValues($this->getSupportedHooks()); + + $vars = $this->collectVars($input, $output, $questions); + + // Most Drupal hooks are situated in a module file but some are not. + $special_hooks = [ + 'install' => [ + 'install', + 'uninstall', + 'enable', + 'disable', + 'schema', + 'schema_alter', + 'field_schema', + 'requirements', + 'update_N', + 'update_last_removed', + ], + // See system_hook_info(). + 'tokens.inc' => [ + 'token_info', + 'token_info_alter', + 'tokens', + 'tokens_alter', + ], + ]; + + $file_type = 'module'; + foreach ($special_hooks as $group => $hooks) { + if (in_array($vars['hook_name'], $hooks)) { + $file_type = $group; + break; + } + } + + $this->addFile() + ->path("{machine_name}.$file_type") + ->headerTemplate("d7/file-docs/$file_type.twig") + ->template('d7/hook/' . $vars['hook_name'] . '.twig') + ->action('append') + ->headerSize(7); + } + + /** + * Gets list of supported hooks. + * + * @return array + * List of supported hooks. + */ + protected function getSupportedHooks() { + return array_map(function ($file) { + return pathinfo($file, PATHINFO_FILENAME); + }, array_diff(scandir($this->templatePath . '/d7/hook'), ['.', '..'])); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_7/InstallFile.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_7/InstallFile.php new file mode 100644 index 00000000..74e85da6 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_7/InstallFile.php @@ -0,0 +1,28 @@ +collectVars($input, $output, Utils::defaultQuestions()); + $this->addFile() + ->path('{machine_name}.install') + ->template('d7/install.twig'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_7/Javascript.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_7/Javascript.php new file mode 100644 index 00000000..b79c395c --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_7/Javascript.php @@ -0,0 +1,28 @@ +collectVars($input, $output, Utils::defaultQuestions()); + $this->addFile() + ->path(str_replace('_', '-', $vars['machine_name']) . '.js') + ->template('d7/javascript.twig'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_7/Module.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_7/Module.php new file mode 100644 index 00000000..a333616e --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_7/Module.php @@ -0,0 +1,55 @@ +collectVars($input, $output, $questions); + + $this->addFile() + ->path('{machine_name}/{machine_name}.info') + ->template('d7/module-info.twig'); + + $this->addFile() + ->path('{machine_name}/{machine_name}.module') + ->template('d7/module.twig'); + + $this->addFile() + ->path('{machine_name}/{machine_name}.install') + ->template('d7/install.twig'); + + $this->addFile() + ->path('{machine_name}/{machine_name}.admin.inc') + ->template('d7/admin.inc.twig'); + + $this->addFile() + ->path('{machine_name}/{machine_name}.pages.inc') + ->template('d7/pages.inc.twig'); + + $this->addFile() + ->path('{machine_name}/' . str_replace('_', '-', $vars['machine_name']) . '.js') + ->template('d7/javascript.twig'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_7/ModuleFile.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_7/ModuleFile.php new file mode 100644 index 00000000..0cc24d56 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_7/ModuleFile.php @@ -0,0 +1,28 @@ +collectVars($input, $output, Utils::defaultQuestions()); + $this->addFile() + ->path('{machine_name}.module') + ->template('d7/module.twig'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_7/ModuleInfo.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_7/ModuleInfo.php new file mode 100644 index 00000000..f792c836 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_7/ModuleInfo.php @@ -0,0 +1,33 @@ +collectVars($input, $output, $questions); + $this->addFile() + ->path('{machine_name}.info') + ->template('d7/module-info.twig'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_7/Settings.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_7/Settings.php new file mode 100644 index 00000000..f88eef36 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_7/Settings.php @@ -0,0 +1,39 @@ +setAutocompleterValues(['mysql', 'pgsql', 'sqlite']); + $questions['db_name'] = new Question('Database name', 'drupal'); + $questions['db_user'] = new Question('Database user', 'root'); + $questions['db_password'] = new Question('Database password', '123'); + + $vars = &$this->collectVars($input, $output, $questions); + // @see: drupal_get_hash_salt() + $vars['hash_salt'] = hash('sha256', serialize($vars)); + + $this->addFile() + ->path('settings.php') + ->template('d7/settings.twig'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_7/TemplatePhp.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_7/TemplatePhp.php new file mode 100644 index 00000000..653fd3fd --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_7/TemplatePhp.php @@ -0,0 +1,37 @@ +setValidator([Utils::class, 'validateRequired']); + $questions['machine_name'] = new Question('Theme machine name'); + $questions['machine_name']->setValidator([Utils::class, 'validateMachineName']); + + $this->collectVars($input, $output, $questions); + + $this->addFile() + ->path('template.php') + ->template('d7/template.php.twig'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_7/Test.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_7/Test.php new file mode 100644 index 00000000..c32fef73 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_7/Test.php @@ -0,0 +1,36 @@ +collectVars($input, $output, $questions); + + $this->addFile() + ->path('{machine_name}.test') + ->template('d7/test.twig'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_7/Theme.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_7/Theme.php new file mode 100644 index 00000000..2da09016 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_7/Theme.php @@ -0,0 +1,57 @@ +setValidator([Utils::class, 'validateRequired']); + $questions['machine_name'] = new Question('Theme machine name'); + $questions['machine_name']->setValidator([Utils::class, 'validateMachineName']); + $questions['description'] = new Question('Theme description', 'A simple Drupal 7 theme.'); + $questions['base_theme'] = new Question('Base theme'); + + $vars = &$this->collectVars($input, $output, $questions); + $vars['asset_name'] = str_replace('_', '-', $vars['machine_name']); + + $this->addFile() + ->path('{machine_name}/{machine_name}.info') + ->template('d7/theme-info.twig'); + + $this->addFile() + ->path('{machine_name}/template.php') + ->template('d7/template.php.twig'); + + $this->addFile() + ->path('{machine_name}/js/{asset_name}.js') + ->template('d7/javascript.twig'); + + $this->addFile() + ->path('{machine_name}/css/{asset_name}.css') + ->template('d7/theme-css.twig'); + + $this->addDirectory() + ->path('{machine_name}/templates'); + + $this->addDirectory() + ->path('{machine_name}/images'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_7/ThemeInfo.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_7/ThemeInfo.php new file mode 100644 index 00000000..164530d0 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_7/ThemeInfo.php @@ -0,0 +1,38 @@ +setValidator([Utils::class, 'validateRequired']); + $questions['machine_name'] = new Question('Theme machine name'); + $questions['machine_name']->setValidator([Utils::class, 'validateMachineName']); + $questions['description'] = new Question('Theme description', 'A simple Drupal 7 theme.'); + $questions['base_theme'] = new Question('Base theme'); + + $this->collectVars($input, $output, $questions); + + $this->addFile() + ->path('{machine_name}.info') + ->template('d7/theme-info.twig'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_7/ViewsPlugin/ArgumentDefault.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_7/ViewsPlugin/ArgumentDefault.php new file mode 100644 index 00000000..00048f62 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_7/ViewsPlugin/ArgumentDefault.php @@ -0,0 +1,49 @@ +collectVars($input, $output, $questions); + + $this->addFile() + ->path('{machine_name}.module') + ->template('d7/views-plugin/argument-default.module.twig') + ->action('append') + ->headerSize(7); + + $this->addFile() + ->path('views/{machine_name}.views.inc') + ->template('d7/views-plugin/argument-default-views.inc.twig') + ->action('append') + ->headerSize(7); + + $this->addFile() + ->path('views/views_plugin_argument_{plugin_machine_name}.inc') + ->template('d7/views-plugin/argument-default.twig'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Composer.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Composer.php new file mode 100644 index 00000000..128aedd5 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Composer.php @@ -0,0 +1,47 @@ +setValidator([Utils::class, 'validateMachineName']); + $questions['description'] = new Question('Description'); + $questions['type'] = new Question('Type', 'drupal-module'); + $questions['type']->setValidator([Utils::class, 'validateRequired']); + $questions['type']->setAutocompleterValues([ + 'drupal-module', + 'drupal-theme', + 'drupal-library', + 'drupal-profile', + 'drupal-drush', + ]); + $questions['drupal_org'] = new ConfirmationQuestion('Is this project hosted on drupal.org?', FALSE); + + $this->collectVars($input, $output, $questions); + + $this->addFile() + ->path('composer.json') + ->template('d8/composer.twig'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Controller.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Controller.php new file mode 100644 index 00000000..cd326161 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Controller.php @@ -0,0 +1,58 @@ +collectVars($input, $output, $questions); + + $di_question = new ConfirmationQuestion('Would you like to inject dependencies?', FALSE); + if ($this->ask($input, $output, $di_question)) { + $this->collectServices($input, $output); + } + + $route_question = new ConfirmationQuestion('Would you like to create a route for this controller?'); + if ($this->ask($input, $output, $route_question)) { + $route_path = '/' . str_replace('_', '-', $vars['machine_name']) . '/example'; + $route_questions['route_name'] = new Question('Route name', '{machine_name}.example'); + $route_questions['route_path'] = new Question('Route path', $route_path); + $route_questions['route_title'] = new Question('Route title', 'Example'); + $route_questions['route_permission'] = new Question('Route permission', 'access content'); + $this->collectVars($input, $output, $route_questions, $vars); + $this->addFile() + ->path('{machine_name}.routing.yml') + ->template('d8/controller-route.twig') + ->action('append'); + } + + $this->addFile() + ->path('src/Controller/{class}.php') + ->template('d8/controller.twig'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Field.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Field.php new file mode 100644 index 00000000..2c732a96 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Field.php @@ -0,0 +1,320 @@ + [ + 'label' => 'Boolean', + 'list' => FALSE, + 'random' => FALSE, + 'inline' => FALSE, + 'link' => FALSE, + 'data_type' => 'boolean', + ], + 'string' => [ + 'label' => 'Text', + 'list' => TRUE, + 'random' => TRUE, + 'inline' => TRUE, + 'link' => FALSE, + 'data_type' => 'string', + ], + 'text' => [ + 'label' => 'Text (long)', + 'list' => FALSE, + 'random' => TRUE, + 'inline' => FALSE, + 'link' => FALSE, + 'data_type' => 'string', + ], + 'integer' => [ + 'label' => 'Integer', + 'list' => TRUE, + 'random' => FALSE, + 'inline' => TRUE, + 'link' => FALSE, + 'data_type' => 'integer', + ], + 'float' => [ + 'label' => 'Float', + 'list' => TRUE, + 'random' => FALSE, + 'inline' => TRUE, + 'link' => FALSE, + 'data_type' => 'float', + ], + 'numeric' => [ + 'label' => 'Numeric', + 'list' => TRUE, + 'random' => FALSE, + 'inline' => TRUE, + 'link' => FALSE, + 'data_type' => 'float', + ], + 'email' => [ + 'label' => 'Email', + 'list' => TRUE, + 'random' => TRUE, + 'inline' => TRUE, + 'link' => TRUE, + 'data_type' => 'email', + ], + 'telephone' => [ + 'label' => 'Telephone', + 'list' => TRUE, + 'random' => FALSE, + 'inline' => TRUE, + 'link' => TRUE, + 'data_type' => 'string', + ], + 'uri' => [ + 'label' => 'Url', + 'list' => TRUE, + 'random' => TRUE, + 'inline' => TRUE, + 'link' => TRUE, + 'data_type' => 'uri', + ], + 'datetime' => [ + 'label' => 'Date', + 'list' => TRUE, + 'random' => FALSE, + 'inline' => FALSE, + 'link' => FALSE, + 'data_type' => 'datetime_iso8601', + ], + ]; + + /** + * Date types. + * + * @var array + */ + protected $dateTypes = [ + 'date' => 'Date only', + 'datetime' => 'Date and time', + ]; + + /** + * {@inheritdoc} + */ + protected function interact(InputInterface $input, OutputInterface $output) { + + $questions = Utils::defaultQuestions(); + + $questions['field_label'] = new Question('Field label', 'Example'); + $questions['field_label']->setValidator([Utils::class, 'validateRequired']); + + $default_field_id = function (array $vars) { + return $vars['machine_name'] . '_' . Utils::human2machine($vars['field_label']); + }; + $questions['field_id'] = new Question('Field ID', $default_field_id); + $questions['field_id']->setValidator([Utils::class, 'validateMachineName']); + + $questions['subfield_count'] = new Question('How many sub-fields would you like to create?', 3); + + $subfield_count_validator = function ($value) { + if (!is_numeric($value) || intval($value) != $value || $value <= 0) { + throw new \UnexpectedValueException('The value should be greater than zero.'); + } + return $value; + }; + $questions['subfield_count']->setValidator($subfield_count_validator); + + $vars = &$this->collectVars($input, $output, $questions); + + $type_choices = array_column($this->subTypes, 'label'); + $type_choices = Utils::prepareChoices($type_choices); + + // Indicates that at least one of sub-fields needs Random component. + $vars['random'] = FALSE; + + // Indicates that all sub-fields can be rendered inline. + $vars['inline'] = TRUE; + + // Indicates that at least one of sub-files has limited allowed values. + $vars['list'] = FALSE; + + // Indicates that at least one of sub-fields is required. + $vars['required'] = FALSE; + + // Indicates that at least one of sub-fields is of email type. + $vars['email'] = FALSE; + + // Indicates that at least one of sub-fields can be rendered as a link. + $vars['link'] = FALSE; + + // Indicates that at least one of sub-fields is of datetime type. + $vars['datetime'] = FALSE; + + for ($i = 1; $i <= $vars['subfield_count']; $i++) { + if (!$input->getOption('answers')) { + $output->writeln('–––––––––––––––––––––––––––––––––––––––––––––––––––'); + } + $subfield_questions = []; + $subfield_questions['name_' . $i] = new Question("Label for sub-field #$i", "Value $i"); + $default_machine_name = function (array $vars) use ($i) { + return Utils::human2machine($vars['name_' . $i]); + }; + $subfield_questions['machine_name_' . $i] = new Question("Machine name for sub-field #$i", $default_machine_name); + $subfield_questions['type_' . $i] = new ChoiceQuestion("Type of sub-field #$i", $type_choices, 'Text'); + $this->collectVars($input, $output, $subfield_questions); + + $vars['type_class'] = Utils::camelize($vars['field_label']) . 'Item'; + $vars['widget_class'] = Utils::camelize($vars['field_label']) . 'Widget'; + $vars['formatter_class'] = Utils::camelize($vars['field_label']) . 'DefaultFormatter'; + + // Reset previous questions since we already collected their answers. + $subfield_questions = []; + + // Determine the type ID by its label. + foreach ($this->subTypes as $type => $definition) { + if ($vars['type_' . $i] == $definition['label']) { + break; + } + } + + if ($type == 'datetime') { + $subfield_questions['date_type_' . $i] = new ChoiceQuestion( + "Date type for sub-field #$i", + Utils::prepareChoices($this->dateTypes), + 'Date only' + ); + } + + if ($definition['list']) { + $subfield_questions['list_' . $i] = new ConfirmationQuestion("Limit allowed values for sub-field #$i?", FALSE); + } + $subfield_questions['required_' . $i] = new ConfirmationQuestion("Make sub-field #$i required?", FALSE); + $this->collectVars($input, $output, $subfield_questions); + + $machine_name = $vars['machine_name_' . $i]; + + // Group sub-field vars. + $vars['subfields'][$i] = [ + 'name' => $vars['name_' . $i], + 'machine_name' => $machine_name, + 'type' => $type, + 'data_type' => $definition['data_type'], + 'list' => !empty($vars['list_' . $i]), + 'allowed_values_method' => 'allowed' . Utils::camelize($vars['name_' . $i], TRUE) . 'Values', + 'required' => $vars['required_' . $i], + 'link' => $definition['link'], + ]; + if (isset($vars['date_type_' . $i])) { + $date_type = array_search($vars['date_type_' . $i], $this->dateTypes); + $vars['subfields'][$i]['date_type'] = $date_type; + // Back to date type ID. + $vars['subfields'][$i]['date_storage_format'] = $date_type == 'date' ? 'Y-m-d' : 'Y-m-d\TH:i:s'; + } + unset($vars['name_' . $i], $vars['machine_name_' . $i], $vars['type_' . $i], $vars['list_' . $i], $vars['required_' . $i], $vars['date_type_' . $i]); + + if ($definition['random']) { + $vars['random'] = TRUE; + } + + if (!$definition['inline']) { + $vars['inline'] = FALSE; + } + + if ($vars['subfields'][$i]['list']) { + $vars['list'] = TRUE; + } + + if ($vars['subfields'][$i]['required']) { + $vars['required'] = TRUE; + } + + if ($type == 'email') { + $vars['email'] = TRUE; + } + + if ($definition['link']) { + $vars['link'] = TRUE; + } + + if ($type == 'datetime') { + $vars['datetime'] = TRUE; + } + + } + + if (!$input->getOption('answers')) { + $output->writeln('–––––––––––––––––––––––––––––––––––––––––––––––––––'); + } + + $questions = []; + $questions['storage_settings'] = new ConfirmationQuestion('Would you like to create field storage settings form?', FALSE); + $questions['instance_settings'] = new ConfirmationQuestion('Would you like to create field instance settings form?', FALSE); + $questions['widget_settings'] = new ConfirmationQuestion('Would you like to create field widget settings form?', FALSE); + $questions['formatter_settings'] = new ConfirmationQuestion('Would you like to create field formatter settings form?', FALSE); + $questions['table_formatter'] = new ConfirmationQuestion('Would you like to create table formatter?', FALSE); + $questions['key_value_formatter'] = new ConfirmationQuestion('Would you like to create key-value formatter?', FALSE); + + $vars += $this->collectVars($input, $output, $questions); + + $this->addFile() + ->path('src/Plugin/Field/FieldType/{type_class}.php') + ->template('d8/_field/type.twig'); + + $this->addFile() + ->path('src/Plugin/Field/FieldWidget/{widget_class}.php') + ->template('d8/_field/widget.twig'); + + $this->addFile() + ->path('src/Plugin/Field/FieldFormatter/{formatter_class}.php') + ->template('d8/_field/default-formatter.twig'); + + $this->addFile() + ->path('config/schema/{machine_name}.schema.yml') + ->template('d8/_field/schema.twig') + ->action('append'); + + $this->addFile() + ->path('{machine_name}.libraries.yml') + ->template('d8/_field/libraries.twig') + ->action('append'); + + $this->addFile() + ->path('css/' . str_replace('_', '-', $vars['field_id']) . '-widget.css') + ->template('d8/_field/widget-css.twig'); + + if ($vars['table_formatter']) { + $vars['table_formatter_class'] = Utils::camelize($vars['field_label']) . 'TableFormatter'; + $this->addFile() + ->path('src/Plugin/Field/FieldFormatter/{table_formatter_class}.php') + ->template('d8/_field/table-formatter.twig'); + } + + if ($vars['key_value_formatter']) { + $vars['key_value_formatter_class'] = Utils::camelize($vars['field_label']) . 'KeyValueFormatter'; + $this->addFile() + ->path('src/Plugin/Field/FieldFormatter/{key_value_formatter_class}.php') + ->template('d8/_field/key-value-formatter.twig'); + } + + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Form/Config.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Form/Config.php new file mode 100644 index 00000000..266f1f77 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Form/Config.php @@ -0,0 +1,65 @@ +collectVars($input, $output, $questions); + + $this->defaultPathPrefix = '/admin/config/system'; + $this->defaultPermission = 'administer site configuration'; + $this->routeInteraction($input, $output); + + $vars = &$this->vars; + + if ($vars['route']) { + $link_question = new ConfirmationQuestion('Would you like to create a menu link for this route?', TRUE); + $vars['link'] = $this->ask($input, $output, $link_question); + if ($vars['link']) { + + $link_questions['link_title'] = new Question('Link title', $vars['route_title']); + $link_questions['link_description'] = new Question('Link description'); + // Try to guess parent menu item using route path. + if (preg_match('#^/admin/config/([^/]+)/[^/]+$#', $vars['route_path'], $matches)) { + $link_questions['link_parent'] = new Question('Parent menu item', 'system.admin_config_' . $matches[1]); + } + + $this->collectVars($input, $output, $link_questions); + $this->addFile() + ->path('{machine_name}.links.menu.yml') + ->template('d8/form/links.menu.twig') + ->action('append'); + } + } + + $this->addFile() + ->path('src/Form/{class}.php') + ->template('d8/form/config.twig'); + + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Form/Confirm.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Form/Confirm.php new file mode 100644 index 00000000..03d59da0 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Form/Confirm.php @@ -0,0 +1,39 @@ +collectVars($input, $output, $questions); + + $this->defaultPermission = 'administer site configuration'; + $this->routeInteraction($input, $output); + + $this->addFile() + ->path('src/Form/{class}.php') + ->template('d8/form/confirm.twig'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Form/RouteInteractionTrait.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Form/RouteInteractionTrait.php new file mode 100644 index 00000000..0b15164d --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Form/RouteInteractionTrait.php @@ -0,0 +1,61 @@ +vars; + + $route_question = new ConfirmationQuestion('Would you like to create a route for this form?'); + $vars['route'] = $this->ask($input, $output, $route_question); + + $raw_form_id = preg_replace('/_form/', '', Utils::camel2machine($vars['class'])); + $vars['form_id'] = $vars['machine_name'] . '_' . $raw_form_id; + + if ($vars['route']) { + $this->defaultPathPrefix = $this->defaultPathPrefix ?: '/' . $vars['machine_name']; + $default_route_path = str_replace('_', '-', $this->defaultPathPrefix . '/' . $raw_form_id); + $route_questions['route_name'] = new Question('Route name', '{machine_name}.' . $raw_form_id); + $route_questions['route_path'] = new Question('Route path', $default_route_path); + $route_questions['route_title'] = new Question('Route title', Utils::machine2human($raw_form_id)); + $route_questions['route_permission'] = new Question('Route permission', $this->defaultPermission); + + $this->collectVars($input, $output, $route_questions, $vars); + + $this->addFile() + ->path('{machine_name}.routing.yml') + ->template('d8/form/routing.twig') + ->action('append'); + } + + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Form/Simple.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Form/Simple.php new file mode 100644 index 00000000..c01f140a --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Form/Simple.php @@ -0,0 +1,39 @@ +collectVars($input, $output, $questions); + + $this->defaultPermission = 'access content'; + $this->routeInteraction($input, $output); + + $this->addFile() + ->path('src/Form/{class}.php') + ->template('d8/form/simple.twig'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Hook.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Hook.php new file mode 100644 index 00000000..0d5bbd77 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Hook.php @@ -0,0 +1,124 @@ +setValidator(function ($value) { + if (!in_array($value, $this->supportedHooks())) { + throw new \UnexpectedValueException('The value is not correct hook name.'); + } + return $value; + }); + $questions['hook_name']->setAutocompleterValues($this->supportedHooks()); + + $vars = $this->collectVars($input, $output, $questions); + + // Most Drupal hooks are situated in a module file but some are not. + $special_hooks = [ + 'install' => [ + 'install', + 'uninstall', + 'schema', + 'requirements', + 'update_N', + 'update_last_removed', + ], + // See views_hook_info(). + 'views.inc' => [ + 'views_data', + 'views_data_alter', + 'views_analyze', + 'views_invalidate_cache', + 'field_views_data', + 'field_views_data_alter', + // See \Drupal\views\views::$plugins. + 'views_plugins_access_alter', + 'views_plugins_area_alter', + 'views_plugins_argument_alter', + 'views_plugins_argument_default_alter', + 'views_plugins_argument_validator_alter', + 'views_plugins_cache_alter', + 'views_plugins_display_extender_alter', + 'views_plugins_display_alter', + 'views_plugins_exposed_form_alter', + 'views_plugins_field_alter', + 'views_plugins_filter_alter', + 'views_plugins_join_alter', + 'views_plugins_pager_alter', + 'views_plugins_query_alter', + 'views_plugins_relationship_alter', + 'views_plugins_row_alter', + 'views_plugins_sort_alter', + 'views_plugins_style_alter', + 'views_plugins_wizard_alter', + ], + 'views_execution.inc' => [ + 'views_query_substitutions', + 'views_form_substitutions', + 'views_pre_view', + 'views_pre_build', + 'views_post_build', + 'views_pre_execute', + 'views_post_execute', + 'views_pre_render', + 'views_post_render', + 'views_query_alter', + ], + // See system_hook_info(). + 'tokens.inc' => [ + 'token_info', + 'token_info_alter', + 'tokens', + 'tokens_alter', + ], + 'post_update.php' => [ + 'post_update_N', + ], + ]; + + $file_type = 'module'; + foreach ($special_hooks as $group => $hooks) { + if (in_array($vars['hook_name'], $hooks)) { + $file_type = $group; + break; + } + } + + $this->addFile() + ->path('{machine_name}.' . $file_type) + ->headerTemplate("d8/file-docs/$file_type.twig") + ->template('d8/hook/' . $vars['hook_name'] . '.twig') + ->action('append') + ->headerSize(7); + } + + /** + * Returns list of supported hooks. + */ + protected function supportedHooks() { + return array_map(function ($file) { + return pathinfo($file, PATHINFO_FILENAME); + }, array_diff(scandir($this->templatePath . '/d8/hook'), ['.', '..'])); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/InstallFile.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/InstallFile.php new file mode 100644 index 00000000..273cfd90 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/InstallFile.php @@ -0,0 +1,29 @@ +collectVars($input, $output, Utils::defaultQuestions()); + $this->addFile() + ->path('{machine_name}.install') + ->template('d8/install.twig'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Javascript.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Javascript.php new file mode 100644 index 00000000..f19317c3 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Javascript.php @@ -0,0 +1,29 @@ +collectVars($input, $output, Utils::defaultQuestions()); + $this->addFile() + ->path('js/' . str_replace('_', '-', $vars['machine_name']) . '.js') + ->template('d8/javascript.twig'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Layout.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Layout.php new file mode 100644 index 00000000..6b2744ba --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Layout.php @@ -0,0 +1,70 @@ +setValidator([Utils::class, 'validateMachineName']); + + $questions['layout_name'] = new Question('Layout name', 'Example'); + $questions['layout_machine_name'] = new Question('Layout machine name', function ($vars) { + return Utils::human2machine($vars['layout_name']); + }); + $questions['category'] = new Question('Category', 'My layouts'); + + $questions['js'] = new ConfirmationQuestion('Would you like to create JavaScript file for this layout?', FALSE); + $questions['css'] = new ConfirmationQuestion('Would you like to create CSS file for this layout?', FALSE); + + $vars = &$this->collectVars($input, $output, $questions); + $this->addFile() + ->path('{machine_name}.layouts.yml') + ->template('d8/_layout/layouts.twig') + ->action('append'); + + if ($vars['js'] || $vars['css']) { + $this->addFile() + ->path('{machine_name}.libraries.yml') + ->template('d8/_layout/libraries.twig') + ->action('append'); + } + + $vars['layout_asset_name'] = str_replace('_', '-', $vars['layout_machine_name']); + + $this->addFile() + ->path('layouts/{layout_machine_name}/{layout_asset_name}.html.twig') + ->template('d8/_layout/template.twig'); + + if ($vars['js']) { + $this->addFile() + ->path('layouts/{layout_machine_name}/{layout_asset_name}.js') + ->template('d8/_layout/javascript.twig'); + } + if ($vars['css']) { + $this->addFile() + ->path('layouts/{layout_machine_name}/{layout_asset_name}.css') + ->template('d8/_layout/styles.twig'); + } + + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Module/ConfigurationEntity.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Module/ConfigurationEntity.php new file mode 100644 index 00000000..d8c967fd --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Module/ConfigurationEntity.php @@ -0,0 +1,65 @@ +collectVars($input, $output, $questions); + if ($vars['dependencies']) { + $vars['dependencies'] = array_map('trim', explode(',', strtolower($vars['dependencies']))); + } + $vars['class_prefix'] = Utils::camelize($vars['entity_type_id']); + + $templates = [ + 'model.info.yml.twig', + 'src/ExampleListBuilder.php.twig', + 'src/Form/ExampleForm.php.twig', + 'src/ExampleInterface.php.twig', + 'src/Entity/Example.php.twig', + 'model.routing.yml.twig', + 'model.links.action.yml.twig', + 'model.links.menu.yml.twig', + 'model.permissions.yml.twig', + 'config/schema/model.schema.yml.twig', + ]; + + $templates_path = 'd8/module/configuration-entity/'; + $path_placeholders = ['model', 'Example', '.twig']; + $path_replacements = [$vars['machine_name'], $vars['class_prefix'], '']; + foreach ($templates as $template) { + $this->addFile() + ->path('{machine_name}/' . str_replace($path_placeholders, $path_replacements, $template)) + ->template($templates_path . $template); + } + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Module/ContentEntity.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Module/ContentEntity.php new file mode 100644 index 00000000..162c6192 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Module/ContentEntity.php @@ -0,0 +1,151 @@ +collectVars($input, $output, $questions); + + if ($vars['dependencies']) { + $vars['dependencies'] = array_map('trim', explode(',', strtolower($vars['dependencies']))); + } + else { + $vars['dependencies'] = []; + } + // 'text_long' field item plugin is provided by Text module. + if ($vars['description_base_field']) { + $vars['dependencies'][] = 'drupal:text'; + } + + if ($vars['entity_base_path'][0] != '/') { + $vars['entity_base_path'] = '/' . $vars['entity_base_path']; + } + + if (($vars['fieldable_no_bundle'] = $vars['fieldable'] && !$vars['bundle'])) { + $vars['configure'] = 'entity.' . $vars['entity_type_id'] . '.settings'; + } + elseif ($vars['bundle']) { + $vars['configure'] = 'entity.' . $vars['entity_type_id'] . '_type.collection'; + } + + $vars['class_prefix'] = Utils::camelize($vars['entity_type_id']); + + $templates = [ + 'model.info.yml.twig', + 'model.links.action.yml.twig', + 'model.links.menu.yml.twig', + 'model.links.task.yml.twig', + 'model.permissions.yml.twig', + 'src/Entity/Example.php.twig', + 'src/ExampleInterface.php.twig', + 'src/ExampleListBuilder.php.twig', + 'src/Form/ExampleForm.php.twig', + ]; + + if ($vars['fieldable_no_bundle']) { + $templates[] = 'model.routing.yml.twig'; + $templates[] = 'src/Form/ExampleSettingsForm.php.twig'; + } + + if ($vars['template']) { + $templates[] = 'templates/model-example.html.twig.twig'; + $templates[] = 'model.module.twig'; + } + else { + $templates[] = 'src/ExampleViewBuilder.php.twig'; + } + + if ($vars['access_controller']) { + $templates[] = 'src/ExampleAccessControlHandler.php.twig'; + } + + if ($vars['rest_configuration']) { + $templates[] = 'config/optional/rest.resource.entity.example.yml.twig'; + } + + if ($vars['bundle']) { + $templates[] = 'config/schema/model.entity_type.schema.yml.twig'; + $templates[] = 'src/ExampleTypeListBuilder.php.twig'; + $templates[] = 'src/Entity/ExampleType.php.twig'; + $templates[] = 'src/Form/ExampleTypeForm.php.twig'; + } + + $templates_path = 'd8/module/content-entity/'; + + $vars['template_name'] = str_replace('_', '-', $vars['entity_type_id']) . '.html.twig'; + + $path_placeholders = [ + 'model-example.html.twig', + 'model', + 'Example', + 'rest.resource.entity.example', + ]; + $path_replacements = [ + $vars['template_name'], + $vars['machine_name'], + $vars['class_prefix'], + 'rest.resource.entity.' . $vars['entity_type_id'], + 'views.view.' . $vars['entity_type_id'], + ]; + + foreach ($templates as $template) { + $path = $vars['machine_name'] . '/' . str_replace($path_placeholders, $path_replacements, $template); + $this->addFile() + ->path(preg_replace('#\.twig$#', '', $path)) + ->template($templates_path . $template); + } + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Module/Standard.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Module/Standard.php new file mode 100644 index 00000000..b0f9d507 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Module/Standard.php @@ -0,0 +1,172 @@ +collectVars($input, $output, $questions); + + if ($vars['dependencies']) { + $vars['dependencies'] = array_map('trim', explode(',', strtolower($vars['dependencies']))); + } + + $prefix = $vars['machine_name'] . '/' . $vars['machine_name']; + + $this->addFile() + ->path($prefix . '.info.yml') + ->template('d8/yml/module-info.twig'); + + $this->addFile() + ->path($prefix . '.module') + ->template('d8/module.twig'); + + $class_prefix = Utils::camelize($vars['machine_name']); + + // Additional files. + $option_questions['install_file'] = new ConfirmationQuestion('Would you like to create install file?', TRUE); + $option_questions['libraries.yml'] = new ConfirmationQuestion('Would you like to create libraries.yml file?', TRUE); + $option_questions['permissions.yml'] = new ConfirmationQuestion('Would you like to create permissions.yml file?', TRUE); + $option_questions['event_subscriber'] = new ConfirmationQuestion('Would you like to create event subscriber?', TRUE); + $option_questions['block_plugin'] = new ConfirmationQuestion('Would you like to create block plugin?', TRUE); + $option_questions['controller'] = new ConfirmationQuestion('Would you like to create a controller?', TRUE); + $option_questions['settings_form'] = new ConfirmationQuestion('Would you like to create settings form?', TRUE); + + $options = $this->collectVars($input, $output, $option_questions); + + if ($options['install_file']) { + $this->addFile() + ->path($prefix . '.install') + ->template('d8/install.twig'); + } + + if ($options['libraries.yml']) { + $this->addFile() + ->path($prefix . '.libraries.yml') + ->template('d8/yml/module-libraries.twig'); + } + + if ($options['permissions.yml']) { + $this->addFile() + ->path($prefix . '.permissions.yml') + ->template('d8/yml/permissions.twig'); + } + + if ($options['event_subscriber']) { + $subscriber_class = $class_prefix . 'Subscriber'; + + $this->addFile() + ->path("{machine_name}/src/EventSubscriber/$subscriber_class.php") + ->template('d8/service/event-subscriber.twig') + ->vars($vars + ['class' => $subscriber_class]); + + $this->addFile() + ->path($prefix . '.services.yml') + ->template('d8/service/event-subscriber.services.twig') + ->vars($vars + ['class' => $subscriber_class]); + } + + if ($options['block_plugin']) { + $block_vars['plugin_label'] = 'Example'; + $block_vars['plugin_id'] = $vars['machine_name'] . '_' . Utils::human2machine($block_vars['plugin_label']); + $block_vars['category'] = $vars['name']; + $block_vars['class'] = 'ExampleBlock'; + + $this->addFile() + ->path('{machine_name}/src/Plugin/Block/' . $block_vars['class'] . '.php') + ->template('d8/plugin/block.twig') + ->vars($block_vars + $vars); + } + + if ($options['controller']) { + $controller_class = $class_prefix . 'Controller'; + + $controller_vars = [ + 'class' => $controller_class, + 'services' => [], + ]; + + $this->addFile() + ->path("{machine_name}/src/Controller/$controller_class.php") + ->template('d8/controller.twig') + ->vars($controller_vars + $vars); + + $routing_vars = [ + 'route_name' => $vars['machine_name'] . '.example', + 'route_path' => '/' . str_replace('_', '-', $vars['machine_name']) . '/example', + 'route_title' => 'Example', + 'route_permission' => 'access content', + 'class' => $controller_class, + ]; + + $this->addFile() + ->path($prefix . '.routing.yml') + ->template('d8/controller-route.twig') + ->vars($routing_vars + $vars) + ->action('append'); + } + + if ($options['settings_form']) { + $form_class = 'SettingsForm'; + + $form_vars = [ + 'form_id' => $vars['machine_name'] . '_settings', + 'class' => $form_class, + ]; + $this->addFile() + ->path('{machine_name}/src/Form/SettingsForm.php') + ->template('d8/form/config.twig') + ->vars($form_vars + $vars); + + $routing_vars = [ + 'route_name' => $vars['machine_name'] . '.settings_form', + 'route_path' => '/admin/config/system/' . str_replace('_', '-', $vars['machine_name']), + 'route_title' => $vars['name'] . ' settings', + 'route_permission' => 'administer ' . $vars['machine_name'] . ' configuration', + 'class' => $form_class, + ]; + $this->addFile() + ->path($prefix . '.routing.yml') + ->template('d8/form/routing.twig') + ->vars($routing_vars + $vars) + ->action('append'); + + $link_vars = [ + 'route_name' => $routing_vars['route_name'], + 'link_title' => $vars['name'], + 'link_description' => 'Configure ' . $vars['name'] . '.', + 'link_parent' => 'system.admin_config_system', + ]; + $this->addFile() + ->path($prefix . '.links.menu.yml') + ->template('d8/form/links.menu.twig') + ->vars($link_vars) + ->action('append'); + } + + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/ModuleFile.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/ModuleFile.php new file mode 100644 index 00000000..388f6cfe --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/ModuleFile.php @@ -0,0 +1,29 @@ +collectVars($input, $output, Utils::defaultQuestions()); + $this->addFile() + ->path('{machine_name}.module') + ->template('d8/module.twig'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/PhpStormMetadata.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/PhpStormMetadata.php new file mode 100644 index 00000000..f7b52125 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/PhpStormMetadata.php @@ -0,0 +1,72 @@ +vars; + + $service_definitions = $container + ->get('kernel') + ->getCachedContainerDefinition()['services']; + $service_definitions = array_map('unserialize', $service_definitions); + + foreach ($service_definitions as $service_id => $service_definition) { + if ($service_definition['class']) { + $vars['services'][$service_id] = $service_definition['class']; + } + } + + $entity_type_manager = $container->get('entity_type.manager'); + $vars['storages'] = []; + $vars['view_builders'] = []; + $vars['list_builders'] = []; + $vars['access_controls'] = []; + $vars['entity_classes'] = []; + foreach ($entity_type_manager->getDefinitions() as $type => $definition) { + /** @var \Drupal\Core\Entity\EntityTypeInterface $definition */ + $vars['entity_classes'][] = $definition->getClass(); + $vars['storages'][$type] = $definition->getStorageClass(); + $vars['access_controls'][$type] = $definition->getAccessControlClass(); + if ($definition->hasViewBuilderClass()) { + $vars['view_builders'][$type] = $definition->getViewBuilderClass(); + } + if ($definition->hasListBuilderClass()) { + $vars['list_builders'][$type] = $definition->getListBuilderClass(); + } + } + + // Some classes does not have leading slash. + array_walk_recursive($vars, function (string &$class): void { + if ($class[0] != '\\') { + $class = '\\' . $class; + } + }); + + $this->addFile() + ->path('.phpstorm.meta.php') + ->template('d8/phpstorm-meta.twig'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Plugin/Action.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Plugin/Action.php new file mode 100644 index 00000000..803cb5bd --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Plugin/Action.php @@ -0,0 +1,47 @@ +collectVars($input, $output, $questions); + + $this->addFile() + ->path('src/Plugin/Action/{class}.php') + ->template('d8/plugin/action.twig'); + + if ($vars['configurable']) { + $this->addFile() + ->path('config/schema/{machine_name}.schema.yml') + ->template('d8/plugin/action-schema.twig') + ->action('append'); + } + + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Plugin/Block.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Plugin/Block.php new file mode 100644 index 00000000..2ad341b0 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Plugin/Block.php @@ -0,0 +1,55 @@ +setValidator([Utils::class, 'validateRequired']); + $questions['category'] = new Question('Block category', 'Custom'); + $questions['configurable'] = new ConfirmationQuestion('Make the block configurable?', FALSE); + + $this->collectVars($input, $output, $questions); + + $di_question = new ConfirmationQuestion('Would you like to inject dependencies?', FALSE); + if ($this->ask($input, $output, $di_question)) { + $this->collectServices($input, $output); + } + + $access_question = new ConfirmationQuestion('Create access callback?', FALSE); + $vars = $this->collectVars($input, $output, ['access' => $access_question]); + + $this->addFile() + ->path('src/Plugin/Block/{class}.php') + ->template('d8/plugin/block.twig'); + + if ($vars['configurable']) { + $this->addFile() + ->path('config/schema/{machine_name}.schema.yml') + ->template('d8/plugin/block-schema.twig') + ->action('append'); + } + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Plugin/CKEditor.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Plugin/CKEditor.php new file mode 100644 index 00000000..51d5c0b9 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Plugin/CKEditor.php @@ -0,0 +1,52 @@ +collectVars($input, $output, $questions); + + $unprefixed_plugin_id = preg_replace('/^' . $vars['machine_name'] . '_/', '', $vars['plugin_id']); + + // Convert plugin ID to hyphen case. + $vars['short_plugin_id'] = str_replace('_', '-', $unprefixed_plugin_id); + $vars['command_name'] = Utils::camelize($unprefixed_plugin_id, FALSE); + + $this->addFile() + ->path('src/Plugin/CKEditorPlugin/{class}.php') + ->template('d8/plugin/_ckeditor/ckeditor.twig'); + + $this->addFile() + ->path('js/plugins/{short_plugin_id}/plugin.js') + ->template('d8/plugin/_ckeditor/plugin.twig'); + + $this->addFile() + ->path('js/plugins/{short_plugin_id}/dialogs/{short_plugin_id}.js') + ->template('d8/plugin/_ckeditor/dialog.twig'); + + $this->addFile() + ->path('js/plugins/{short_plugin_id}/icons/{short_plugin_id}.png') + ->content(file_get_contents($this->templatePath . '/d8/plugin/_ckeditor/icon.png')) + ->action('replace'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Plugin/Condition.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Plugin/Condition.php new file mode 100644 index 00000000..2a351442 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Plugin/Condition.php @@ -0,0 +1,37 @@ +collectVars($input, $output, $questions); + + $this->addFile() + ->path('src/Plugin/Condition/{class}.php') + ->template('d8/plugin/condition.twig'); + + $this->addFile() + ->path('config/schema/{machine_name}.schema.yml') + ->template('d8/plugin/condition-schema.twig') + ->action('append'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Plugin/Constraint.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Plugin/Constraint.php new file mode 100644 index 00000000..9728f601 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Plugin/Constraint.php @@ -0,0 +1,67 @@ +setValidator($plugin_id_validator); + + $default_class = function ($vars) { + $unprefixed_plugin_id = preg_replace('/^' . Utils::camelize($vars['machine_name']) . '/', '', $vars['plugin_id']); + return Utils::camelize($unprefixed_plugin_id) . 'Constraint'; + }; + $questions['class'] = new Question('Plugin class', $default_class); + + $input_types = [ + 'entity' => 'Entity', + 'item_list' => 'Item list', + 'item' => 'Item', + 'raw_value' => 'Raw value', + ]; + $type_choices = Utils::prepareChoices($input_types); + $questions['input_type'] = new ChoiceQuestion('Type of data to validate', $type_choices, 'Item list'); + + $vars = &$this->collectVars($input, $output, $questions); + $vars['input_type'] = array_search($vars['input_type'], $input_types); + + $this->addFile() + ->path('src/Plugin/Validation/Constraint/{class}.php') + ->template('d8/plugin/constraint.twig'); + + $this->addFile() + ->path('src/Plugin/Validation/Constraint/{class}Validator.php') + ->template('d8/plugin/constraint-validator.twig'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Plugin/EntityReferenceSelection.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Plugin/EntityReferenceSelection.php new file mode 100644 index 00000000..16011c03 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Plugin/EntityReferenceSelection.php @@ -0,0 +1,73 @@ + 'Drupal\comment\Plugin\EntityReferenceSelection\CommentSelection', + 'file' => 'Drupal\file\Plugin\EntityReferenceSelection\FileSelection', + 'node' => 'Drupal\node\Plugin\EntityReferenceSelection\NodeSelection', + 'taxonomy_term' => 'Drupal\taxonomy\Plugin\EntityReferenceSelection\TermSelection', + 'user' => 'Drupal\user\Plugin\EntityReferenceSelection\UserSelection', + ]; + + $questions = Utils::moduleQuestions(); + + $questions['entity_type'] = new Question('Entity type that can be referenced by this plugin', 'node'); + $questions['entity_type']->setValidator([Utils::class, 'validateMachineName']); + $questions['entity_type']->setAutocompleterValues(array_keys($base_classes)); + + $questions['plugin_label'] = new Question('Plugin label', 'Advanced {entity_type} selection'); + $questions['plugin_label']->setValidator([Utils::class, 'validateRequired']); + + $questions['plugin_id'] = new Question('Plugin ID', [Utils::class, 'defaultPluginId']); + $questions['plugin_id']->setValidator([Utils::class, 'validateMachineName']); + + $default_class = function ($vars) { + return Utils::camelize($vars['entity_type']) . 'Selection'; + }; + $questions['class'] = new Question('Plugin class', $default_class); + + $questions['configurable'] = new ConfirmationQuestion('Provide additional plugin configuration?', FALSE); + $vars = &$this->collectVars($input, $output, $questions); + + if (isset($base_classes[$vars['entity_type']])) { + $vars['base_class_full'] = $base_classes[$vars['entity_type']]; + } + else { + $vars['base_class_full'] = 'Drupal\Core\Entity\Plugin\EntityReferenceSelection\DefaultSelection'; + } + + $vars['base_class'] = explode('EntityReferenceSelection\\', $vars['base_class_full'])[1]; + + $this->addFile() + ->path('src/Plugin/EntityReferenceSelection/{class}.php') + ->template('d8/plugin/entity-reference-selection.twig'); + + $this->addFile() + ->path('config/schema/{machine_name}.schema.yml') + ->template('d8/plugin/entity-reference-selection-schema.twig') + ->action('append'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Plugin/Field/Formatter.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Plugin/Field/Formatter.php new file mode 100644 index 00000000..57c0e39d --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Plugin/Field/Formatter.php @@ -0,0 +1,43 @@ +collectVars($input, $output, $questions); + + $this->addFile() + ->path('src/Plugin/Field/FieldFormatter/{class}.php') + ->template('d8/plugin/field/formatter.twig'); + + if ($vars['configurable']) { + $this->addFile() + ->path('config/schema/{machine_name}.schema.yml') + ->template('d8/plugin/field/formatter-schema.twig') + ->action('append'); + } + + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Plugin/Field/Type.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Plugin/Field/Type.php new file mode 100644 index 00000000..17b25ade --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Plugin/Field/Type.php @@ -0,0 +1,42 @@ +collectVars($input, $output, $questions); + + $this->addFile() + ->path('src/Plugin/Field/FieldType/{class}.php') + ->template('d8/plugin/field/type.twig'); + + $this->addFile() + ->path('config/schema/{machine_name}.schema.yml') + ->template('d8/plugin/field/type-schema.twig') + ->action('append'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Plugin/Field/Widget.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Plugin/Field/Widget.php new file mode 100644 index 00000000..c4102474 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Plugin/Field/Widget.php @@ -0,0 +1,43 @@ +collectVars($input, $output, $questions); + + $this->addFile() + ->path('src/Plugin/Field/FieldWidget/{class}.php') + ->template('d8/plugin/field/widget.twig'); + + if ($vars['configurable']) { + $this->addFile() + ->path('config/schema/{machine_name}.schema.yml') + ->template('d8/plugin/field/widget-schema.twig') + ->action('append'); + } + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Plugin/Filter.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Plugin/Filter.php new file mode 100644 index 00000000..5365050d --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Plugin/Filter.php @@ -0,0 +1,48 @@ + 'HTML restrictor', + 'TYPE_MARKUP_LANGUAGE' => 'Markup language', + 'TYPE_TRANSFORM_IRREVERSIBLE' => 'Irreversible transformation', + 'TYPE_TRANSFORM_REVERSIBLE' => 'Reversible transformation', + ]; + $choices = Utils::prepareChoices($filter_types); + $questions['filter_type'] = new ChoiceQuestion('Filter type', $choices); + + $vars = &$this->collectVars($input, $output, $questions); + $vars['filter_type'] = array_search($vars['filter_type'], $filter_types); + + $this->addFile() + ->path('src/Plugin/Filter/{class}.php') + ->template('d8/plugin/filter.twig'); + + $this->addFile() + ->path('config/schema/{machine_name}.schema.yml') + ->template('d8/plugin/filter-schema.twig') + ->action('append'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Plugin/MenuLink.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Plugin/MenuLink.php new file mode 100644 index 00000000..42bb250e --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Plugin/MenuLink.php @@ -0,0 +1,38 @@ +collectVars($input, $output, $questions); + + $this->addFile() + ->path('src/Plugin/Menu/{class}.php') + ->template('d8/plugin/menu-link.twig'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Plugin/Migrate/Destination.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Plugin/Migrate/Destination.php new file mode 100644 index 00000000..566b8155 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Plugin/Migrate/Destination.php @@ -0,0 +1,37 @@ +setValidator([Utils::class, 'validateMachineName']); + $questions['class'] = Utils::pluginClassQuestion(); + + $this->collectVars($input, $output, $questions); + + $this->addFile() + ->path('src/Plugin/migrate/destination/{class}.php') + ->template('d8/plugin/migrate/destination.twig'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Plugin/Migrate/Process.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Plugin/Migrate/Process.php new file mode 100644 index 00000000..7b0aec9a --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Plugin/Migrate/Process.php @@ -0,0 +1,36 @@ +setValidator([Utils::class, 'validateMachineName']); + $questions['class'] = Utils::pluginClassQuestion(); + + $this->collectVars($input, $output, $questions); + + $this->addFile() + ->path('src/Plugin/migrate/process/{class}.php') + ->template('d8/plugin/migrate/process.twig'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Plugin/Migrate/Source.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Plugin/Migrate/Source.php new file mode 100644 index 00000000..830e849f --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Plugin/Migrate/Source.php @@ -0,0 +1,47 @@ +setValidator([Utils::class, 'validateMachineName']); + $questions['class'] = Utils::pluginClassQuestion(); + + $source_types = [ + 'sql' => 'SQL', + 'other' => 'Other', + ]; + $choices = Utils::prepareChoices($source_types); + $questions['source_type'] = new ChoiceQuestion('Source type', $choices); + + $vars = &$this->collectVars($input, $output, $questions); + $vars['source_type'] = array_search($vars['source_type'], $source_types); + + $vars['base_class'] = $vars['source_type'] == 'sql' ? 'SqlBase' : 'SourcePluginBase'; + + $this->addFile() + ->path('src/Plugin/migrate/source/{class}.php') + ->template('d8/plugin/migrate/source.twig'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Plugin/QueueWorker.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Plugin/QueueWorker.php new file mode 100644 index 00000000..b10c4980 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Plugin/QueueWorker.php @@ -0,0 +1,38 @@ +collectVars($input, $output, $questions); + + $this->addFile() + ->path('src/Plugin/QueueWorker/{class}.php') + ->template('d8/plugin/queue-worker.twig'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Plugin/RestResource.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Plugin/RestResource.php new file mode 100644 index 00000000..0b0fee6d --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Plugin/RestResource.php @@ -0,0 +1,34 @@ +collectVars($input, $output, $questions); + + $this->addFile() + ->path('src/Plugin/rest/resource/{class}.php') + ->template('d8/plugin/rest-resource.twig'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Plugin/Views/ArgumentDefault.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Plugin/Views/ArgumentDefault.php new file mode 100644 index 00000000..6200ff55 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Plugin/Views/ArgumentDefault.php @@ -0,0 +1,45 @@ +collectVars($input, $output, $questions); + + $di_question = new ConfirmationQuestion('Would you like to inject dependencies?', FALSE); + if ($this->ask($input, $output, $di_question)) { + $this->collectServices($input, $output); + } + + $this->addFile() + ->path('src/Plugin/views/argument_default/{class}.php') + ->template('d8/plugin/views/argument-default.twig'); + + if ($vars['configurable']) { + $this->addFile() + ->path('config/schema/{machine_name}.views.schema.yml') + ->template('d8/plugin/views/argument-default-schema.twig') + ->action('append'); + } + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Plugin/Views/Field.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Plugin/Views/Field.php new file mode 100644 index 00000000..2c5763c4 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Plugin/Views/Field.php @@ -0,0 +1,46 @@ +collectVars($input, $output, $questions); + + $di_question = new ConfirmationQuestion('Would you like to inject dependencies?', FALSE); + if ($this->ask($input, $output, $di_question)) { + $this->collectServices($input, $output); + } + + $this->addFile() + ->path('src/Plugin/views/field/{class}.php') + ->template('d8/plugin/views/field.twig'); + + if ($vars['configurable']) { + $this->addFile() + ->path('config/schema/{machine_name}.views.schema.yml') + ->template('d8/plugin/views/field-schema.twig') + ->action('append'); + } + + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Plugin/Views/Style.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Plugin/Views/Style.php new file mode 100644 index 00000000..5ae8efc5 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Plugin/Views/Style.php @@ -0,0 +1,53 @@ +collectVars($input, $output, $questions); + + $this->addFile() + ->path('src/Plugin/views/style/{class}.php') + ->template('d8/plugin/views/style-plugin.twig'); + + $this->addFile() + ->path('templates/views-style-' . str_replace('_', '-', $vars['plugin_id']) . '.html.twig') + ->template('d8/plugin/views/style-template.twig'); + + $this->addFile() + ->path('{machine_name}.module') + ->headerTemplate('d8/file-docs/module.twig') + ->template('d8/plugin/views/style-preprocess.twig') + ->action('append') + ->headerSize(7); + + if ($vars['configurable']) { + $this->addFile() + ->path('config/schema/{machine_name}.schema.yml') + ->template('d8/plugin/views/style-schema.twig') + ->action('append'); + } + + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/PluginManager.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/PluginManager.php new file mode 100644 index 00000000..c80bb0b3 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/PluginManager.php @@ -0,0 +1,111 @@ +setValidator(function ($value) { + if (!preg_match('/^[a-z][a-z0-9_\.]*[a-z0-9]$/', $value)) { + throw new \UnexpectedValueException('The value is not correct machine name.'); + } + return $value; + }); + + $discovery_types = [ + 'annotation' => 'Annotation', + 'yaml' => 'YAML', + 'hook' => 'Hook', + ]; + $choices = Utils::prepareChoices($discovery_types); + $questions['discovery'] = new ChoiceQuestion('Discovery type', $choices, 'Annotation'); + + $vars = &$this->collectVars($input, $output, $questions); + + $vars['class_prefix'] = Utils::camelize($vars['plugin_type']); + $vars['discovery'] = array_search($vars['discovery'], $discovery_types); + + $common_files = [ + 'model.services.yml', + 'src/ExampleInterface.php', + 'src/ExamplePluginManager.php', + ]; + + $files = []; + switch ($vars['discovery']) { + case 'annotation': + $files = [ + 'src/Annotation/Example.php', + 'src/ExamplePluginBase.php', + 'src/Plugin/Example/Foo.php', + ]; + break; + + case 'yaml': + $files = [ + 'model.examples.yml', + 'src/ExampleDefault.php', + ]; + break; + + case 'hook': + $files = [ + 'model.module', + 'src/ExampleDefault.php', + ]; + break; + } + + $files = array_merge($common_files, $files); + + $templates_path = 'd8/plugin-manager/' . $vars['discovery'] . '/'; + + $path_placeholders = ['model', 'Example', 'examples']; + $path_replacements = [ + $vars['machine_name'], + $vars['class_prefix'], + Utils::pluralize($vars['plugin_type']), + ]; + + foreach ($files as $file) { + $asset = $this->addFile() + ->path(str_replace($path_placeholders, $path_replacements, $file)) + ->template($templates_path . $file . '.twig'); + if ($file === 'model.services.yml') { + $asset->action('append')->headerSize(1); + } + elseif ($file == 'model.module') { + $asset + ->action('append') + ->headerTemplate('d8/file-docs/module.twig') + ->headerSize(7); + } + } + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Project.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Project.php new file mode 100644 index 00000000..6192361b --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Project.php @@ -0,0 +1,309 @@ + '^1.8', + 'cweagans/composer-patches' => '^1.6', + 'drupal/core' => '^8.8', + 'drupal/core-composer-scaffold' => '^8.8', + 'drush/drush' => '^10.2', + 'oomphinc/composer-installers-extender' => '^1.1', + 'symfony/dotenv' => '^4.4', + 'drupal/core-recommended' => '^8.8', + 'drupal/core-dev' => '^8.8', + 'zaporylie/composer-drupal-optimizations' => '^1.1', + 'weitzman/drupal-test-traits' => '^1.3', + ]; + + /** + * {@inheritdoc} + */ + protected function interact(InputInterface $input, OutputInterface $output) { + + $vars = &$this->vars; + + $name_validator = function (?string $value): ?string { + if (!preg_match('#[^/]+/[^/]+$#i', $value)) { + throw new \UnexpectedValueException('The value is not correct project name.'); + } + return $value; + }; + $questions['name'] = new Question('Project name (vendor/name)', FALSE); + $questions['name']->setValidator($name_validator); + + $questions['description'] = new Question('Description'); + + $questions['license'] = new Question('License', 'GPL-2.0-or-later'); + // @see https://getcomposer.org/doc/04-schema.md#license + $licenses = [ + 'Apache-2.0', + 'BSD-2-Clause', + 'BSD-3-Clause', + 'BSD-4-Clause', + 'GPL-2.0-only', + 'GPL-2.0-or-later', + 'GPL-3.0-only', + 'GPL-3.0-or-later', + 'LGPL-2.1-onl', + 'LGPL-2.1-or-later', + 'LGPL-3.0-only', + 'LGPL-3.0-or-later', + 'MIT', + 'proprietary', + ]; + $questions['license']->setAutocompleterValues($licenses); + + // Suggest most typical document roots. + $document_roots = [ + 'docroot', + 'web', + 'www', + 'public_html', + 'public', + 'htdocs', + 'httpdocs', + 'html', + ]; + $questions['document_root'] = new Question('Document root directory', 'docroot'); + $questions['document_root']->setAutocompleterValues($document_roots); + + $questions['php'] = new Question('PHP version', '>=' . PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION); + + $questions['drupal_core_recommended'] = new ConfirmationQuestion('Would you like to install recommended Drupal core dependencies?', FALSE); + $questions['drupal_core_dev'] = new ConfirmationQuestion('Would you like to install Drupal core development dependencies?', FALSE); + + $questions['drush'] = new ConfirmationQuestion('Would you like to install Drush?'); + + $questions['composer_patches'] = new ConfirmationQuestion('Would you like to install Composer patches plugin?'); + $questions['env'] = new ConfirmationQuestion('Would you like to load environment variables from .env files?', FALSE); + $questions['asset_packagist'] = new ConfirmationQuestion('Would you like to add asset-packagist repository?', FALSE); + + $questions['tests'] = new ConfirmationQuestion('Would you like to create tests?', FALSE); + + $this->collectVars($input, $output, $questions); + $vars['document_root_path'] = $vars['document_root'] . '/'; + if ($vars['tests']) { + // @codingStandardsIgnoreStart + [$vendor, $short_name] = explode('/', $vars['name']); + $vars['namespace'] = Utils::camelize($vendor == $short_name ? $vendor : $vars['name']); + // @codingStandardsIgnoreEnd + } + + $this->addFile('composer.json')->content($this->buildComposerJson($vars)); + + $this->addFile('.gitignore') + ->template('d8/_project/gitignore.twig'); + $this->addFile('phpcs.xml') + ->template('d8/_project/phpcs.xml.twig'); + + if ($vars['env']) { + $this->addFile('.env.example') + ->template('d8/_project/env.example.twig'); + $this->addFile('load.environment.php') + ->template('d8/_project/load.environment.php.twig'); + } + + if ($vars['document_root']) { + $this->addDirectory('config/sync'); + } + + if ($vars['drush']) { + $this->addFile('drush/Commands/PolicyCommands.php') + ->template('d8/_project/drush/Commands/PolicyCommands.php.twig'); + $this->addFile('drush/sites/self.site.yml') + ->template('d8/_project/drush/sites/self.site.yml.twig'); + $this->addFile('scripts/sync-site.sh') + ->template('d8/_project/scripts/sync-site.sh.twig') + ->mode(0544); + } + + if ($vars['tests']) { + $this->addFile('phpunit.xml') + ->template('d8/_project/phpunit.xml.twig'); + $this->addFile('tests/src/HomePageTest.php') + ->template('d8/_project/tests/src/HomePageTest.php.twig'); + } + + $this->addFile('patches/.keep')->content(''); + $this->addDirectory('{document_root}/modules/contrib'); + $this->addDirectory('{document_root}/modules/custom'); + $this->addDirectory('{document_root}/themes/custom'); + $this->addDirectory('{document_root}/libraries'); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) { + $result = parent::execute($input, $output); + if ($result === 0) { + $output->writeln(' Next steps:'); + $output->writeln(' –––––––––––'); + $output->writeln(' 1. Review generated files'); + $output->writeln(' 2. Run composer install command'); + $output->writeln(' 3. Install Drupal'); + $output->writeln(''); + } + return $result; + } + + /** + * Builds composer.json file. + * + * @param array $vars + * Collected variables. + * + * @return string + * Encoded JSON content. + */ + protected function buildComposerJson(array $vars) { + + $document_root_path = $vars['document_root_path']; + + $composer_json = []; + + $composer_json['name'] = $vars['name']; + $composer_json['description'] = (string) $vars['description']; + $composer_json['type'] = 'project'; + $composer_json['license'] = $vars['license']; + + $composer_json['repositories'][] = [ + 'type' => 'composer', + 'url' => 'https://packages.drupal.org/8', + ]; + if ($vars['asset_packagist']) { + $composer_json['repositories'][] = [ + 'type' => 'composer', + 'url' => 'https://asset-packagist.org', + ]; + } + + $require = []; + $require_dev = []; + + $this->addPackage($require, 'drupal/core-composer-scaffold'); + $this->addPackage($require, 'zaporylie/composer-drupal-optimizations'); + + if ($vars['asset_packagist']) { + $this->addPackage($require, 'oomphinc/composer-installers-extender'); + } + + if ($vars['drupal_core_recommended']) { + $this->addPackage($require, 'drupal/core-recommended'); + } + else { + $this->addPackage($require, 'drupal/core'); + $this->addPackage($require, 'composer/installers'); + } + + if ($vars['drupal_core_dev']) { + $this->addPackage($require_dev, 'drupal/core-dev'); + } + + if ($vars['drush']) { + $this->addPackage($require, 'drush/drush'); + } + + if ($vars['composer_patches']) { + $this->addPackage($require, 'cweagans/composer-patches'); + } + + if ($vars['env']) { + $this->addPackage($require, 'symfony/dotenv'); + $composer_json['autoload']['files'][] = 'load.environment.php'; + } + + if ($vars['tests']) { + $this->addPackage($require_dev, 'weitzman/drupal-test-traits'); + $composer_json['autoload-dev']['psr-4'][$vars['namespace'] . '\\Tests\\'] = 'tests/src'; + } + + $composer_json['require'] = [ + 'php' => $vars['php'], + 'ext-curl' => '*', + 'ext-gd' => '*', + 'ext-json' => '*', + ]; + ksort($require); + $composer_json['require'] += $require; + + ksort($require_dev); + $composer_json['require-dev'] = (object) $require_dev; + + $composer_json['scripts']['phpcs'] = 'phpcs --standard=phpcs.xml'; + $composer_json['minimum-stability'] = 'dev'; + $composer_json['prefer-stable'] = TRUE; + + $composer_json['config'] = [ + 'sort-packages' => TRUE, + 'bin-dir' => 'bin', + ]; + + if ($vars['composer_patches']) { + $composer_json['extra']['composer-exit-on-patch-failure'] = TRUE; + } + + $composer_json['extra']['drupal-scaffold']['locations']['web-root'] = $vars['document_root_path']; + + if ($vars['asset_packagist']) { + $composer_json['extra']['installer-types'] = [ + 'bower-asset', + 'npm-asset', + ]; + } + $composer_json['extra']['installer-paths'] = [ + $document_root_path . 'core' => ['type:drupal-core'], + $document_root_path . 'libraries/{$name}' => ['type:drupal-library'], + $document_root_path . 'modules/contrib/{$name}' => ['type:drupal-module'], + $document_root_path . 'themes/{$name}' => ['type:drupal-theme'], + 'drush/{$name}' => ['type:drupal-drush'], + ]; + + if ($vars['asset_packagist']) { + $composer_json['extra']['installer-paths'][$document_root_path . 'libraries/{$name}'][] = 'type:bower-asset'; + $composer_json['extra']['installer-paths'][$document_root_path . 'libraries/{$name}'][] = 'type:npm-asset'; + } + + return json_encode($composer_json, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) . "\n"; + } + + /** + * Requires a given package. + * + * @param array $section + * Section for the package (require|require-dev) + * @param string $package + * A package to be added. + */ + private function addPackage(array &$section, $package) { + if (!array_key_exists($package, self::PACKAGES)) { + throw new \InvalidArgumentException("Package $package is unknown."); + } + $section[$package] = self::PACKAGES[$package]; + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/RenderElement.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/RenderElement.php new file mode 100644 index 00000000..8f9a20cd --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/RenderElement.php @@ -0,0 +1,32 @@ +setValidator([Utils::class, 'validateMachineName']); + $this->collectVars($input, $output, $questions); + $this->addFile() + ->path('src/Element/Entity.php') + ->template('d8/render-element.twig'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Service/AccessChecker.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Service/AccessChecker.php new file mode 100644 index 00000000..1f5d98a3 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Service/AccessChecker.php @@ -0,0 +1,47 @@ +setValidator(function ($value) { + if (!preg_match('/^_[a-z0-9_]*[a-z0-9]$/', $value)) { + throw new \UnexpectedValueException('The value is not correct name for "applies_to" property.'); + } + return $value; + }); + $default_class = function ($vars) { + return Utils::camelize($vars['applies_to']) . 'AccessChecker'; + }; + $questions['class'] = new Question('Class', $default_class); + + $this->collectVars($input, $output, $questions); + + $this->addFile() + ->path('src/Access/{class}.php') + ->template('d8/service/access-checker.twig'); + + $this->addServicesFile() + ->template('d8/service/access-checker.services.twig'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Service/BreadcrumbBuilder.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Service/BreadcrumbBuilder.php new file mode 100644 index 00000000..4145b25f --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Service/BreadcrumbBuilder.php @@ -0,0 +1,41 @@ +collectVars($input, $output, $questions); + + $this->addFile() + ->path('src/{class}.php') + ->template('d8/service/breadcrumb-builder.twig'); + + $this->addServicesFile() + ->path('{machine_name}.services.yml') + ->template('d8/service/breadcrumb-builder.services.twig'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Service/CacheContext.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Service/CacheContext.php new file mode 100644 index 00000000..52b3a1d3 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Service/CacheContext.php @@ -0,0 +1,58 @@ +collectVars($input, $output, $questions); + $vars['context_label'] = Utils::machine2human($vars['context_id']); + + $vars['interface'] = $vars['calculated'] ? + 'CalculatedCacheContextInterface' : 'CacheContextInterface'; + + if ($vars['base_class'] == '-') { + $vars['base_class'] = FALSE; + } + + $this->addFile() + ->path('src/Cache/Context/{class}.php') + ->template('d8/service/cache-context.twig'); + + $this->addServicesFile() + ->template('d8/service/cache-context.services.twig'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Service/Custom.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Service/Custom.php new file mode 100644 index 00000000..77697bf1 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Service/Custom.php @@ -0,0 +1,52 @@ +setValidator([Utils::class, 'validateServiceName']); + + $default_class = function ($vars) { + $service = preg_replace('/^' . $vars['machine_name'] . '/', '', $vars['service_name']); + return Utils::camelize($service); + }; + $questions['class'] = new Question('Class', $default_class); + $questions['class']->setValidator([Utils::class, 'validateClassName']); + + $this->collectVars($input, $output, $questions); + + $di_question = new ConfirmationQuestion('Would you like to inject dependencies?'); + if ($this->ask($input, $output, $di_question)) { + $this->collectServices($input, $output); + } + + $this->addFile() + ->path('src/{class}.php') + ->template('d8/service/custom.twig'); + + $this->addServicesFile() + ->template('d8/service/custom.services.twig'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Service/EventSubscriber.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Service/EventSubscriber.php new file mode 100644 index 00000000..3f065576 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Service/EventSubscriber.php @@ -0,0 +1,42 @@ +setValidator([Utils::class, 'validateClassName']); + + $this->collectVars($input, $output, $questions); + + $this->addFile() + ->path('src/EventSubscriber/{class}.php') + ->template('d8/service/event-subscriber.twig'); + + $this->addServicesFile() + ->template('d8/service/event-subscriber.services.twig'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Service/Logger.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Service/Logger.php new file mode 100644 index 00000000..cdc4ff0b --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Service/Logger.php @@ -0,0 +1,37 @@ +collectVars($input, $output, $questions); + + $this->addFile() + ->path('src/Logger/{class}.php') + ->template('d8/service/logger.twig'); + + $this->addServicesFile() + ->template('d8/service/logger.services.twig'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Service/Middleware.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Service/Middleware.php new file mode 100644 index 00000000..efeff428 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Service/Middleware.php @@ -0,0 +1,42 @@ +setValidator([Utils::class, 'validateClassName']); + $this->collectVars($input, $output, $questions); + + $this->addFile() + ->path('src/{class}.php') + ->template('d8/service/middleware.twig'); + + $this->addServicesFile() + ->path('{machine_name}.services.yml') + ->template('d8/service/middleware.services.twig'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Service/ParamConverter.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Service/ParamConverter.php new file mode 100644 index 00000000..5fb58934 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Service/ParamConverter.php @@ -0,0 +1,43 @@ +collectVars($input, $output, $questions); + $vars['controller_class'] = Utils::camelize($vars['machine_name']) . 'Controller'; + + $this->addFile() + ->path('src/{class}.php') + ->template('d8/service/param-converter.twig'); + + $this->addServicesFile() + ->path('{machine_name}.services.yml') + ->template('d8/service/param-converter.services.twig'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Service/PathProcessor.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Service/PathProcessor.php new file mode 100644 index 00000000..0ff57195 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Service/PathProcessor.php @@ -0,0 +1,40 @@ +collectVars($input, $output, $questions); + + $this->addFile() + ->path('src/PathProcessor/{class}.php') + ->template('d8/service/path-processor.twig'); + + $this->addServicesFile() + ->template('d8/service/path-processor.services.twig'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Service/RequestPolicy.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Service/RequestPolicy.php new file mode 100644 index 00000000..5f399c93 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Service/RequestPolicy.php @@ -0,0 +1,36 @@ +collectVars($input, $output, $questions); + + $this->addFile() + ->path('src/PageCache/{class}.php') + ->template('d8/service/request-policy.twig'); + + $this->addServicesFile() + ->template('d8/service/request-policy.services.twig'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Service/ResponsePolicy.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Service/ResponsePolicy.php new file mode 100644 index 00000000..d5bb2a72 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Service/ResponsePolicy.php @@ -0,0 +1,36 @@ +collectVars($input, $output, $questions); + + $this->addFile() + ->path('src/PageCache/{class}.php') + ->template('d8/service/response-policy.twig'); + + $this->addServicesFile() + ->template('d8/service/response-policy.services.twig'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Service/RouteSubscriber.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Service/RouteSubscriber.php new file mode 100644 index 00000000..bb99145d --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Service/RouteSubscriber.php @@ -0,0 +1,42 @@ +setValidator([Utils::class, 'validateClassName']); + + $this->collectVars($input, $output, $questions); + + $this->addFile() + ->path('src/EventSubscriber/{class}.php') + ->template('d8/service/route-subscriber.twig'); + + $this->addServicesFile() + ->template('d8/service/route-subscriber.services.twig'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Service/ThemeNegotiator.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Service/ThemeNegotiator.php new file mode 100644 index 00000000..5640506d --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Service/ThemeNegotiator.php @@ -0,0 +1,40 @@ +collectVars($input, $output, $questions); + + $this->addFile() + ->path('src/Theme/{class}.php') + ->template('d8/service/theme-negotiator.twig'); + + $this->addServicesFile() + ->template('d8/service/theme-negotiator.services.twig'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Service/TwigExtension.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Service/TwigExtension.php new file mode 100644 index 00000000..aef5a503 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Service/TwigExtension.php @@ -0,0 +1,45 @@ +collectVars($input, $output, $questions); + + $di_question = new ConfirmationQuestion('Would you like to inject dependencies?'); + if ($this->ask($input, $output, $di_question)) { + $this->collectServices($input, $output); + } + + $this->addFile() + ->path('src/{class}.php') + ->template('d8/service/twig-extension.twig'); + + $this->addServicesFile() + ->template('d8/service/twig-extension.services.twig'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Service/UninstallValidator.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Service/UninstallValidator.php new file mode 100644 index 00000000..59bc4534 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Service/UninstallValidator.php @@ -0,0 +1,39 @@ +collectVars($input, $output, $questions); + + $this->addFile() + ->path('src/{class}.php') + ->template('d8/service/uninstall-validator.twig'); + + $this->addServicesFile() + ->template('d8/service/uninstall-validator.services.twig'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/ServiceProvider.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/ServiceProvider.php new file mode 100644 index 00000000..47749cdc --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/ServiceProvider.php @@ -0,0 +1,30 @@ +collectVars($input, $output, Utils::defaultQuestions()); + $vars['class'] = Utils::camelize($vars['machine_name']) . 'ServiceProvider'; + $this->addFile() + ->path('src/{class}.php') + ->template('d8/service-provider.twig'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/SettingsLocal.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/SettingsLocal.php new file mode 100644 index 00000000..240fef5f --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/SettingsLocal.php @@ -0,0 +1,48 @@ +collectVars($input, $output, $questions); + if ($vars['db_override']) { + $questions = [ + 'database' => new Question('Database name', 'drupal_local'), + 'username' => new Question('Database username', 'root'), + 'password' => new Question('Database password'), + 'host' => new Question('Database host', 'localhost'), + 'driver' => new Question('Database type', 'mysql'), + ]; + array_walk($questions, function (Question $question) { + $question->setValidator([Utils::class, 'validateRequired']); + }); + $this->collectVars($input, $output, $questions); + } + + $this->addFile() + ->path('settings.local.php') + ->template('d8/settings.local.twig'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Template.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Template.php new file mode 100644 index 00000000..e2c33277 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Template.php @@ -0,0 +1,45 @@ +collectVars($input, $output, $questions); + + $this->addFile() + ->path('templates/{template_name}.html.twig') + ->template('d8/template-template.twig'); + + if ($vars['create_theme'] || $vars['create_preprocess']) { + $this->addFile() + ->path('{machine_name}.module') + ->template('d8/template-module.twig') + ->action('append') + ->headerSize(7); + } + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Test/Browser.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Test/Browser.php new file mode 100644 index 00000000..886bf41c --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Test/Browser.php @@ -0,0 +1,35 @@ +setValidator([Utils::class, 'validateClassName']); + + $this->collectVars($input, $output, $questions); + + $this->addFile() + ->path('tests/src/Functional/{class}.php') + ->template('d8/test/browser.twig'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Test/Kernel.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Test/Kernel.php new file mode 100644 index 00000000..dbad8abc --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Test/Kernel.php @@ -0,0 +1,35 @@ +setValidator([Utils::class, 'validateClassName']); + + $this->collectVars($input, $output, $questions); + + $this->addFile() + ->path('tests/src/Kernel/{class}.php') + ->template('d8/test/kernel.twig'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Test/Nightwatch.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Test/Nightwatch.php new file mode 100644 index 00000000..e390943c --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Test/Nightwatch.php @@ -0,0 +1,35 @@ +collectVars($input, $output, $questions); + $vars['test_name'] = Utils::camelize($vars['test_name'], FALSE); + + $this->addFile() + ->path('tests/src/Nightwatch/{test_name}Test.js') + ->template('d8/test/nightwatch.twig'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Test/Unit.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Test/Unit.php new file mode 100644 index 00000000..17a9280a --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Test/Unit.php @@ -0,0 +1,35 @@ +setValidator([Utils::class, 'validateClassName']); + + $this->collectVars($input, $output, $questions); + + $this->addFile() + ->path('tests/src/Unit/{class}.php') + ->template('d8/test/unit.twig'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Test/Web.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Test/Web.php new file mode 100644 index 00000000..39c867b4 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Test/Web.php @@ -0,0 +1,36 @@ +setValidator([Utils::class, 'validateClassName']); + + $this->collectVars($input, $output, $questions); + + $this->addFile() + ->path('src/Tests/{class}.php') + ->template('d8/test/web.twig'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Test/WebDriver.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Test/WebDriver.php new file mode 100644 index 00000000..17f164ce --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Test/WebDriver.php @@ -0,0 +1,36 @@ +setValidator([Utils::class, 'validateClassName']); + + $this->collectVars($input, $output, $questions); + + $this->addFile() + ->path('tests/src/FunctionalJavascript/{class}.php') + ->template('d8/test/webdriver.twig'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Theme.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Theme.php new file mode 100644 index 00000000..638cf646 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Theme.php @@ -0,0 +1,138 @@ +collectVars($input, $output, $questions); + $vars['base_theme'] = Utils::human2machine($vars['base_theme']); + + $prefix = $vars['machine_name'] . '/' . $vars['machine_name']; + + $this->addFile() + ->path($prefix . '.info.yml') + ->template('d8/yml/theme-info.twig'); + + $this->addFile() + ->path($prefix . '.libraries.yml') + ->template('d8/yml/theme-libraries.twig'); + + $this->addFile() + ->path($prefix . '.theme') + ->template('d8/theme.twig'); + + $this->addFile() + ->path('{machine_name}/js/' . str_replace('_', '-', $vars['machine_name']) . '.js') + ->template('d8/javascript.twig'); + + if ($vars['breakpoints']) { + $this->addFile() + ->path($prefix . '.breakpoints.yml') + ->template('d8/yml/breakpoints.twig'); + } + + if ($vars['theme_settings']) { + $this->addFile() + ->path('{machine_name}/theme-settings.php') + ->template('d8/theme-settings-form.twig'); + + $this->addFile() + ->path('{machine_name}/config/install/{machine_name}.settings.yml') + ->template('d8/theme-settings-config.twig'); + + $this->addFile() + ->path('{machine_name}/config/schema/{machine_name}.schema.yml') + ->template('d8/theme-settings-schema.twig'); + } + + $this->addFile() + ->path('{machine_name}/logo.svg') + ->template('d8/theme-logo.twig'); + + // Templates directory structure. + $this->addDirectory() + ->path('{machine_name}/templates/page'); + + $this->addDirectory() + ->path('{machine_name}/templates/node'); + + $this->addDirectory() + ->path('{machine_name}/templates/field'); + + $this->addDirectory() + ->path('{machine_name}/templates/view'); + + $this->addDirectory() + ->path('{machine_name}/templates/block'); + + $this->addDirectory() + ->path('{machine_name}/templates/menu'); + + $this->addDirectory() + ->path('{machine_name}/images'); + + $this->addFile() + ->path('{machine_name}/package.json') + ->template('d8/theme-package.json.twig'); + + // Style sheets directory structure. + $this->addDirectory() + ->path('{machine_name}/css'); + + $style_sheets = [ + 'base/elements', + 'components/block', + 'components/breadcrumb', + 'components/field', + 'components/form', + 'components/header', + 'components/menu', + 'components/messages', + 'components/node', + 'components/sidebar', + 'components/table', + 'components/tabs', + 'components/buttons', + 'layouts/layout', + 'theme/print', + ]; + + foreach ($style_sheets as $file) { + $this->addFile() + ->path('{machine_name}/' . ($vars['sass'] ? "scss/$file.scss" : "css/$file.css")) + ->content(''); + } + + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/ThemeFile.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/ThemeFile.php new file mode 100644 index 00000000..c99f3626 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/ThemeFile.php @@ -0,0 +1,37 @@ +setValidator([Utils::class, 'validateRequired']); + $questions['machine_name'] = new Question('Theme machine name'); + $questions['machine_name']->setValidator([Utils::class, 'validateMachineName']); + + $this->collectVars($input, $output, $questions); + + $this->addFile() + ->path('{machine_name}.theme') + ->template('d8/theme.twig'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/ThemeSettings.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/ThemeSettings.php new file mode 100644 index 00000000..f62413c9 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/ThemeSettings.php @@ -0,0 +1,44 @@ +setValidator([Utils::class, 'validateRequired']); + $questions['machine_name'] = new Question('Theme machine name'); + $questions['machine_name']->setValidator([Utils::class, 'validateMachineName']); + $this->collectVars($input, $output, $questions); + + $this->addFile() + ->path('theme-settings.php') + ->template('d8/theme-settings-form.twig'); + + $this->addFile() + ->path('config/install/{machine_name}.settings.yml') + ->template('d8/theme-settings-config.twig'); + + $this->addFile() + ->path('config/schema/{machine_name}.schema.yml') + ->template('d8/theme-settings-schema.twig'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Yml/Breakpoints.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Yml/Breakpoints.php new file mode 100644 index 00000000..4103fe75 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Yml/Breakpoints.php @@ -0,0 +1,35 @@ +setValidator([Utils::class, 'validateMachineName']); + + $this->collectVars($input, $output, $questions); + + $this->addFile() + ->path('{machine_name}.breakpoints.yml') + ->template('d8/yml/breakpoints.twig'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Yml/Links/Action.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Yml/Links/Action.php new file mode 100644 index 00000000..4915e565 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Yml/Links/Action.php @@ -0,0 +1,34 @@ +setValidator([Utils::class, 'validateMachineName']); + + $this->collectVars($input, $output, $questions); + + $this->addFile() + ->path('{machine_name}.links.action.yml') + ->template('d8/yml/links.action.twig'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Yml/Links/Contextual.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Yml/Links/Contextual.php new file mode 100644 index 00000000..1aca0acc --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Yml/Links/Contextual.php @@ -0,0 +1,34 @@ +setValidator([Utils::class, 'validateMachineName']); + + $this->collectVars($input, $output, $questions); + + $this->addFile() + ->path('{machine_name}.links.contextual.yml') + ->template('d8/yml/links.contextual.twig'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Yml/Links/Menu.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Yml/Links/Menu.php new file mode 100644 index 00000000..e8251a19 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Yml/Links/Menu.php @@ -0,0 +1,34 @@ +setValidator([Utils::class, 'validateMachineName']); + + $this->collectVars($input, $output, $questions); + + $this->addFile() + ->path('{machine_name}.links.menu.yml') + ->template('d8/yml/links.menu.twig'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Yml/Links/Task.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Yml/Links/Task.php new file mode 100644 index 00000000..26dbdb2e --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Yml/Links/Task.php @@ -0,0 +1,34 @@ +setValidator([Utils::class, 'validateMachineName']); + + $this->collectVars($input, $output, $questions); + + $this->addFile() + ->path('{machine_name}.links.task.yml') + ->template('d8/yml/links.task.twig'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Yml/ModuleInfo.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Yml/ModuleInfo.php new file mode 100644 index 00000000..00784d8f --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Yml/ModuleInfo.php @@ -0,0 +1,40 @@ +collectVars($input, $output, $questions); + if ($vars['dependencies']) { + $vars['dependencies'] = array_map('trim', explode(',', strtolower($vars['dependencies']))); + } + + $this->addFile() + ->path('{machine_name}.info.yml') + ->template('d8/yml/module-info.twig'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Yml/ModuleLibraries.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Yml/ModuleLibraries.php new file mode 100644 index 00000000..d1750975 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Yml/ModuleLibraries.php @@ -0,0 +1,35 @@ +setValidator([Utils::class, 'validateMachineName']); + + $this->collectVars($input, $output, $questions); + + $this->addFile() + ->path('{machine_name}.libraries.yml') + ->template('d8/yml/module-libraries.twig'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Yml/Permissions.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Yml/Permissions.php new file mode 100644 index 00000000..a8656580 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Yml/Permissions.php @@ -0,0 +1,34 @@ +setValidator([Utils::class, 'validateMachineName']); + + $this->collectVars($input, $output, $questions); + + $this->addFile() + ->path('{machine_name}.permissions.yml') + ->template('d8/yml/permissions.twig'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Yml/Routing.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Yml/Routing.php new file mode 100644 index 00000000..f0b2d25b --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Yml/Routing.php @@ -0,0 +1,33 @@ +collectVars($input, $output, $questions); + $vars['class'] = Utils::camelize($vars['machine_name']) . 'Controller'; + + $this->addFile() + ->path('{machine_name}.routing.yml') + ->template('d8/yml/routing.twig'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Yml/Services.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Yml/Services.php new file mode 100644 index 00000000..a0e52613 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Yml/Services.php @@ -0,0 +1,33 @@ +collectVars($input, $output, $questions); + $vars['class'] = Utils::camelize($vars['machine_name']); + + $this->addFile() + ->path('{machine_name}.services.yml') + ->template('d8/yml/services.twig'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Yml/ThemeInfo.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Yml/ThemeInfo.php new file mode 100644 index 00000000..f026c821 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Yml/ThemeInfo.php @@ -0,0 +1,45 @@ +setValidator([Utils::class, 'validateRequired']); + + $questions['machine_name'] = new Question('Theme machine name'); + $questions['machine_name']->setValidator([Utils::class, 'validateMachineName']); + + $questions['base_theme'] = new Question('Base theme', 'classy'); + $questions['base_theme']->setValidator([Utils::class, 'validateMachineName']); + + $questions['description'] = new Question('Description', 'A flexible theme with a responsive, mobile-first layout.'); + + $questions['package'] = new Question('Package', 'Custom'); + + $this->collectVars($input, $output, $questions); + + $this->addFile() + ->path('{machine_name}.info.yml') + ->template('d8/yml/theme-info.twig'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Yml/ThemeLibraries.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Yml/ThemeLibraries.php new file mode 100644 index 00000000..f77c1488 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Yml/ThemeLibraries.php @@ -0,0 +1,35 @@ +setValidator([Utils::class, 'validateMachineName']); + + $this->collectVars($input, $output, $questions); + + $this->addFile() + ->path('{machine_name}.libraries.yml') + ->template('d8/yml/theme-libraries.twig'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/GeneratorInterface.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/GeneratorInterface.php new file mode 100644 index 00000000..38120156 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/GeneratorInterface.php @@ -0,0 +1,71 @@ + 'Drupal 7', + 'd8' => 'Drupal 8', + ]; + + /** + * Aliases for some sub-menus. + * + * @var array + */ + protected $defaultAliases = [ + 'service' => 'd8:service', + 'plugin' => 'd8:plugin', + 'theme' => 'd8:theme', + 'module' => 'd8:module', + 'form' => 'd8:form', + 'test' => 'd8:test', + 'yml' => 'd8:yml', + 'links' => 'd8:yml:links', + ]; + + /** + * Constructs menu command. + * + * @param \DrupalCodeGenerator\Command\GeneratorInterface[] $commands + * List of registered commands. + */ + public function __construct(array $commands) { + parent::__construct(); + + // Initialize the menu structure. + $this->menuTree = []; + $aliases = array_keys($this->defaultAliases); + + // Build aliases for the navigation based on command namespaces. + foreach ($commands as $command) { + $command_name = $command->getName(); + $sub_names = explode(':', $command_name); + + $this->arraySetNestedValue($this->menuTree, $sub_names, TRUE); + + // The last sub-name is actual command name so it cannot be used as an + // alias for navigation command. + $last_sub_name = array_pop($sub_names); + + // Collect command labels. + if ($label = $command->getLabel()) { + $this->labels[$last_sub_name] = $label; + } + + // We cannot use $application->getNamespaces() here because the + // application is not available at this point. + $alias = ''; + foreach ($sub_names as $sub_name) { + $alias = $alias ? $alias . ':' . $sub_name : $sub_name; + $aliases[] = $alias; + } + } + + $this->setAliases(array_unique($aliases)); + $this->recursiveKsort($this->menuTree); + } + + /** + * {@inheritdoc} + */ + public function getUsages() { + return ['']; + } + + /** + * {@inheritdoc} + */ + protected function configure() { + $this + ->setName('navigation') + ->setDescription('Provides an interactive menu to select generator') + ->setHelp('Run `dcg list` to check out all available generators.') + ->setHidden(TRUE) + ->addOption( + 'directory', + '-d', + InputOption::VALUE_OPTIONAL, + 'Working directory' + ) + ->addOption( + 'answers', + '-a', + InputOption::VALUE_OPTIONAL, + 'Default JSON formatted answers' + ); + } + + /** + * {@inheritdoc} + */ + protected function interact(InputInterface $input, OutputInterface $output) { + $style = new OutputFormatterStyle('black', 'cyan', []); + $output->getFormatter()->setStyle('title', $style); + + $command_name = $input->getFirstArgument(); + + // Before version 3.3.6 of Symfony console getFistArgument returned default + // command name. + $command_name = $command_name == 'navigation' ? NULL : $command_name; + + if (isset($this->defaultAliases[$command_name])) { + $command_name = $this->defaultAliases[$command_name]; + } + + $menu_trail = $command_name ? explode(':', $command_name) : []; + + $this->generatorName = $this->selectGenerator($input, $output, $menu_trail); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) { + + if (!$this->generatorName) { + return 0; + } + + // Run the generator. + return $this->getApplication() + ->find($this->generatorName) + ->run($input, $output); + } + + /** + * Returns a generator selected by the user from a multilevel console menu. + * + * @param \Symfony\Component\Console\Input\InputInterface $input + * Input instance. + * @param \Symfony\Component\Console\Output\OutputInterface $output + * Output instance. + * @param array $menu_trail + * Menu trail. + * + * @return string|null + * Generator name or null if user decided to exit the navigation. + */ + protected function selectGenerator(InputInterface $input, OutputInterface $output, array $menu_trail) { + + // Narrow down menu tree. + $active_menu_tree = $this->menuTree; + foreach ($menu_trail as $active_menu_item) { + $active_menu_tree = $active_menu_tree[$active_menu_item]; + } + + // The $active_menu_tree can be either an array of menu items or TRUE if the + // user reached the final menu point. + if ($active_menu_tree === TRUE) { + return implode(':', $menu_trail); + } + + $sub_menu_labels = $command_labels = []; + foreach ($active_menu_tree as $menu_item => $subtree) { + if (is_array($subtree)) { + $sub_menu_labels[$menu_item] = $this->createMenuItemLabel($menu_item, TRUE); + } + else { + $command_labels[$menu_item] = $this->createMenuItemLabel($menu_item, FALSE); + } + } + asort($sub_menu_labels); + asort($command_labels); + + // Generally the choices array consists of the following parts: + // - Reference to the parent menu level. + // - Sorted list of nested menu levels. + // - Sorted list of commands. + $choices = ['..' => '..'] + $sub_menu_labels + $command_labels; + $question = new ChoiceQuestion(' Select generator: ', array_values($choices)); + $question->setPrompt(count($choices) <= 10 ? ' ➤➤➤ ' : ' ➤➤➤➤ '); + + $answer_label = $this->getHelper('question')->ask($input, $output, $question); + $answer = array_search($answer_label, $choices); + + if ($answer == '..') { + // Exit the application if the user selected zero on the top menu level. + if (count($menu_trail) == 0) { + return NULL; + } + // Decrease menu level. + array_pop($menu_trail); + } + else { + // Increase menu level. + $menu_trail[] = $answer; + } + + return $this->selectGenerator($input, $output, $menu_trail); + } + + /** + * Creates a human readable label for a given menu item. + * + * @param string $menu_item + * Machine name of the menu item. + * @param bool $comment + * A boolean indicating that the label should be wrapped with comment tag. + * + * @return string + * The menu label. + */ + protected function createMenuItemLabel($menu_item, $comment) { + $label = isset($this->labels[$menu_item]) ? + $this->labels[$menu_item] : str_replace(['-', '_'], ' ', ucfirst($menu_item)); + return $comment ? "$label" : $label; + } + + /** + * Sort multi-dimensional array by keys. + * + * @param array $array + * An array being sorted. + * + * @return array + * Sorted array. + */ + protected function recursiveKsort(array &$array) { + foreach ($array as &$value) { + if (is_array($value)) { + $this->recursiveKsort($value); + } + } + return ksort($array); + } + + /** + * Sets a value in a nested array with variable depth. + * + * @param array $array + * A reference to the array to modify. + * @param array $parents + * An array of parent keys, starting with the outermost key. + * @param mixed $value + * The value to set. + * + * @see https://api.drupal.org/api/drupal/includes!common.inc/function/drupal_array_set_nested_value/7 + */ + protected function arraySetNestedValue(array &$array, array $parents, $value) { + $ref = &$array; + foreach ($parents as $parent) { + if (isset($ref) && !is_array($ref)) { + $ref = []; + } + $ref = &$ref[$parent]; + } + if (!isset($ref)) { + $ref = $value; + } + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Other/ApacheVirtualHost.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Other/ApacheVirtualHost.php new file mode 100644 index 00000000..e4f4d82c --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Other/ApacheVirtualHost.php @@ -0,0 +1,37 @@ + new Question('Host name', 'example.com'), + 'docroot' => new Question('Document root', '/var/www/{hostname}/public'), + ]; + + $this->collectVars($input, $output, $questions); + + $this->addFile() + ->path('{hostname}.conf') + ->template('other/apache-virtual-host.twig'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Other/DcgCommand.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Other/DcgCommand.php new file mode 100644 index 00000000..f06f8c7e --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Other/DcgCommand.php @@ -0,0 +1,65 @@ +destination = Utils::getHomeDirectory() . '/.dcg/Command'; + parent::configure(); + } + + /** + * {@inheritdoc} + */ + protected function interact(InputInterface $input, OutputInterface $output) { + + $questions = [ + 'name' => new Question('Command name', 'custom:example'), + 'description' => new Question('Command description', 'Some description'), + 'alias' => new Question('Command alias', 'example'), + ]; + + $vars = &$this->collectVars($input, $output, $questions); + + $sub_names = explode(':', $vars['name']); + $last_sub_name = array_pop($sub_names); + $vars['class'] = Utils::camelize($last_sub_name); + $vars['namespace'] = 'DrupalCodeGenerator\Command'; + $vars['template_name'] = $last_sub_name . '.twig'; + + $vars['path'] = ''; + $file_path = ''; + if ($sub_names) { + $vars['namespace'] .= '\\' . implode('\\', $sub_names); + $file_path = implode(DIRECTORY_SEPARATOR, $sub_names); + $vars['path'] = '/' . $file_path; + } + + $this->addFile() + ->path($file_path . '/{class}.php') + ->template('other/dcg-command.twig'); + + $this->addFile() + ->path($file_path . '/{template_name}') + ->template('other/dcg-command-template.twig'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Other/DrupalConsoleCommand.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Other/DrupalConsoleCommand.php new file mode 100644 index 00000000..8c107c20 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Other/DrupalConsoleCommand.php @@ -0,0 +1,46 @@ + new Question('Command name', '{machine_name}:example'), + 'description' => new Question('Command description', 'Command description.'), + 'drupal_aware' => new ConfirmationQuestion('Make the command aware of the drupal site installation?', TRUE), + ]; + + $vars = &$this->collectVars($input, $output, $questions); + + $service_short_name = str_replace(':', '_', $vars['command_name']); + $vars['service_name'] = $vars['machine_name'] . '.' . $service_short_name; + $vars['class'] = Utils::camelize($service_short_name) . 'Command'; + $vars['base_class'] = $vars['drupal_aware'] ? 'ContainerAwareCommand' : 'Command'; + + $this->addFile('src/Command/{class}.php') + ->template('other/drupal-console-command.twig'); + + $this->addServicesFile('console.services.yml') + ->template('other/drupal-console-command-services.twig'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Other/DrushCommand.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Other/DrushCommand.php new file mode 100644 index 00000000..674b2c85 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Other/DrushCommand.php @@ -0,0 +1,60 @@ +directory); + // The suggestion depends on whether the command global or local. + $prefix = $directoryBaseName == 'drush' || $directoryBaseName == '.drush' ? + $vars['command_name'] : $directoryBaseName; + return str_replace('-', '_', $prefix) . '.drush.inc'; + }; + + $questions = [ + 'command_name' => new Question('Command name', ''), + 'alias' => new Question('Command alias', $default_alias), + 'description' => new Question('Command description', 'Command description.'), + 'argument' => new Question('Argument name', 'foo'), + 'option' => new Question('Option name', 'bar'), + 'command_file' => new Question('Command file', $default_command_file), + ]; + + $vars = &$this->collectVars($input, $output, $questions); + + list($vars['command_file_prefix']) = explode('.drush.inc', $vars['command_file']); + + // Command callback name pattern gets shorter if command file name matches + // command name. + $vars['command_callback_suffix'] = $vars['command_file_prefix'] == str_replace('-', '_', $vars['command_name']) + ? $vars['command_file_prefix'] + : $vars['command_file_prefix'] . '_' . $vars['command_name']; + + $this->addFile() + ->path('{command_file}') + ->template('other/drush-command.twig'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Other/HtmlPage.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Other/HtmlPage.php new file mode 100644 index 00000000..0dc15182 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Other/HtmlPage.php @@ -0,0 +1,42 @@ +collectVars($input, $output, $questions); + + $this->addFile() + ->path('{file_name}') + ->template('other/html.twig'); + + $this->addFile() + ->path('css/main.css') + ->content("body{\n background-color: #EEE;\n}\n"); + + $this->addFile() + ->path('js/main.js') + ->content("console.log('It works!');\n"); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Command/Other/NginxVirtualHost.php b/old.vendor/chi-teck/drupal-code-generator/src/Command/Other/NginxVirtualHost.php new file mode 100644 index 00000000..bca8958b --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Command/Other/NginxVirtualHost.php @@ -0,0 +1,47 @@ + new Question('Server name', 'example.com'), + 'docroot' => new Question('Document root', '/var/www/{server_name}/docroot'), + 'file_public_path' => new Question('Public file system path', 'sites/default/files'), + 'file_private_path' => new Question('Private file system path'), + 'fastcgi_pass' => new Question('Address of a FastCGI server', 'unix:' . $socket), + ]; + + $vars = &$this->collectVars($input, $output, $questions); + + $vars['file_public_path'] = trim($vars['file_public_path'], '/'); + $vars['file_private_path'] = trim($vars['file_private_path'], '/'); + + $this->addFile() + ->path('{server_name}') + ->template('other/nginx-virtual-host.twig'); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/GeneratorDiscovery.php b/old.vendor/chi-teck/drupal-code-generator/src/GeneratorDiscovery.php new file mode 100644 index 00000000..31a907ab --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/GeneratorDiscovery.php @@ -0,0 +1,69 @@ +filesystem = $filesystem; + } + + /** + * Finds and instantiates generator commands. + * + * @param array $command_directories + * Directories to look up for commands. + * @param string $namespace + * (Optional) The namespace to filter out commands. + * + * @return \Symfony\Component\Console\Command\Command[] + * Array of generators. + */ + public function getGenerators(array $command_directories, $namespace = '\DrupalCodeGenerator\Command') { + $commands = []; + + foreach ($command_directories as $directory) { + $iterator = new RecursiveIteratorIterator( + new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS) + ); + foreach ($iterator as $path => $file) { + if ($file->getExtension() == 'php') { + $relative_path = $this->filesystem->makePathRelative($path, $directory); + $class = $namespace . '\\' . str_replace('/', '\\', preg_replace('#\.php/$#', '', $relative_path)); + if (class_exists($class)) { + $reflected_class = new ReflectionClass($class); + if (!$reflected_class->isInterface() && !$reflected_class->isAbstract() && $reflected_class->implementsInterface(self::COMMAND_INTERFACE)) { + $commands[] = new $class(); + } + } + } + } + } + + return $commands; + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/GeneratorTester.php b/old.vendor/chi-teck/drupal-code-generator/src/GeneratorTester.php new file mode 100644 index 00000000..359d0bbd --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/GeneratorTester.php @@ -0,0 +1,188 @@ +command = $command; + $this->commandTester = new CommandTester($this->command); + + $application = ApplicationFactory::create(); + $helper_set = $application->getHelperSet(); + $helper_set->set(new QuestionHelper()); + $application->add($this->command); + + $this->setDirectory(sys_get_temp_dir() . '/dcg_' . uniqid()); + } + + /** + * Getter for the directory. + * + * @return string + * The directory. + */ + public function getDirectory() { + return $this->directory; + } + + /** + * Setter for the directory. + * + * @param string $directory + * The directory. + */ + public function setDirectory($directory) { + $this->directory = $directory; + } + + /** + * Getter for the interaction. + * + * @return array + * The interaction. + */ + public function getInteraction() { + return $this->interaction; + } + + /** + * Setter for the interaction. + * + * @param array $interaction + * The interaction. + */ + public function setInteraction(array $interaction) { + $this->interaction = $interaction; + } + + /** + * Getter for the fixtures. + * + * @return array + * The fixtures. + */ + public function getFixtures() { + return $this->fixtures; + } + + /** + * Setter for the fixtures. + * + * @param array $fixtures + * The fixtures. + */ + public function setFixtures(array $fixtures) { + $this->fixtures = $fixtures; + } + + /** + * Executes the command. + * + * @return int + * The command exit code + */ + public function execute() { + return $this->commandTester + ->setInputs(array_values($this->interaction)) + ->execute(['--directory' => $this->getDirectory()]); + } + + /** + * Gets the display returned by the last execution of the command. + * + * @return string + * The display. + */ + public function getDisplay() { + return $this->commandTester->getDisplay(); + } + + /** + * Gets expected display. + * + * @return string + * Expected display. + */ + public function getExpectedDisplay() { + $default_name = Utils::machine2human(basename($this->directory)); + + $expected_display = "\n"; + $name = $this->command->getName(); + $title = "Welcome to $name generator!"; + $expected_display .= " $title\n"; + $expected_display .= str_repeat('–', strlen($title) + 2) . "\n"; + + foreach ($this->interaction as $question => $answer) { + $question = preg_replace('/^<\d*> /', '', $question); + $expected_display .= "\n"; + $expected_display .= " $question\n"; + // Regular question. + if (strpos($question, "\n") === FALSE) { + $expected_display .= " ➤ \n"; + } + // Choice question. + else { + $expected_display .= " ➤➤➤ \n"; + } + } + + $expected_display = str_replace('%default_name%', $default_name, $expected_display); + $default_machine_name = Utils::human2machine(basename($this->directory)); + $expected_display = str_replace('%default_machine_name%', $default_machine_name, $expected_display); + + $targets = implode("\n • ", array_keys($this->fixtures)); + $expected_display .= "\n"; + $expected_display .= " The following directories and files have been created or updated:\n"; + $expected_display .= "–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––\n"; + $expected_display .= " • $targets\n"; + $expected_display .= "\n"; + return $expected_display; + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Helper/Dumper.php b/old.vendor/chi-teck/drupal-code-generator/src/Helper/Dumper.php new file mode 100644 index 00000000..e59ba32a --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Helper/Dumper.php @@ -0,0 +1,186 @@ +filesystem = $filesystem; + $this->replace = $replace; + } + + /** + * {@inheritdoc} + */ + public function getName() { + return 'dcg_dumper'; + } + + /** + * Dumps the generated code to file system. + * + * @param \Symfony\Component\Console\Input\InputInterface $input + * Input instance. + * @param \Symfony\Component\Console\Output\OutputInterface $output + * Output instance. + * + * @return array + * List of created or updated files. + */ + public function dump(InputInterface $input, OutputInterface $output) { + $this->input = $input; + $this->output = $output; + $formatter_style = new OutputFormatterStyle('black', 'cyan', []); + $this->output->getFormatter()->setStyle('title', $formatter_style); + + $interactive = $input->isInteractive(); + + // NULL means we should ask user for confirmation. + if ($this->replace !== NULL) { + $input->setInteractive(FALSE); + } + + /** @var \DrupalCodeGenerator\Command\GeneratorInterface $command */ + $command = $this->getHelperSet()->getCommand(); + + $dumped_files = $this->doDump($command->getAssets(), $command->getDirectory()); + + $input->setInteractive($interactive); + return $dumped_files; + } + + /** + * Dumps assets. + * + * @param \DrupalCodeGenerator\Asset[] $assets + * Files to dump. + * @param string $directory + * Directory where to dump the assets. + * + * @return array + * List of created or updated assets. + */ + protected function doDump(array $assets, $directory) { + $dumped_files = []; + + foreach ($assets as $asset) { + + $content = $asset->getContent(); + $path = $asset->getPath(); + + $file_path = "$directory/$path"; + if ($this->filesystem->exists($file_path) && !$asset->isDirectory()) { + $action = $asset->getAction(); + if ($action == 'replace') { + $question_text = sprintf('The file %s already exists. Would you like to replace it? [Yes]:', $file_path); + if (!$this->confirm($question_text)) { + continue; + } + } + else { + $original_content = file_get_contents($file_path); + if ($action == 'append') { + $header_size = $asset->getHeaderSize(); + // Do not remove header if original file is empty. + if ($original_content && $header_size > 0) { + $content = Utils::removeHeader($content, $header_size); + } + $content = $original_content . "\n" . $content; + } + elseif (is_callable($action)) { + $content = $action($original_content, $content); + } + else { + throw new \LogicException("Unsupported action: $action."); + } + } + } + + // Default mode for all parent directories is 0777. It can be modified by + // changing umask. + $mode = $asset->getMode(); + + // Save data to file system. + if ($asset->isDirectory()) { + $this->filesystem->mkdir([$file_path], $mode); + } + else { + $this->filesystem->dumpFile($file_path, $content); + $this->filesystem->chmod($file_path, $mode); + } + + $dumped_files[] = $asset->getPath(); + } + + return $dumped_files; + } + + /** + * Asks a user for confirmation. + * + * @param string $question_text + * The question to ask to the user. + * + * @return bool + * User confirmation. + */ + protected function confirm($question_text) { + $question_text = "\n $question_text\n ➤ "; + // If the input is not interactive print the question with default answer. + if ($this->replace !== NULL) { + $this->output->writeln($question_text . ($this->replace ? 'Yes' : 'No')); + } + $question = new ConfirmationQuestion($question_text, $this->replace !== FALSE); + /** @var \Symfony\Component\Console\Helper\QuestionHelper $question_helper */ + $question_helper = $this->getHelperSet()->get('question'); + return $question_helper->ask($this->input, $this->output, $question); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Helper/InputHandler.php b/old.vendor/chi-teck/drupal-code-generator/src/Helper/InputHandler.php new file mode 100644 index 00000000..68b1cecb --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Helper/InputHandler.php @@ -0,0 +1,184 @@ +getOption('answers')) { + $answers = json_decode($answers_raw, TRUE); + if (!is_array($answers)) { + throw new InvalidOptionException('Answers should be encoded in JSON format.'); + } + } + + /** @var \Symfony\Component\Console\Helper\QuestionHelper $question_helper */ + $question_helper = $this->getHelperSet()->get('question'); + + /** @var \DrupalCodeGenerator\Command\GeneratorInterface $command */ + $command = $this->getHelperSet()->getCommand(); + $directory = $command->getDirectory(); + + foreach ($questions as $name => $question) { + + if (in_array($name, $this->askedQuestions)) { + continue; + } + $this->askedQuestions[] = $name; + + /** @var \Symfony\Component\Console\Question\Question $question */ + $default_value = $question->getDefault(); + + // Make some assumptions based on question name. + if ($default_value === NULL) { + switch ($name) { + case 'name': + $root_directory = basename(Utils::getExtensionRoot($directory) ?: $directory); + $default_value = Utils::machine2human($root_directory); + break; + + case 'machine_name': + $default_value = function (array $vars) use ($directory) { + return Utils::human2machine(isset($vars['name']) ? $vars['name'] : basename($directory)); + }; + break; + } + } + + // Turn the callback into a value acceptable for Symfony question helper. + if (is_callable($default_value)) { + // Do not treat simple strings as callable because they may match PHP + // builtin functions. + if (!is_string($default_value) || strpos('::', $default_value) !== FALSE) { + $default_value = call_user_func($default_value, $vars); + } + } + // Default value may have tokens. + $default_value = Utils::tokenReplace($default_value, $vars); + $this->setQuestionDefault($question, $default_value); + + if ($answers) { + if (array_key_exists($name, $answers)) { + $answer = $answers[$name]; + // Validate provided answer. + if ($validator = $question->getValidator()) { + $validator($answer); + } + // Turn 'yes/no' string into boolean. + if ($question instanceof ConfirmationQuestion && !is_bool($answer)) { + $answer = strcasecmp($answer, 'yes') == 0; + } + } + else { + $answer = $default_value; + } + } + else { + $this->formatQuestionText($question); + $answer = $question_helper->ask($input, $output, $question); + } + + $vars[$name] = $answer; + } + + return $vars; + } + + /** + * Formats question text. + * + * @param \Symfony\Component\Console\Question\Question $question + * The question. + */ + protected function formatQuestionText(Question $question) { + $question_text = $question->getQuestion(); + $default_value = $question->getDefault(); + + $question_text = "\n $question_text"; + if (is_bool($default_value)) { + $default_value = $default_value ? 'Yes' : 'No'; + } + if ($default_value) { + $question_text .= " [$default_value]"; + } + $question_text .= ":"; + if ($question instanceof ChoiceQuestion) { + $question->setPrompt(' ➤➤➤ '); + } + else { + $question_text .= "\n ➤ "; + } + + $this->setQuestionText($question, $question_text); + } + + /** + * Normalizes questions. + * + * @param \Symfony\Component\Console\Question\Question[] $questions + * Questions to normalize. + * + * @return \Symfony\Component\Console\Question\Question[] + * Normalized questions + * + * @deprecated + * Use Symfony\Component\Console\Question\Question to define questions. + * + * @codeCoverageIgnore + */ + protected function normalizeQuestions(array $questions) { + return array_map(function ($question) { + // Support array syntax. + if (is_array($question)) { + if (count($question) > 2) { + throw new \OutOfBoundsException('The question array is too long.'); + } + list($question_text, $default_value) = array_pad($question, 2, NULL); + $question = new Question($question_text, $default_value); + } + return $question; + }, $questions); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Helper/OutputHandler.php b/old.vendor/chi-teck/drupal-code-generator/src/Helper/OutputHandler.php new file mode 100644 index 00000000..f0b628c6 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Helper/OutputHandler.php @@ -0,0 +1,53 @@ + 0) { + // Multiple hooks can be dumped to the same file. + $dumped_files = array_unique($dumped_files); + + usort($dumped_files, function ($a, $b) { + $depth_a = substr_count($a, '/'); + $depth_b = substr_count($b, '/'); + // Top level files should be printed first. + return $depth_a == $depth_b || ($depth_a > 1 && $depth_b > 1) ? + strcmp($a, $b) : ($depth_a > $depth_b ? 1 : -1); + }); + + $output->writeln(''); + $output->writeln(' The following directories and files have been created or updated:'); + $output->writeln('–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––'); + foreach ($dumped_files as $file) { + $output->writeln(" • $file"); + } + $output->writeln(''); + } + + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Helper/QuestionSettersTrait.php b/old.vendor/chi-teck/drupal-code-generator/src/Helper/QuestionSettersTrait.php new file mode 100644 index 00000000..6f4405dc --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Helper/QuestionSettersTrait.php @@ -0,0 +1,48 @@ +__construct($question_text, $question->getChoices(), $question->getDefault()); + } + else { + $question->__construct($question_text, $question->getDefault()); + } + } + + /** + * Sets question default value. + * + * @param \Symfony\Component\Console\Question\Question $question + * The question to update. + * @param mixed $default_value + * Default value for the question. + */ + protected function setQuestionDefault(Question $question, $default_value) { + if ($question instanceof ChoiceQuestion) { + $question->__construct($question->getQuestion(), $question->getChoices(), $default_value); + } + else { + $question->__construct($question->getQuestion(), $default_value); + } + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Helper/Renderer.php b/old.vendor/chi-teck/drupal-code-generator/src/Helper/Renderer.php new file mode 100644 index 00000000..df81f21e --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Helper/Renderer.php @@ -0,0 +1,62 @@ +twig = $twig; + } + + /** + * {@inheritdoc} + */ + public function getName() { + return 'dcg_renderer'; + } + + /** + * Renders a template. + * + * @param string $template + * Twig template. + * @param array $vars + * Template variables. + * + * @return string + * A string representing the rendered output. + */ + public function render($template, array $vars) { + return $this->twig->render($template, $vars); + } + + /** + * Adds a path where templates are stored. + * + * @param string $path + * A path where to look for templates. + */ + public function addPath($path) { + return $this->twig->getLoader()->addPath($path); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/LegacyUtilsTrait.php b/old.vendor/chi-teck/drupal-code-generator/src/LegacyUtilsTrait.php new file mode 100644 index 00000000..9a66cd49 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/LegacyUtilsTrait.php @@ -0,0 +1,90 @@ +addFilter(new Twig_SimpleFilter('plural', [Utils::class, 'pluralize']), ['deprecated' => TRUE]); + + $this->addFilter(new Twig_SimpleFilter('pluralize', [Utils::class, 'pluralize'])); + + $this->addFilter(new Twig_SimpleFilter('article', function ($string) { + $article = in_array(strtolower($string[0]), ['a', 'e', 'i', 'o', 'u']) ? 'an' : 'a'; + return $article . ' ' . $string; + })); + + $this->addFilter(new Twig_SimpleFilter('underscore2hyphen', function ($string) { + // @codeCoverageIgnoreStart + return str_replace('_', '-', $string); + // @codeCoverageIgnoreEnd + }, ['deprecated' => TRUE])); + + $this->addFilter(new Twig_SimpleFilter('hyphen2underscore', function ($string) { + // @codeCoverageIgnoreStart + return str_replace('-', '_', $string); + // @codeCoverageIgnoreEnd + }, ['deprecated' => TRUE])); + + $this->addFilter(new Twig_SimpleFilter('u2h', function ($string) { + return str_replace('_', '-', $string); + })); + + $this->addFilter(new Twig_SimpleFilter('h2u', function ($string) { + return str_replace('-', '_', $string); + })); + + $this->addFilter(new Twig_SimpleFilter('camelize', function ($string, $upper_mode = TRUE) { + return Utils::camelize($string, $upper_mode); + })); + + $this->addTokenParser(new TwigSortTokenParser()); + } + + /** + * {@inheritdoc} + */ + public function tokenize($source, $name = NULL) { + if (!$source instanceof \Twig_Source) { + $source = new \Twig_Source($source, $name); + } + // Remove leading whitespaces to preserve indentation. + // @see https://github.com/twigphp/Twig/issues/1423 + $code = $source->getCode(); + if (strpos($code, '{% verbatim %}') === FALSE) { + $code = preg_replace("/\n +\{%/", "\n{%", $source->getCode()); + } + // Twig source has no setters. + $source = new \Twig_Source($code, $source->getName(), $source->getPath()); + return parent::tokenize($source, $name); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Twig/Twig2Environment.php b/old.vendor/chi-teck/drupal-code-generator/src/Twig/Twig2Environment.php new file mode 100644 index 00000000..1ab16f41 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Twig/Twig2Environment.php @@ -0,0 +1,75 @@ +addFilter(new TwigFilter('plural', [Utils::class, 'pluralize'], ['deprecated' => TRUE])); + $this->addFilter(new TwigFilter('pluralize', [Utils::class, 'pluralize'])); + + $this->addFilter(new TwigFilter('article', function ($string) { + $article = in_array(strtolower($string[0]), ['a', 'e', 'i', 'o', 'u']) ? 'an' : 'a'; + return $article . ' ' . $string; + })); + + $this->addFilter(new TwigFilter('underscore2hyphen', function ($string) { + // @codeCoverageIgnoreStart + return str_replace('_', '-', $string); + // @codeCoverageIgnoreEnd + }, ['deprecated' => TRUE])); + + $this->addFilter(new TwigFilter('hyphen2underscore', function ($string) { + // @codeCoverageIgnoreStart + return str_replace('-', '_', $string); + // @codeCoverageIgnoreEnd + }, ['deprecated' => TRUE])); + + $this->addFilter(new TwigFilter('u2h', function ($string) { + return str_replace('_', '-', $string); + })); + + $this->addFilter(new TwigFilter('h2u', function ($string) { + return str_replace('-', '_', $string); + })); + + $this->addFilter(new TwigFilter('camelize', function ($string, $upper_mode = TRUE) { + return Utils::camelize($string, $upper_mode); + })); + + $this->addTokenParser(new TwigSortTokenParser()); + } + + /** + * {@inheritdoc} + */ + public function tokenize(Source $source) { + // Remove leading whitespaces to preserve indentation. + // @see https://github.com/twigphp/Twig/issues/1423 + $code = $source->getCode(); + if (strpos($code, '{% verbatim %}') === FALSE) { + $code = preg_replace("/\n +\{%/", "\n{%", $source->getCode()); + } + // Twig source has no setters. + $source = new Source($code, $source->getName(), $source->getPath()); + return parent::tokenize($source); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Twig/TwigSortSetNode.php b/old.vendor/chi-teck/drupal-code-generator/src/Twig/TwigSortSetNode.php new file mode 100644 index 00000000..3d3c95ee --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Twig/TwigSortSetNode.php @@ -0,0 +1,27 @@ +addDebugInfo($this) + ->write("ob_start();\n") + ->subcompile($this->getNode('body')) + ->write('$data = explode("\n", ob_get_clean());' . "\n") + ->write('$data = array_unique($data);' . "\n") + ->write('sort($data);' . "\n") + ->write('echo ltrim(implode("\n", $data)) . "\n";' . "\n"); + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Twig/TwigSortTokenParser.php b/old.vendor/chi-teck/drupal-code-generator/src/Twig/TwigSortTokenParser.php new file mode 100644 index 00000000..d0e09a51 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Twig/TwigSortTokenParser.php @@ -0,0 +1,37 @@ +parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); + $body = $this->parser->subparse( + function (Twig_Token $token) { + return $token->test('endsort'); + }, + TRUE + ); + $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); + + return new TwigSortSetNode(['body' => $body], [], $token->getLine(), $this->getTag()); + } + + /** + * {@inheritdoc} + */ + public function getTag() { + return 'sort'; + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/Utils.php b/old.vendor/chi-teck/drupal-code-generator/src/Utils.php new file mode 100644 index 00000000..5da145a0 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/Utils.php @@ -0,0 +1,257 @@ +setValidator([Utils::class, 'validateRequired']); + $questions['machine_name'] = new Question('Module machine name'); + $questions['machine_name']->setValidator([Utils::class, 'validateMachineName']); + return $questions; + } + + /** + * Returns default questions for plugin generators. + * + * @return \Symfony\Component\Console\Question\Question[] + * Array of plugin questions. + */ + public static function pluginQuestions($class_suffix = '') { + $questions['plugin_label'] = new Question('Plugin label', 'Example'); + $questions['plugin_label']->setValidator([Utils::class, 'validateRequired']); + $questions['plugin_id'] = new Question('Plugin ID', [Utils::class, 'defaultPluginId']); + $questions['plugin_id']->setValidator([Utils::class, 'validateMachineName']); + $questions['class'] = static::pluginClassQuestion($class_suffix); + return $questions; + } + + /** + * Creates plugin class question. + */ + public static function pluginClassQuestion($suffix = '') { + $default_class = function ($vars) use ($suffix) { + $unprefixed_plugin_id = preg_replace('/^' . $vars['machine_name'] . '_/', '', $vars['plugin_id']); + return Utils::camelize($unprefixed_plugin_id) . $suffix; + }; + return new Question('Plugin class', $default_class); + } + + /** + * Returns extension root. + * + * @return string|bool + * Extension root directory or false if it was not found. + */ + public static function getExtensionRoot($directory) { + $extension_root = FALSE; + for ($i = 1; $i <= 5; $i++) { + $info_file = $directory . '/' . basename($directory) . '.info'; + if ((file_exists($info_file) && basename($directory) !== 'drush') || file_exists($info_file . '.yml')) { + $extension_root = $directory; + break; + } + $directory = dirname($directory); + } + return $extension_root; + } + + /** + * Removes a given number of lines from the beginning of the string. + */ + public static function removeHeader($content, $header_size) { + return implode("\n", array_slice(explode("\n", $content), $header_size)); + } + + /** + * Return the user's home directory. + */ + public static function getHomeDirectory() { + return isset($_SERVER['HOME']) ? $_SERVER['HOME'] : getenv('HOME'); + } + + /** + * Replaces all tokens in a given string with appropriate values. + * + * @param string $text + * A string potentially containing replaceable tokens. + * @param array $data + * An array where keys are token names and values are replacements. + * + * @return string + * Text with tokens replaced. + */ + public static function replaceTokens($text, array $data) { + $tokens = []; + foreach ($data as $var_name => $var) { + if (is_string($var)) { + $tokens['{' . $var_name . '}'] = $var; + } + } + return str_replace(array_keys($tokens), array_values($tokens), $text); + } + + /** + * Pluralizes a noun. + * + * @param string $string + * A noun to pluralize. + * + * @return string + * The pluralized noun. + */ + public static function pluralize($string) { + switch (substr($string, -1)) { + case 'y': + return substr($string, 0, -1) . 'ies'; + + case 's': + return $string . 'es'; + + default: + return $string . 's'; + } + } + + /** + * Prepares choices. + * + * @param array $raw_choices + * The choices to be prepared. + * + * @return array + * The prepared choices. + */ + public static function prepareChoices(array $raw_choices) { + // The $raw_choices can be an associative array. + $choices = array_values($raw_choices); + // Start choices list form '1'. + array_unshift($choices, NULL); + unset($choices[0]); + return $choices; + } + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/src/bootstrap.php b/old.vendor/chi-teck/drupal-code-generator/src/bootstrap.php new file mode 100644 index 00000000..b6685cee --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/src/bootstrap.php @@ -0,0 +1,53 @@ + 'textfield', + '#title' => t('Setting 1'), + '#default_value' => variable_get('{{ machine_name }}_setting_1'), + ); + $form['{{ machine_name }}_setting_2'] = array( + '#type' => 'select', + '#title' => t('Setting 1'), + '#options' => array(t('Option 1'), t('Option 2'), t('Option 3')), + '#default_value' => variable_get('{{ machine_name }}_setting_2'), + ); + $form['{{ machine_name }}_setting_3'] = array( + '#type' => 'checkbox', + '#title' => t('Setting 3'), + '#default_value' => variable_get('{{ machine_name }}_setting_3'), + ); + + return system_settings_form($form); +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/ctools-plugin/access.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/ctools-plugin/access.twig new file mode 100644 index 00000000..5ea49436 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/ctools-plugin/access.twig @@ -0,0 +1,53 @@ + TRUE, + 'title' => t('{{ plugin_name }}'), + 'description' => t('{{ description }}'), +{% if context == 'Node' or context == 'User' %} + 'required context' => new ctools_context_required(t('{{ context }}'), '{{ context|lower }}'), +{% elseif context == 'Term' %} + 'required context' => new ctools_context_required(t('{{ context }}'), array('term', 'taxonomy_term')), +{% endif %} + 'category' => t('{{ category }}'), + 'callback' => '{{ machine_name }}_{{ plugin_machine_name }}_access_check', + 'summary' => '{{ machine_name }}_{{ plugin_machine_name }}_access_summary', +); + +/** + * Access callback. + */ +function {{ machine_name }}_{{ plugin_machine_name }}_access_check($conf, $context) { +{% if context != '-' %} + + if (empty($context->data)) { + return; + } +{% endif %} + +{% if context == 'Node' or context == 'Term' %} + ${{ context|lower }} = clone $context->data; + +{% elseif context == 'User' %} +{# Use $account variable avoid confusion with the global $user object #} + $account = clone $context->data; + +{% endif %} + // @TODO: Check access here. + return TRUE; +} + +/** + * Summary callback. + */ +function {{ machine_name }}_{{ plugin_machine_name }}_access_summary($conf, $context) { + return t('Summary placeholder'); +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/ctools-plugin/content-type.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/ctools-plugin/content-type.twig new file mode 100644 index 00000000..26a53b97 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/ctools-plugin/content-type.twig @@ -0,0 +1,52 @@ + TRUE, + 'title' => t('{{ plugin_name }}'), + 'description' => t('{{ description }}'), +{% if context == 'Node' or context == 'User' %} + 'required context' => new ctools_context_required(t('{{ context }}'), '{{ context|lower }}'), +{% elseif context == 'Term' %} + 'required context' => new ctools_context_required(t('{{ context }}'), array('term', 'taxonomy_term')), +{% endif %} + 'category' => t('{{ category }}'), + 'render callback' => '{{ machine_name }}_{{ plugin_machine_name }}_content_type_render', +); + +/** + * Render callback. + */ +function {{ machine_name }}_{{ plugin_machine_name }}_content_type_render($subtype, $conf, $panel_args, $context) { +{% if context != '-' %} + + if (empty($context->data)) { + return; + } + +{% endif %} +{% if context == 'Node' or context == 'Term' %} + ${{ context|lower }} = clone $context->data; +{% elseif context == 'User' %} +{# Use $account variable to avoid confusion with the global $user object #} + $account = clone $context->data; +{% endif %} + + // Build pane content. + $build = array( + '#markup' => 'Content placeholder.', + ); + + $block = new stdClass(); + $block->module = '{{ machine_name }}'; + $block->title = t('Title placeholder'); + $block->content = $build; + return $block; +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/ctools-plugin/relationship.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/ctools-plugin/relationship.twig new file mode 100644 index 00000000..bd5fbc24 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/ctools-plugin/relationship.twig @@ -0,0 +1,44 @@ + t('{{ plugin_name }}'), + 'description' => t('{{ description }}'), +{% if context == 'Node' or context == 'User' %} + 'required context' => new ctools_context_required(t('{{ context }}'), '{{ context|lower }}'), +{% elseif context == 'Term' %} + 'required context' => new ctools_context_required(t('{{ context }}'), array('term', 'taxonomy_term')), +{% endif %} + 'context' => '{{ machine_name }}_{{ plugin_machine_name }}_context', +); + +/** +* Returns a new context based on an existing context. + */ +function {{ machine_name }}_{{ plugin_machine_name }}_context($context, $conf) { + + // @TODO: Replace "node" with identifier of the context + // this plugin is meant to provide. + if (empty($context->data)) { + return ctools_context_create_empty('node', NULL); + } + +{% if context == 'Node' or context == 'Term' %} + ${{ context|lower }} = clone $context->data; + +{% elseif context == 'User' %} +{# Use $account variable avoid confusion with the global $user object #} + $account = clone $context->data; + +{% endif %} + // @TODO: Replace this code with your own. + $related_node = node_load(1); + return ctools_context_create('node', $related_node); +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/file-docs/install.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/file-docs/install.twig new file mode 100644 index 00000000..d75b805d --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/file-docs/install.twig @@ -0,0 +1,6 @@ + array( + 'type' => 'comment', + 'label' => t('Unpublish comment'), + 'configurable' => FALSE, + 'behavior' => array('changes_property'), + 'triggers' => array('comment_presave', 'comment_insert', 'comment_update'), + ), + 'comment_unpublish_by_keyword_action' => array( + 'type' => 'comment', + 'label' => t('Unpublish comment containing keyword(s)'), + 'configurable' => TRUE, + 'behavior' => array('changes_property'), + 'triggers' => array('comment_presave', 'comment_insert', 'comment_update'), + ), + 'comment_save_action' => array( + 'type' => 'comment', + 'label' => t('Save comment'), + 'configurable' => FALSE, + 'triggers' => array('comment_insert', 'comment_update'), + ), + ); +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/action_info_alter.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/action_info_alter.twig new file mode 100644 index 00000000..601257c9 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/action_info_alter.twig @@ -0,0 +1,6 @@ +/** + * Implements hook_action_info_alter(). + */ +function {{ machine_name }}_action_info_alter(&$actions) { + $actions['node_unpublish_action']['label'] = t('Unpublish and remove from public view.'); +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/actions_delete.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/actions_delete.twig new file mode 100644 index 00000000..4bcbaba7 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/actions_delete.twig @@ -0,0 +1,8 @@ +/** + * Implements hook_actions_delete(). + */ +function {{ machine_name }}_actions_delete($aid) { + db_delete('actions_assignments') + ->condition('aid', $aid) + ->execute(); +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/admin_paths.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/admin_paths.twig new file mode 100644 index 00000000..bb7114c9 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/admin_paths.twig @@ -0,0 +1,10 @@ +/** + * Implements hook_admin_paths(). + */ +function {{ machine_name }}_admin_paths() { + $paths = array( + 'mymodule/*/add' => TRUE, + 'mymodule/*/edit' => TRUE, + ); + return $paths; +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/admin_paths_alter.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/admin_paths_alter.twig new file mode 100644 index 00000000..a66d25be --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/admin_paths_alter.twig @@ -0,0 +1,10 @@ +/** + * Implements hook_admin_paths_alter(). + */ +function {{ machine_name }}_admin_paths_alter(&$paths) { + // Treat all user pages as administrative. + $paths['user'] = TRUE; + $paths['user/*'] = TRUE; + // Treat the forum topic node form as a non-administrative page. + $paths['node/add/forum'] = FALSE; +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/aggregator_fetch.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/aggregator_fetch.twig new file mode 100644 index 00000000..073e94e9 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/aggregator_fetch.twig @@ -0,0 +1,6 @@ +/** + * Implements hook_aggregator_fetch(). + */ +function {{ machine_name }}_aggregator_fetch($feed) { + $feed->source_string = mymodule_fetch($feed->url); +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/aggregator_fetch_info.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/aggregator_fetch_info.twig new file mode 100644 index 00000000..0221b47f --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/aggregator_fetch_info.twig @@ -0,0 +1,9 @@ +/** + * Implements hook_aggregator_fetch_info(). + */ +function {{ machine_name }}_aggregator_fetch_info() { + return array( + 'title' => t('Default fetcher'), + 'description' => t('Default fetcher for resources available by URL.'), + ); +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/aggregator_parse.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/aggregator_parse.twig new file mode 100644 index 00000000..76c4eef0 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/aggregator_parse.twig @@ -0,0 +1,10 @@ +/** + * Implements hook_aggregator_parse(). + */ +function {{ machine_name }}_aggregator_parse($feed) { + if ($items = mymodule_parse($feed->source_string)) { + $feed->items = $items; + return TRUE; + } + return FALSE; +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/aggregator_parse_info.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/aggregator_parse_info.twig new file mode 100644 index 00000000..5db7fb17 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/aggregator_parse_info.twig @@ -0,0 +1,9 @@ +/** + * Implements hook_aggregator_parse_info(). + */ +function {{ machine_name }}_aggregator_parse_info() { + return array( + 'title' => t('Default parser'), + 'description' => t('Default parser for RSS, Atom and RDF feeds.'), + ); +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/aggregator_process.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/aggregator_process.twig new file mode 100644 index 00000000..9cd81624 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/aggregator_process.twig @@ -0,0 +1,8 @@ +/** + * Implements hook_aggregator_process(). + */ +function {{ machine_name }}_aggregator_process($feed) { + foreach ($feed->items as $item) { + mymodule_save($item); + } +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/aggregator_process_info.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/aggregator_process_info.twig new file mode 100644 index 00000000..695aca20 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/aggregator_process_info.twig @@ -0,0 +1,9 @@ +/** + * Implements hook_aggregator_process_info(). + */ +function {{ machine_name }}_aggregator_process_info() { + return array( + 'title' => t('Default processor'), + 'description' => t('Creates lightweight records of feed items.'), + ); +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/aggregator_remove.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/aggregator_remove.twig new file mode 100644 index 00000000..3664e035 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/aggregator_remove.twig @@ -0,0 +1,6 @@ +/** + * Implements hook_aggregator_remove(). + */ +function {{ machine_name }}_aggregator_remove($feed) { + mymodule_remove_items($feed->fid); +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/ajax_render_alter.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/ajax_render_alter.twig new file mode 100644 index 00000000..7d58b733 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/ajax_render_alter.twig @@ -0,0 +1,7 @@ +/** + * Implements hook_ajax_render_alter(). + */ +function {{ machine_name }}_ajax_render_alter(&$commands) { + // Inject any new status messages into the content area. + $commands[] = ajax_command_prepend('#block-system-main .content', theme('status_messages')); +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/archiver_info.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/archiver_info.twig new file mode 100644 index 00000000..aea3c513 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/archiver_info.twig @@ -0,0 +1,11 @@ +/** + * Implements hook_archiver_info(). + */ +function {{ machine_name }}_archiver_info() { + return array( + 'tar' => array( + 'class' => 'ArchiverTar', + 'extensions' => array('tar', 'tar.gz', 'tar.bz2'), + ), + ); +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/archiver_info_alter.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/archiver_info_alter.twig new file mode 100644 index 00000000..6fc23191 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/archiver_info_alter.twig @@ -0,0 +1,6 @@ +/** + * Implements hook_archiver_info_alter(). + */ +function {{ machine_name }}_archiver_info_alter(&$info) { + $info['tar']['extensions'][] = 'tgz'; +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/batch_alter.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/batch_alter.twig new file mode 100644 index 00000000..3bc30557 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/batch_alter.twig @@ -0,0 +1,15 @@ +/** + * Implements hook_batch_alter(). + */ +function {{ machine_name }}_batch_alter(&$batch) { + // If the current page request is inside the overlay, add ?render=overlay to + // the success callback URL, so that it appears correctly within the overlay. + if (overlay_get_mode() == 'child') { + if (isset($batch['url_options']['query'])) { + $batch['url_options']['query']['render'] = 'overlay'; + } + else { + $batch['url_options']['query'] = array('render' => 'overlay'); + } + } +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/block_cid_parts_alter.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/block_cid_parts_alter.twig new file mode 100644 index 00000000..49c13c22 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/block_cid_parts_alter.twig @@ -0,0 +1,8 @@ +/** + * Implements hook_block_cid_parts_alter(). + */ +function {{ machine_name }}_block_cid_parts_alter(&$cid_parts, $block) { + global $user; + // This example shows how to cache a block based on the user's timezone. + $cid_parts[] = $user->timezone; +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/block_configure.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/block_configure.twig new file mode 100644 index 00000000..dbf0b710 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/block_configure.twig @@ -0,0 +1,16 @@ +/** + * Implements hook_block_configure(). + */ +function {{ machine_name }}_block_configure($delta = '') { + // This example comes from node.module. + $form = array(); + if ($delta == 'recent') { + $form['node_recent_block_count'] = array( + '#type' => 'select', + '#title' => t('Number of recent content items to display'), + '#default_value' => variable_get('node_recent_block_count', 10), + '#options' => drupal_map_assoc(array(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 25, 30)), + ); + } + return $form; +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/block_info.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/block_info.twig new file mode 100644 index 00000000..6d160cd6 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/block_info.twig @@ -0,0 +1,17 @@ +/** + * Implements hook_block_info(). + */ +function {{ machine_name }}_block_info() { + // This example comes from node.module. + $blocks['syndicate'] = array( + 'info' => t('Syndicate'), + 'cache' => DRUPAL_NO_CACHE + ); + + $blocks['recent'] = array( + 'info' => t('Recent content'), + // DRUPAL_CACHE_PER_ROLE will be assumed. + ); + + return $blocks; +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/block_info_alter.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/block_info_alter.twig new file mode 100644 index 00000000..fb1d3552 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/block_info_alter.twig @@ -0,0 +1,7 @@ +/** + * Implements hook_block_info_alter(). + */ +function {{ machine_name }}_block_info_alter(&$blocks, $theme, $code_blocks) { + // Disable the login block. + $blocks['user']['login']['status'] = 0; +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/block_list_alter.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/block_list_alter.twig new file mode 100644 index 00000000..858d2887 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/block_list_alter.twig @@ -0,0 +1,35 @@ +/** + * Implements hook_block_list_alter(). + */ +function {{ machine_name }}_block_list_alter(&$blocks) { + global $language, $theme_key; + + // This example shows how to achieve language specific visibility setting for + // blocks. + + $result = db_query('SELECT module, delta, language FROM {my_table}'); + $block_languages = array(); + foreach ($result as $record) { + $block_languages[$record->module][$record->delta][$record->language] = TRUE; + } + + foreach ($blocks as $key => $block) { + // Any module using this alter should inspect the data before changing it, + // to ensure it is what they expect. + if (!isset($block->theme) || !isset($block->status) || $block->theme != $theme_key || $block->status != 1) { + // This block was added by a contrib module, leave it in the list. + continue; + } + + if (!isset($block_languages[$block->module][$block->delta])) { + // No language setting for this block, leave it in the list. + continue; + } + + if (!isset($block_languages[$block->module][$block->delta][$language->language])) { + // This block should not be displayed with the active language, remove + // from the list. + unset($blocks[$key]); + } + } +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/block_save.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/block_save.twig new file mode 100644 index 00000000..cd9d802c --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/block_save.twig @@ -0,0 +1,9 @@ +/** + * Implements hook_block_save(). + */ +function {{ machine_name }}_block_save($delta = '', $edit = array()) { + // This example comes from node.module. + if ($delta == 'recent') { + variable_set('node_recent_block_count', $edit['node_recent_block_count']); + } +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/block_view.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/block_view.twig new file mode 100644 index 00000000..a747b28e --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/block_view.twig @@ -0,0 +1,33 @@ +/** + * Implements hook_block_view(). + */ +function {{ machine_name }}_block_view($delta = '') { + // This example is adapted from node.module. + $block = array(); + + switch ($delta) { + case 'syndicate': + $block['subject'] = t('Syndicate'); + $block['content'] = array( + '#theme' => 'feed_icon', + '#url' => 'rss.xml', + '#title' => t('Syndicate'), + ); + break; + + case 'recent': + if (user_access('access content')) { + $block['subject'] = t('Recent content'); + if ($nodes = node_get_recent(variable_get('node_recent_block_count', 10))) { + $block['content'] = array( + '#theme' => 'node_recent_block', + '#nodes' => $nodes, + ); + } else { + $block['content'] = t('No content available.'); + } + } + break; + } + return $block; +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/block_view_MODULE_DELTA_alter.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/block_view_MODULE_DELTA_alter.twig new file mode 100644 index 00000000..22238583 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/block_view_MODULE_DELTA_alter.twig @@ -0,0 +1,12 @@ +/** + * Implements hook_block_view_MODULE_DELTA_alter(). + */ +function {{ machine_name }}_block_view_MODULE_DELTA_alter(&$data, $block) { + // This code will only run for a specific block. For example, if MODULE_DELTA + // in the function definition above is set to "mymodule_somedelta", the code + // will only run on the "somedelta" block provided by the "mymodule" module. + + // Change the title of the "somedelta" block provided by the "mymodule" + // module. + $data['subject'] = t('New title of the block'); +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/block_view_alter.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/block_view_alter.twig new file mode 100644 index 00000000..2ce77650 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/block_view_alter.twig @@ -0,0 +1,14 @@ +/** + * Implements hook_block_view_alter(). + */ +function {{ machine_name }}_block_view_alter(&$data, $block) { + // Remove the contextual links on all blocks that provide them. + if (is_array($data['content']) && isset($data['content']['#contextual_links'])) { + unset($data['content']['#contextual_links']); + } + // Add a theme wrapper function defined by the current module to all blocks + // provided by the "somemodule" module. + if (is_array($data['content']) && $block->module == 'somemodule') { + $data['content']['#theme_wrappers'][] = 'mymodule_special_block'; + } +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/boot.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/boot.twig new file mode 100644 index 00000000..bab9d8b2 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/boot.twig @@ -0,0 +1,8 @@ +/** + * Implements hook_boot(). + */ +function {{ machine_name }}_boot() { + // We need user_access() in the shutdown function. Make sure it gets loaded. + drupal_load('module', 'user'); + drupal_register_shutdown_function('devel_shutdown'); +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/comment_delete.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/comment_delete.twig new file mode 100644 index 00000000..0021116e --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/comment_delete.twig @@ -0,0 +1,6 @@ +/** + * Implements hook_comment_delete(). + */ +function {{ machine_name }}_comment_delete($comment) { + drupal_set_message(t('Comment: @subject has been deleted', array('@subject' => $comment->subject))); +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/comment_insert.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/comment_insert.twig new file mode 100644 index 00000000..1a367476 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/comment_insert.twig @@ -0,0 +1,7 @@ +/** + * Implements hook_comment_insert(). + */ +function {{ machine_name }}_comment_insert($comment) { + // Reindex the node when comments are added. + search_touch_node($comment->nid); +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/comment_load.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/comment_load.twig new file mode 100644 index 00000000..748fab85 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/comment_load.twig @@ -0,0 +1,9 @@ +/** + * Implements hook_comment_load(). + */ +function {{ machine_name }}_comment_load($comments) { + $result = db_query('SELECT cid, foo FROM {mytable} WHERE cid IN (:cids)', array(':cids' => array_keys($comments))); + foreach ($result as $record) { + $comments[$record->cid]->foo = $record->foo; + } +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/comment_presave.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/comment_presave.twig new file mode 100644 index 00000000..3f51a572 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/comment_presave.twig @@ -0,0 +1,7 @@ +/** + * Implements hook_comment_presave(). + */ +function {{ machine_name }}_comment_presave($comment) { + // Remove leading & trailing spaces from the comment subject. + $comment->subject = trim($comment->subject); +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/comment_publish.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/comment_publish.twig new file mode 100644 index 00000000..1b63f282 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/comment_publish.twig @@ -0,0 +1,6 @@ +/** + * Implements hook_comment_publish(). + */ +function {{ machine_name }}_comment_publish($comment) { + drupal_set_message(t('Comment: @subject has been published', array('@subject' => $comment->subject))); +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/comment_unpublish.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/comment_unpublish.twig new file mode 100644 index 00000000..03dcbfba --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/comment_unpublish.twig @@ -0,0 +1,6 @@ +/** + * Implements hook_comment_unpublish(). + */ +function {{ machine_name }}_comment_unpublish($comment) { + drupal_set_message(t('Comment: @subject has been unpublished', array('@subject' => $comment->subject))); +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/comment_update.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/comment_update.twig new file mode 100644 index 00000000..e9e025a3 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/comment_update.twig @@ -0,0 +1,7 @@ +/** + * Implements hook_comment_update(). + */ +function {{ machine_name }}_comment_update($comment) { + // Reindex the node when comments are updated. + search_touch_node($comment->nid); +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/comment_view.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/comment_view.twig new file mode 100644 index 00000000..4cd40991 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/comment_view.twig @@ -0,0 +1,7 @@ +/** + * Implements hook_comment_view(). + */ +function {{ machine_name }}_comment_view($comment, $view_mode, $langcode) { + // how old is the comment + $comment->time_ago = time() - $comment->changed; +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/comment_view_alter.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/comment_view_alter.twig new file mode 100644 index 00000000..d486a042 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/comment_view_alter.twig @@ -0,0 +1,13 @@ +/** + * Implements hook_comment_view_alter(). + */ +function {{ machine_name }}_comment_view_alter(&$build) { + // Check for the existence of a field added by another module. + if ($build['#view_mode'] == 'full' && isset($build['an_additional_field'])) { + // Change its weight. + $build['an_additional_field']['#weight'] = -10; + } + + // Add a #post_render callback to act on the rendered HTML of the comment. + $build['#post_render'][] = 'my_module_comment_post_render'; +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/contextual_links_view_alter.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/contextual_links_view_alter.twig new file mode 100644 index 00000000..68bacd9e --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/contextual_links_view_alter.twig @@ -0,0 +1,8 @@ +/** + * Implements hook_contextual_links_view_alter(). + */ +function {{ machine_name }}_contextual_links_view_alter(&$element, $items) { + // Add another class to all contextual link lists to facilitate custom + // styling. + $element['#attributes']['class'][] = 'custom-class'; +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/countries_alter.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/countries_alter.twig new file mode 100644 index 00000000..bff6dfa0 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/countries_alter.twig @@ -0,0 +1,7 @@ +/** + * Implements hook_countries_alter(). + */ +function {{ machine_name }}_countries_alter(&$countries) { + // Elbonia is now independent, so add it to the country list. + $countries['EB'] = 'Elbonia'; +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/cron.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/cron.twig new file mode 100644 index 00000000..16e90ed4 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/cron.twig @@ -0,0 +1,23 @@ +/** + * Implements hook_cron(). + */ +function {{ machine_name }}_cron() { + // Short-running operation example, not using a queue: + // Delete all expired records since the last cron run. + $expires = variable_get('mymodule_cron_last_run', REQUEST_TIME); + db_delete('mymodule_table') + ->condition('expires', $expires, '>=') + ->execute(); + variable_set('mymodule_cron_last_run', REQUEST_TIME); + + // Long-running operation example, leveraging a queue: + // Fetch feeds from other sites. + $result = db_query('SELECT * FROM {aggregator_feed} WHERE checked + refresh < :time AND refresh <> :never', array( + ':time' => REQUEST_TIME, + ':never' => AGGREGATOR_CLEAR_NEVER, + )); + $queue = DrupalQueue::get('aggregator_feeds'); + foreach ($result as $feed) { + $queue->createItem($feed); + } +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/cron_queue_info.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/cron_queue_info.twig new file mode 100644 index 00000000..b1e5fcb3 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/cron_queue_info.twig @@ -0,0 +1,10 @@ +/** + * Implements hook_cron_queue_info(). + */ +function {{ machine_name }}_cron_queue_info() { + $queues['aggregator_feeds'] = array( + 'worker callback' => 'aggregator_refresh', + 'time' => 60, + ); + return $queues; +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/cron_queue_info_alter.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/cron_queue_info_alter.twig new file mode 100644 index 00000000..e725c7af --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/cron_queue_info_alter.twig @@ -0,0 +1,8 @@ +/** + * Implements hook_cron_queue_info_alter(). + */ +function {{ machine_name }}_cron_queue_info_alter(&$queues) { + // This site has many feeds so let's spend 90 seconds on each cron run + // updating feeds instead of the default 60. + $queues['aggregator_feeds']['time'] = 90; +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/css_alter.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/css_alter.twig new file mode 100644 index 00000000..20a2c7bb --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/css_alter.twig @@ -0,0 +1,7 @@ +/** + * Implements hook_css_alter(). + */ +function {{ machine_name }}_css_alter(&$css) { + // Remove defaults.css file. + unset($css[drupal_get_path('module', 'system') . '/defaults.css']); +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/custom_theme.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/custom_theme.twig new file mode 100644 index 00000000..c9728a36 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/custom_theme.twig @@ -0,0 +1,9 @@ +/** + * Implements hook_custom_theme(). + */ +function {{ machine_name }}_custom_theme() { + // Allow the user to request a particular theme via a query parameter. + if (isset($_GET['theme'])) { + return $_GET['theme']; + } +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/dashboard_regions.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/dashboard_regions.twig new file mode 100644 index 00000000..eb21073e --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/dashboard_regions.twig @@ -0,0 +1,9 @@ +/** + * Implements hook_dashboard_regions(). + */ +function {{ machine_name }}_dashboard_regions() { + // Define a new dashboard region. Your module can also then define + // theme_mymodule_dashboard_region() as a theme wrapper function to control + // the region's appearance. + return array('mymodule_dashboard_region' => "My module's dashboard region"); +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/dashboard_regions_alter.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/dashboard_regions_alter.twig new file mode 100644 index 00000000..f7bfa513 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/dashboard_regions_alter.twig @@ -0,0 +1,7 @@ +/** + * Implements hook_dashboard_regions_alter(). + */ +function {{ machine_name }}_dashboard_regions_alter(&$regions) { + // Remove the sidebar region defined by the core dashboard module. + unset($regions['dashboard_sidebar']); +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/date_format_types.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/date_format_types.twig new file mode 100644 index 00000000..3cd5b8db --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/date_format_types.twig @@ -0,0 +1,11 @@ +/** + * Implements hook_date_format_types(). + */ +function {{ machine_name }}_date_format_types() { + // Define the core date format types. + return array( + 'long' => t('Long'), + 'medium' => t('Medium'), + 'short' => t('Short'), + ); +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/date_format_types_alter.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/date_format_types_alter.twig new file mode 100644 index 00000000..789b579f --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/date_format_types_alter.twig @@ -0,0 +1,8 @@ +/** + * Implements hook_date_format_types_alter(). + */ +function {{ machine_name }}_date_format_types_alter(&$types) { + foreach ($types as $name => $type) { + $types[$name]['locked'] = 1; + } +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/date_formats.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/date_formats.twig new file mode 100644 index 00000000..03a92a42 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/date_formats.twig @@ -0,0 +1,22 @@ +/** + * Implements hook_date_formats(). + */ +function {{ machine_name }}_date_formats() { + return array( + array( + 'type' => 'mymodule_extra_long', + 'format' => 'l jS F Y H:i:s e', + 'locales' => array('en-ie'), + ), + array( + 'type' => 'mymodule_extra_long', + 'format' => 'l jS F Y h:i:sa', + 'locales' => array('en', 'en-us'), + ), + array( + 'type' => 'short', + 'format' => 'F Y', + 'locales' => array(), + ), + ); +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/date_formats_alter.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/date_formats_alter.twig new file mode 100644 index 00000000..fdfd4aad --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/date_formats_alter.twig @@ -0,0 +1,8 @@ +/** + * Implements hook_date_formats_alter(). + */ +function {{ machine_name }}_date_formats_alter(&$formats) { + foreach ($formats as $id => $format) { + $formats[$id]['locales'][] = 'en-ca'; + } +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/delete.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/delete.twig new file mode 100644 index 00000000..f8de1ad1 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/delete.twig @@ -0,0 +1,8 @@ +/** + * Implements hook_delete(). + */ +function {{ machine_name }}_delete($node) { + db_delete('mytable') + ->condition('nid', $node->nid) + ->execute(); +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/disable.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/disable.twig new file mode 100644 index 00000000..8fe8269d --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/disable.twig @@ -0,0 +1,6 @@ +/** + * Implements hook_disable(). + */ +function {{ machine_name }}_disable() { + mymodule_cache_rebuild(); +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/drupal_goto_alter.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/drupal_goto_alter.twig new file mode 100644 index 00000000..d8785d4a --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/drupal_goto_alter.twig @@ -0,0 +1,7 @@ +/** + * Implements hook_drupal_goto_alter(). + */ +function {{ machine_name }}_drupal_goto_alter(&$path, &$options, &$http_response_code) { + // A good addition to misery module. + $http_response_code = 500; +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/element_info.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/element_info.twig new file mode 100644 index 00000000..5e58e980 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/element_info.twig @@ -0,0 +1,9 @@ +/** + * Implements hook_element_info(). + */ +function {{ machine_name }}_element_info() { + $types['filter_format'] = array( + '#input' => TRUE, + ); + return $types; +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/element_info_alter.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/element_info_alter.twig new file mode 100644 index 00000000..43d1cf12 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/element_info_alter.twig @@ -0,0 +1,9 @@ +/** + * Implements hook_element_info_alter(). + */ +function {{ machine_name }}_element_info_alter(&$type) { + // Decrease the default size of textfields. + if (isset($type['textfield']['#size'])) { + $type['textfield']['#size'] = 40; + } +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/enable.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/enable.twig new file mode 100644 index 00000000..a86432d7 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/enable.twig @@ -0,0 +1,6 @@ +/** + * Implements hook_enable(). + */ +function {{ machine_name }}_enable() { + mymodule_cache_rebuild(); +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/entity_delete.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/entity_delete.twig new file mode 100644 index 00000000..82c01594 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/entity_delete.twig @@ -0,0 +1,12 @@ +/** + * Implements hook_entity_delete(). + */ +function {{ machine_name }}_entity_delete($entity, $type) { + // Delete the entity's entry from a fictional table of all entities. + $info = entity_get_info($type); + list($id) = entity_extract_ids($type, $entity); + db_delete('example_entity') + ->condition('type', $type) + ->condition('id', $id) + ->execute(); +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/entity_info.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/entity_info.twig new file mode 100644 index 00000000..ffa0ca13 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/entity_info.twig @@ -0,0 +1,73 @@ +/** + * Implements hook_entity_info(). + */ +function {{ machine_name }}_entity_info() { + $return = array( + 'node' => array( + 'label' => t('Node'), + 'controller class' => 'NodeController', + 'base table' => 'node', + 'revision table' => 'node_revision', + 'uri callback' => 'node_uri', + 'fieldable' => TRUE, + 'translation' => array( + 'locale' => TRUE, + ), + 'entity keys' => array( + 'id' => 'nid', + 'revision' => 'vid', + 'bundle' => 'type', + 'language' => 'language', + ), + 'bundle keys' => array( + 'bundle' => 'type', + ), + 'bundles' => array(), + 'view modes' => array( + 'full' => array( + 'label' => t('Full content'), + 'custom settings' => FALSE, + ), + 'teaser' => array( + 'label' => t('Teaser'), + 'custom settings' => TRUE, + ), + 'rss' => array( + 'label' => t('RSS'), + 'custom settings' => FALSE, + ), + ), + ), + ); + + // Search integration is provided by node.module, so search-related + // view modes for nodes are defined here and not in search.module. + if (module_exists('search')) { + $return['node']['view modes'] += array( + 'search_index' => array( + 'label' => t('Search index'), + 'custom settings' => FALSE, + ), + 'search_result' => array( + 'label' => t('Search result highlighting input'), + 'custom settings' => FALSE, + ), + ); + } + + // Bundles must provide a human readable name so we can create help and error + // messages, and the path to attach Field admin pages to. + foreach (node_type_get_names() as $type => $name) { + $return['node']['bundles'][$type] = array( + 'label' => $name, + 'admin' => array( + 'path' => 'admin/structure/types/manage/%node_type', + 'real path' => 'admin/structure/types/manage/' . str_replace('_', '-', $type), + 'bundle argument' => 4, + 'access arguments' => array('administer content types'), + ), + ); + } + + return $return; +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/entity_info_alter.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/entity_info_alter.twig new file mode 100644 index 00000000..c89b6b4f --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/entity_info_alter.twig @@ -0,0 +1,8 @@ +/** + * Implements hook_entity_info_alter(). + */ +function {{ machine_name }}_entity_info_alter(&$entity_info) { + // Set the controller class for nodes to an alternate implementation of the + // DrupalEntityController interface. + $entity_info['node']['controller class'] = 'MyCustomNodeController'; +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/entity_insert.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/entity_insert.twig new file mode 100644 index 00000000..261e3079 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/entity_insert.twig @@ -0,0 +1,16 @@ +/** + * Implements hook_entity_insert(). + */ +function {{ machine_name }}_entity_insert($entity, $type) { + // Insert the new entity into a fictional table of all entities. + $info = entity_get_info($type); + list($id) = entity_extract_ids($type, $entity); + db_insert('example_entity') + ->fields(array( + 'type' => $type, + 'id' => $id, + 'created' => REQUEST_TIME, + 'updated' => REQUEST_TIME, + )) + ->execute(); +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/entity_load.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/entity_load.twig new file mode 100644 index 00000000..a5014723 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/entity_load.twig @@ -0,0 +1,8 @@ +/** + * Implements hook_entity_load(). + */ +function {{ machine_name }}_entity_load($entities, $type) { + foreach ($entities as $entity) { + $entity->foo = mymodule_add_something($entity, $type); + } +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/entity_prepare_view.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/entity_prepare_view.twig new file mode 100644 index 00000000..2ec0a2c9 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/entity_prepare_view.twig @@ -0,0 +1,12 @@ +/** + * Implements hook_entity_prepare_view(). + */ +function {{ machine_name }}_entity_prepare_view($entities, $type, $langcode) { + // Load a specific node into the user object for later theming. + if ($type == 'user') { + $nodes = mymodule_get_user_nodes(array_keys($entities)); + foreach ($entities as $uid => $entity) { + $entity->user_node = $nodes[$uid]; + } + } +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/entity_presave.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/entity_presave.twig new file mode 100644 index 00000000..c1d06554 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/entity_presave.twig @@ -0,0 +1,6 @@ +/** + * Implements hook_entity_presave(). + */ +function {{ machine_name }}_entity_presave($entity, $type) { + $entity->changed = REQUEST_TIME; +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/entity_query_alter.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/entity_query_alter.twig new file mode 100644 index 00000000..d6380aa2 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/entity_query_alter.twig @@ -0,0 +1,6 @@ +/** + * Implements hook_entity_query_alter(). + */ +function {{ machine_name }}_entity_query_alter($query) { + $query->executeCallback = 'my_module_query_callback'; +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/entity_update.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/entity_update.twig new file mode 100644 index 00000000..7b32e3ad --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/entity_update.twig @@ -0,0 +1,15 @@ +/** + * Implements hook_entity_update(). + */ +function {{ machine_name }}_entity_update($entity, $type) { + // Update the entity's entry in a fictional table of all entities. + $info = entity_get_info($type); + list($id) = entity_extract_ids($type, $entity); + db_update('example_entity') + ->fields(array( + 'updated' => REQUEST_TIME, + )) + ->condition('type', $type) + ->condition('id', $id) + ->execute(); +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/entity_view.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/entity_view.twig new file mode 100644 index 00000000..0d191b88 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/entity_view.twig @@ -0,0 +1,10 @@ +/** + * Implements hook_entity_view(). + */ +function {{ machine_name }}_entity_view($entity, $type, $view_mode, $langcode) { + $entity->content['my_additional_field'] = array( + '#markup' => $additional_field, + '#weight' => 10, + '#theme' => 'mymodule_my_additional_field', + ); +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/entity_view_alter.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/entity_view_alter.twig new file mode 100644 index 00000000..465a12a1 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/entity_view_alter.twig @@ -0,0 +1,12 @@ +/** + * Implements hook_entity_view_alter(). + */ +function {{ machine_name }}_entity_view_alter(&$build, $type) { + if ($build['#view_mode'] == 'full' && isset($build['an_additional_field'])) { + // Change its weight. + $build['an_additional_field']['#weight'] = -10; + + // Add a #post_render callback to act on the rendered HTML of the entity. + $build['#post_render'][] = 'my_module_node_post_render'; + } +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/entity_view_mode_alter.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/entity_view_mode_alter.twig new file mode 100644 index 00000000..c9e2cb71 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/entity_view_mode_alter.twig @@ -0,0 +1,9 @@ +/** + * Implements hook_entity_view_mode_alter(). + */ +function {{ machine_name }}_entity_view_mode_alter(&$view_mode, $context) { + // For nodes, change the view mode when it is teaser. + if ($context['entity_type'] == 'node' && $view_mode == 'teaser') { + $view_mode = 'my_custom_view_mode'; + } +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/exit.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/exit.twig new file mode 100644 index 00000000..0839b204 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/exit.twig @@ -0,0 +1,9 @@ +/** + * Implements hook_exit(). + */ +function {{ machine_name }}_exit($destination = NULL) { + db_update('counter') + ->expression('hits', 'hits + 1') + ->condition('type', 1) + ->execute(); +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_access.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_access.twig new file mode 100644 index 00000000..1d5ec7da --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_access.twig @@ -0,0 +1,9 @@ +/** + * Implements hook_field_access(). + */ +function {{ machine_name }}_field_access($op, $field, $entity_type, $entity, $account) { + if ($field['field_name'] == 'field_of_interest' && $op == 'edit') { + return user_access('edit field of interest', $account); + } + return TRUE; +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_attach_create_bundle.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_attach_create_bundle.twig new file mode 100644 index 00000000..85d27310 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_attach_create_bundle.twig @@ -0,0 +1,8 @@ +/** + * Implements hook_field_attach_create_bundle(). + */ +function {{ machine_name }}_field_attach_create_bundle($entity_type, $bundle) { + // When a new bundle is created, the menu needs to be rebuilt to add the + // Field UI menu item tabs. + variable_set('menu_rebuild_needed', TRUE); +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_attach_delete.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_attach_delete.twig new file mode 100644 index 00000000..dc0e57d2 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_attach_delete.twig @@ -0,0 +1,6 @@ +/** + * Implements hook_field_attach_delete(). + */ +function {{ machine_name }}_field_attach_delete($entity_type, $entity) { + // @todo Needs function body. +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_attach_delete_bundle.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_attach_delete_bundle.twig new file mode 100644 index 00000000..9a9ce948 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_attach_delete_bundle.twig @@ -0,0 +1,11 @@ +/** + * Implements hook_field_attach_delete_bundle(). + */ +function {{ machine_name }}_field_attach_delete_bundle($entity_type, $bundle, $instances) { + // Remove the extra weights variable information for this bundle. + $extra_weights = variable_get('field_extra_weights', array()); + if (isset($extra_weights[$entity_type][$bundle])) { + unset($extra_weights[$entity_type][$bundle]); + variable_set('field_extra_weights', $extra_weights); + } +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_attach_delete_revision.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_attach_delete_revision.twig new file mode 100644 index 00000000..c9faea50 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_attach_delete_revision.twig @@ -0,0 +1,6 @@ +/** + * Implements hook_field_attach_delete_revision(). + */ +function {{ machine_name }}_field_attach_delete_revision($entity_type, $entity) { + // @todo Needs function body. +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_attach_form.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_attach_form.twig new file mode 100644 index 00000000..a8cacbd4 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_attach_form.twig @@ -0,0 +1,11 @@ +/** + * Implements hook_field_attach_form(). + */ +function {{ machine_name }}_field_attach_form($entity_type, $entity, &$form, &$form_state, $langcode) { + // Add a checkbox allowing a given field to be emptied. + // See hook_field_attach_submit() for the corresponding processing code. + $form['empty_field_foo'] = array( + '#type' => 'checkbox', + '#title' => t("Empty the 'field_foo' field"), + ); +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_attach_insert.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_attach_insert.twig new file mode 100644 index 00000000..1d1add21 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_attach_insert.twig @@ -0,0 +1,6 @@ +/** + * Implements hook_field_attach_insert(). + */ +function {{ machine_name }}_field_attach_insert($entity_type, $entity) { + // @todo Needs function body. +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_attach_load.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_attach_load.twig new file mode 100644 index 00000000..3f97fa63 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_attach_load.twig @@ -0,0 +1,6 @@ +/** + * Implements hook_field_attach_load(). + */ +function {{ machine_name }}_field_attach_load($entity_type, $entities, $age, $options) { + // @todo Needs function body. +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_attach_prepare_translation_alter.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_attach_prepare_translation_alter.twig new file mode 100644 index 00000000..81f32aef --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_attach_prepare_translation_alter.twig @@ -0,0 +1,8 @@ +/** + * Implements hook_field_attach_prepare_translation_alter(). + */ +function {{ machine_name }}_field_attach_prepare_translation_alter(&$entity, $context) { + if ($context['entity_type'] == 'custom_entity_type') { + $entity->custom_field = $context['source_entity']->custom_field; + } +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_attach_preprocess_alter.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_attach_preprocess_alter.twig new file mode 100644 index 00000000..604e7f2e --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_attach_preprocess_alter.twig @@ -0,0 +1,6 @@ +/** + * Implements hook_field_attach_preprocess_alter(). + */ +function {{ machine_name }}_field_attach_preprocess_alter(&$variables, $context) { + // @todo Needs function body. +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_attach_presave.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_attach_presave.twig new file mode 100644 index 00000000..4ff40525 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_attach_presave.twig @@ -0,0 +1,6 @@ +/** + * Implements hook_field_attach_presave(). + */ +function {{ machine_name }}_field_attach_presave($entity_type, $entity) { + // @todo Needs function body. +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_attach_purge.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_attach_purge.twig new file mode 100644 index 00000000..dfb0425d --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_attach_purge.twig @@ -0,0 +1,9 @@ +/** + * Implements hook_field_attach_purge(). + */ +function {{ machine_name }}_field_attach_purge($entity_type, $entity, $field, $instance) { + // find the corresponding data in mymodule and purge it + if ($entity_type == 'node' && $field->field_name == 'my_field_name') { + mymodule_remove_mydata($entity->nid); + } +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_attach_rename_bundle.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_attach_rename_bundle.twig new file mode 100644 index 00000000..5fea27dc --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_attach_rename_bundle.twig @@ -0,0 +1,14 @@ +/** + * Implements hook_field_attach_rename_bundle(). + */ +function {{ machine_name }}_field_attach_rename_bundle($entity_type, $bundle_old, $bundle_new) { + // Update the extra weights variable with new information. + if ($bundle_old !== $bundle_new) { + $extra_weights = variable_get('field_extra_weights', array()); + if (isset($info[$entity_type][$bundle_old])) { + $extra_weights[$entity_type][$bundle_new] = $extra_weights[$entity_type][$bundle_old]; + unset($extra_weights[$entity_type][$bundle_old]); + variable_set('field_extra_weights', $extra_weights); + } + } +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_attach_submit.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_attach_submit.twig new file mode 100644 index 00000000..737e235b --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_attach_submit.twig @@ -0,0 +1,11 @@ +/** + * Implements hook_field_attach_submit(). + */ +function {{ machine_name }}_field_attach_submit($entity_type, $entity, $form, &$form_state) { + // Sample case of an 'Empty the field' checkbox added on the form, allowing + // a given field to be emptied. + $values = drupal_array_get_nested_value($form_state['values'], $form['#parents']); + if (!empty($values['empty_field_foo'])) { + unset($entity->field_foo); + } +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_attach_update.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_attach_update.twig new file mode 100644 index 00000000..c8c2e42e --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_attach_update.twig @@ -0,0 +1,6 @@ +/** + * Implements hook_field_attach_update(). + */ +function {{ machine_name }}_field_attach_update($entity_type, $entity) { + // @todo Needs function body. +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_attach_validate.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_attach_validate.twig new file mode 100644 index 00000000..31ba8389 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_attach_validate.twig @@ -0,0 +1,18 @@ +/** + * Implements hook_field_attach_validate(). + */ +function {{ machine_name }}_field_attach_validate($entity_type, $entity, &$errors) { + // Make sure any images in article nodes have an alt text. + if ($entity_type == 'node' && $entity->type == 'article' && !empty($entity->field_image)) { + foreach ($entity->field_image as $langcode => $items) { + foreach ($items as $delta => $item) { + if (!empty($item['fid']) && empty($item['alt'])) { + $errors['field_image'][$langcode][$delta][] = array( + 'error' => 'field_example_invalid', + 'message' => t('All images in articles need to have an alternative text set.'), + ); + } + } + } + } +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_attach_view_alter.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_attach_view_alter.twig new file mode 100644 index 00000000..f060e66e --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_attach_view_alter.twig @@ -0,0 +1,20 @@ +/** + * Implements hook_field_attach_view_alter(). + */ +function {{ machine_name }}_field_attach_view_alter(&$output, $context) { + // Append RDF term mappings on displayed taxonomy links. + foreach (element_children($output) as $field_name) { + $element = &$output[$field_name]; + if ($element['#field_type'] == 'taxonomy_term_reference' && $element['#formatter'] == 'taxonomy_term_reference_link') { + foreach ($element['#items'] as $delta => $item) { + $term = $item['taxonomy_term']; + if (!empty($term->rdf_mapping['rdftype'])) { + $element[$delta]['#options']['attributes']['typeof'] = $term->rdf_mapping['rdftype']; + } + if (!empty($term->rdf_mapping['name']['predicates'])) { + $element[$delta]['#options']['attributes']['property'] = $term->rdf_mapping['name']['predicates']; + } + } + } + } +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_available_languages_alter.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_available_languages_alter.twig new file mode 100644 index 00000000..85236bf9 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_available_languages_alter.twig @@ -0,0 +1,11 @@ +/** + * Implements hook_field_available_languages_alter(). + */ +function {{ machine_name }}_field_available_languages_alter(&$languages, $context) { + // Add an unavailable language. + $languages[] = 'xx'; + + // Remove an available language. + $index = array_search('yy', $languages); + unset($languages[$index]); +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_create_field.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_create_field.twig new file mode 100644 index 00000000..3df86bbd --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_create_field.twig @@ -0,0 +1,6 @@ +/** + * Implements hook_field_create_field(). + */ +function {{ machine_name }}_field_create_field($field) { + // @todo Needs function body. +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_create_instance.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_create_instance.twig new file mode 100644 index 00000000..b67a157d --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_create_instance.twig @@ -0,0 +1,6 @@ +/** + * Implements hook_field_create_instance(). + */ +function {{ machine_name }}_field_create_instance($instance) { + // @todo Needs function body. +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_delete.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_delete.twig new file mode 100644 index 00000000..807301a8 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_delete.twig @@ -0,0 +1,15 @@ +/** + * Implements hook_field_delete(). + */ +function {{ machine_name }}_field_delete($entity_type, $entity, $field, $instance, $langcode, &$items) { + list($id, $vid, $bundle) = entity_extract_ids($entity_type, $entity); + foreach ($items as $delta => $item) { + // For hook_file_references(), remember that this is being deleted. + $item['file_field_name'] = $field['field_name']; + // Pass in the ID of the object that is being removed so all references can + // be counted in hook_file_references(). + $item['file_field_type'] = $entity_type; + $item['file_field_id'] = $id; + file_field_delete_file($item, $field, $entity_type, $id); + } +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_delete_field.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_delete_field.twig new file mode 100644 index 00000000..24c042c7 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_delete_field.twig @@ -0,0 +1,6 @@ +/** + * Implements hook_field_delete_field(). + */ +function {{ machine_name }}_field_delete_field($field) { + // @todo Needs function body. +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_delete_instance.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_delete_instance.twig new file mode 100644 index 00000000..b431828f --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_delete_instance.twig @@ -0,0 +1,6 @@ +/** + * Implements hook_field_delete_instance(). + */ +function {{ machine_name }}_field_delete_instance($instance) { + // @todo Needs function body. +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_delete_revision.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_delete_revision.twig new file mode 100644 index 00000000..bbc0a5bf --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_delete_revision.twig @@ -0,0 +1,13 @@ +/** + * Implements hook_field_delete_revision(). + */ +function {{ machine_name }}_field_delete_revision($entity_type, $entity, $field, $instance, $langcode, &$items) { + list($id, $vid, $bundle) = entity_extract_ids($entity_type, $entity); + foreach ($items as $delta => $item) { + // For hook_file_references, remember that this file is being deleted. + $item['file_field_name'] = $field['field_name']; + if (file_field_delete_file($item, $field, $entity_type, $id)) { + $items[$delta] = NULL; + } + } +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_display_ENTITY_TYPE_alter.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_display_ENTITY_TYPE_alter.twig new file mode 100644 index 00000000..9c839720 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_display_ENTITY_TYPE_alter.twig @@ -0,0 +1,9 @@ +/** + * Implements hook_field_display_ENTITY_TYPE_alter(). + */ +function {{ machine_name }}_field_display_ENTITY_TYPE_alter(&$display, $context) { + // Leave field labels out of the search index. + if ($context['view_mode'] == 'search_index') { + $display['label'] = 'hidden'; + } +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_display_alter.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_display_alter.twig new file mode 100644 index 00000000..df864713 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_display_alter.twig @@ -0,0 +1,13 @@ +/** + * Implements hook_field_display_alter(). + */ +function {{ machine_name }}_field_display_alter(&$display, $context) { + // Leave field labels out of the search index. + // Note: The check against $context['entity_type'] == 'node' could be avoided + // by using hook_field_display_node_alter() instead of + // hook_field_display_alter(), resulting in less function calls when + // rendering non-node entities. + if ($context['entity_type'] == 'node' && $context['view_mode'] == 'search_index') { + $display['label'] = 'hidden'; + } +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_extra_fields.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_extra_fields.twig new file mode 100644 index 00000000..d8376bc7 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_extra_fields.twig @@ -0,0 +1,33 @@ +/** + * Implements hook_field_extra_fields(). + */ +function {{ machine_name }}_field_extra_fields() { + $extra['node']['poll'] = array( + 'form' => array( + 'choice_wrapper' => array( + 'label' => t('Poll choices'), + 'description' => t('Poll choices'), + 'weight' => -4, + ), + 'settings' => array( + 'label' => t('Poll settings'), + 'description' => t('Poll module settings'), + 'weight' => -3, + ), + ), + 'display' => array( + 'poll_view_voting' => array( + 'label' => t('Poll vote'), + 'description' => t('Poll vote'), + 'weight' => 0, + ), + 'poll_view_results' => array( + 'label' => t('Poll results'), + 'description' => t('Poll results'), + 'weight' => 0, + ), + ) + ); + + return $extra; +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_extra_fields_alter.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_extra_fields_alter.twig new file mode 100644 index 00000000..db1e5255 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_extra_fields_alter.twig @@ -0,0 +1,11 @@ +/** + * Implements hook_field_extra_fields_alter(). + */ +function {{ machine_name }}_field_extra_fields_alter(&$info) { + // Force node title to always be at the top of the list by default. + foreach (node_type_get_types() as $bundle) { + if (isset($info['node'][$bundle->type]['form']['title'])) { + $info['node'][$bundle->type]['form']['title']['weight'] = -20; + } + } +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_extra_fields_display_alter.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_extra_fields_display_alter.twig new file mode 100644 index 00000000..e78ca676 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_extra_fields_display_alter.twig @@ -0,0 +1,8 @@ +/** + * Implements hook_field_extra_fields_display_alter(). + */ +function {{ machine_name }}_field_extra_fields_display_alter(&$displays, $context) { + if ($context['entity_type'] == 'taxonomy_term' && $context['view_mode'] == 'full') { + $displays['description']['visible'] = FALSE; + } +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_formatter_info.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_formatter_info.twig new file mode 100644 index 00000000..cdb2ef08 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_formatter_info.twig @@ -0,0 +1,34 @@ +/** + * Implements hook_field_formatter_info(). + */ +function {{ machine_name }}_field_formatter_info() { + return array( + 'text_default' => array( + 'label' => t('Default'), + 'field types' => array('text', 'text_long', 'text_with_summary'), + ), + 'text_plain' => array( + 'label' => t('Plain text'), + 'field types' => array('text', 'text_long', 'text_with_summary'), + ), + + // The text_trimmed formatter displays the trimmed version of the + // full element of the field. It is intended to be used with text + // and text_long fields. It also works with text_with_summary + // fields though the text_summary_or_trimmed formatter makes more + // sense for that field type. + 'text_trimmed' => array( + 'label' => t('Trimmed'), + 'field types' => array('text', 'text_long', 'text_with_summary'), + ), + + // The 'summary or trimmed' field formatter for text_with_summary + // fields displays returns the summary element of the field or, if + // the summary is empty, the trimmed version of the full element + // of the field. + 'text_summary_or_trimmed' => array( + 'label' => t('Summary or trimmed'), + 'field types' => array('text_with_summary'), + ), + ); +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_formatter_info_alter.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_formatter_info_alter.twig new file mode 100644 index 00000000..10e0f7fb --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_formatter_info_alter.twig @@ -0,0 +1,12 @@ +/** + * Implements hook_field_formatter_info_alter(). + */ +function {{ machine_name }}_field_formatter_info_alter(&$info) { + // Add a setting to a formatter type. + $info['text_default']['settings'] += array( + 'mymodule_additional_setting' => 'default value', + ); + + // Let a new field type re-use an existing formatter. + $info['text_default']['field types'][] = 'my_field_type'; +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_formatter_prepare_view.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_formatter_prepare_view.twig new file mode 100644 index 00000000..1dab1351 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_formatter_prepare_view.twig @@ -0,0 +1,42 @@ +/** + * Implements hook_field_formatter_prepare_view(). + */ +function {{ machine_name }}_field_formatter_prepare_view($entity_type, $entities, $field, $instances, $langcode, &$items, $displays) { + $tids = array(); + + // Collect every possible term attached to any of the fieldable entities. + foreach ($entities as $id => $entity) { + foreach ($items[$id] as $delta => $item) { + // Force the array key to prevent duplicates. + $tids[$item['tid']] = $item['tid']; + } + } + + if ($tids) { + $terms = taxonomy_term_load_multiple($tids); + + // Iterate through the fieldable entities again to attach the loaded term + // data. + foreach ($entities as $id => $entity) { + $rekey = FALSE; + + foreach ($items[$id] as $delta => $item) { + // Check whether the taxonomy term field instance value could be loaded. + if (isset($terms[$item['tid']])) { + // Replace the instance value with the term data. + $items[$id][$delta]['taxonomy_term'] = $terms[$item['tid']]; + } + // Otherwise, unset the instance value, since the term does not exist. + else { + unset($items[$id][$delta]); + $rekey = TRUE; + } + } + + if ($rekey) { + // Rekey the items array. + $items[$id] = array_values($items[$id]); + } + } + } +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_formatter_settings_form.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_formatter_settings_form.twig new file mode 100644 index 00000000..632106a2 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_formatter_settings_form.twig @@ -0,0 +1,23 @@ +/** + * Implements hook_field_formatter_settings_form(). + */ +function {{ machine_name }}_field_formatter_settings_form($field, $instance, $view_mode, $form, &$form_state) { + $display = $instance['display'][$view_mode]; + $settings = $display['settings']; + + $element = array(); + + if ($display['type'] == 'text_trimmed' || $display['type'] == 'text_summary_or_trimmed') { + $element['trim_length'] = array( + '#title' => t('Length'), + '#type' => 'textfield', + '#size' => 20, + '#default_value' => $settings['trim_length'], + '#element_validate' => array('element_validate_integer_positive'), + '#required' => TRUE, + ); + } + + return $element; + +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_formatter_settings_summary.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_formatter_settings_summary.twig new file mode 100644 index 00000000..0c790d0a --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_formatter_settings_summary.twig @@ -0,0 +1,15 @@ +/** + * Implements hook_field_formatter_settings_summary(). + */ +function {{ machine_name }}_field_formatter_settings_summary($field, $instance, $view_mode) { + $display = $instance['display'][$view_mode]; + $settings = $display['settings']; + + $summary = ''; + + if ($display['type'] == 'text_trimmed' || $display['type'] == 'text_summary_or_trimmed') { + $summary = t('Length: @chars chars', array('@chars' => $settings['trim_length'])); + } + + return $summary; +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_formatter_view.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_formatter_view.twig new file mode 100644 index 00000000..3ccff4b4 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_formatter_view.twig @@ -0,0 +1,46 @@ +/** + * Implements hook_field_formatter_view(). + */ +function {{ machine_name }}_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) { + $element = array(); + $settings = $display['settings']; + + switch ($display['type']) { + case 'sample_field_formatter_simple': + // Common case: each value is displayed individually in a sub-element + // keyed by delta. The field.tpl.php template specifies the markup + // wrapping each value. + foreach ($items as $delta => $item) { + $element[$delta] = array('#markup' => $settings['some_setting'] . $item['value']); + } + break; + + case 'sample_field_formatter_themeable': + // More elaborate formatters can defer to a theme function for easier + // customization. + foreach ($items as $delta => $item) { + $element[$delta] = array( + '#theme' => 'mymodule_theme_sample_field_formatter_themeable', + '#data' => $item['value'], + '#some_setting' => $settings['some_setting'], + ); + } + break; + + case 'sample_field_formatter_combined': + // Some formatters might need to display all values within a single piece + // of markup. + $rows = array(); + foreach ($items as $delta => $item) { + $rows[] = array($delta, $item['value']); + } + $element[0] = array( + '#theme' => 'table', + '#header' => array(t('Delta'), t('Value')), + '#rows' => $rows, + ); + break; + } + + return $element; +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_info.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_info.twig new file mode 100644 index 00000000..3036d8b4 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_info.twig @@ -0,0 +1,31 @@ +/** + * Implements hook_field_info(). + */ +function {{ machine_name }}_field_info() { + return array( + 'text' => array( + 'label' => t('Text'), + 'description' => t('This field stores varchar text in the database.'), + 'settings' => array('max_length' => 255), + 'instance_settings' => array('text_processing' => 0), + 'default_widget' => 'text_textfield', + 'default_formatter' => 'text_default', + ), + 'text_long' => array( + 'label' => t('Long text'), + 'description' => t('This field stores long text in the database.'), + 'settings' => array('max_length' => ''), + 'instance_settings' => array('text_processing' => 0), + 'default_widget' => 'text_textarea', + 'default_formatter' => 'text_default', + ), + 'text_with_summary' => array( + 'label' => t('Long text and summary'), + 'description' => t('This field stores long text in the database along with optional summary text.'), + 'settings' => array('max_length' => ''), + 'instance_settings' => array('text_processing' => 1, 'display_summary' => 0), + 'default_widget' => 'text_textarea_with_summary', + 'default_formatter' => 'text_summary_or_trimmed', + ), + ); +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_info_alter.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_info_alter.twig new file mode 100644 index 00000000..00646428 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_info_alter.twig @@ -0,0 +1,16 @@ +/** + * Implements hook_field_info_alter(). + */ +function {{ machine_name }}_field_info_alter(&$info) { + // Add a setting to all field types. + foreach ($info as $field_type => $field_type_info) { + $info[$field_type]['settings'] += array( + 'mymodule_additional_setting' => 'default value', + ); + } + + // Change the default widget for fields of type 'foo'. + if (isset($info['foo'])) { + $info['foo']['default widget'] = 'mymodule_widget'; + } +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_info_max_weight.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_info_max_weight.twig new file mode 100644 index 00000000..e0579b93 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_info_max_weight.twig @@ -0,0 +1,12 @@ +/** + * Implements hook_field_info_max_weight(). + */ +function {{ machine_name }}_field_info_max_weight($entity_type, $bundle, $context) { + $weights = array(); + + foreach (my_module_entity_additions($entity_type, $bundle, $context) as $addition) { + $weights[] = $addition['weight']; + } + + return $weights ? max($weights) : NULL; +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_insert.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_insert.twig new file mode 100644 index 00000000..a164ab47 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_insert.twig @@ -0,0 +1,17 @@ +/** + * Implements hook_field_insert(). + */ +function {{ machine_name }}_field_insert($entity_type, $entity, $field, $instance, $langcode, &$items) { + if (variable_get('taxonomy_maintain_index_table', TRUE) && $field['storage']['type'] == 'field_sql_storage' && $entity_type == 'node' && $entity->status) { + $query = db_insert('taxonomy_index')->fields(array('nid', 'tid', 'sticky', 'created', )); + foreach ($items as $item) { + $query->values(array( + 'nid' => $entity->nid, + 'tid' => $item['tid'], + 'sticky' => $entity->sticky, + 'created' => $entity->created, + )); + } + $query->execute(); + } +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_instance_settings_form.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_instance_settings_form.twig new file mode 100644 index 00000000..6a432010 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_instance_settings_form.twig @@ -0,0 +1,30 @@ +/** + * Implements hook_field_instance_settings_form(). + */ +function {{ machine_name }}_field_instance_settings_form($field, $instance) { + $settings = $instance['settings']; + + $form['text_processing'] = array( + '#type' => 'radios', + '#title' => t('Text processing'), + '#default_value' => $settings['text_processing'], + '#options' => array( + t('Plain text'), + t('Filtered text (user selects text format)'), + ), + ); + if ($field['type'] == 'text_with_summary') { + $form['display_summary'] = array( + '#type' => 'select', + '#title' => t('Display summary'), + '#options' => array( + t('No'), + t('Yes'), + ), + '#description' => t('Display the summary to allow the user to input a summary value. Hide the summary to automatically fill it with a trimmed portion from the main post.'), + '#default_value' => !empty($settings['display_summary']) ? $settings['display_summary'] : 0, + ); + } + + return $form; +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_is_empty.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_is_empty.twig new file mode 100644 index 00000000..d228eb80 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_is_empty.twig @@ -0,0 +1,9 @@ +/** + * Implements hook_field_is_empty(). + */ +function {{ machine_name }}_field_is_empty($item, $field) { + if (empty($item['value']) && (string) $item['value'] !== '0') { + return TRUE; + } + return FALSE; +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_language_alter.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_language_alter.twig new file mode 100644 index 00000000..993676f2 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_language_alter.twig @@ -0,0 +1,10 @@ +/** + * Implements hook_field_language_alter(). + */ +function {{ machine_name }}_field_language_alter(&$display_language, $context) { + // Do not apply core language fallback rules if they are disabled or if Locale + // is not registered as a translation handler. + if (variable_get('locale_field_language_fallback', TRUE) && field_has_translation_handler($context['entity_type'], 'locale')) { + locale_field_language_fallback($display_language, $context['entity'], $context['language']); + } +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_load.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_load.twig new file mode 100644 index 00000000..c5d1a1dd --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_load.twig @@ -0,0 +1,19 @@ +/** + * Implements hook_field_load(). + */ +function {{ machine_name }}_field_load($entity_type, $entities, $field, $instances, $langcode, &$items, $age) { + // Sample code from text.module: precompute sanitized strings so they are + // stored in the field cache. + foreach ($entities as $id => $entity) { + foreach ($items[$id] as $delta => $item) { + // Only process items with a cacheable format, the rest will be handled + // by formatters if needed. + if (empty($instances[$id]['settings']['text_processing']) || filter_format_allowcache($item['format'])) { + $items[$id][$delta]['safe_value'] = isset($item['value']) ? _text_sanitize($instances[$id], $langcode, $item, 'value') : ''; + if ($field['type'] == 'text_with_summary') { + $items[$id][$delta]['safe_summary'] = isset($item['summary']) ? _text_sanitize($instances[$id], $langcode, $item, 'summary') : ''; + } + } + } + } +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_prepare_translation.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_prepare_translation.twig new file mode 100644 index 00000000..6eacc519 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_prepare_translation.twig @@ -0,0 +1,13 @@ +/** + * Implements hook_field_prepare_translation(). + */ +function {{ machine_name }}_field_prepare_translation($entity_type, $entity, $field, $instance, $langcode, &$items, $source_entity, $source_langcode) { + // If the translating user is not permitted to use the assigned text format, + // we must not expose the source values. + $field_name = $field['field_name']; + $formats = filter_formats(); + $format_id = $source_entity->{$field_name}[$source_langcode][0]['format']; + if (!filter_access($formats[$format_id])) { + $items = array(); + } +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_prepare_view.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_prepare_view.twig new file mode 100644 index 00000000..bb44e133 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_prepare_view.twig @@ -0,0 +1,18 @@ +/** + * Implements hook_field_prepare_view(). + */ +function {{ machine_name }}_field_prepare_view($entity_type, $entities, $field, $instances, $langcode, &$items) { + // Sample code from image.module: if there are no images specified at all, + // use the default image. + foreach ($entities as $id => $entity) { + if (empty($items[$id]) && $field['settings']['default_image']) { + if ($file = file_load($field['settings']['default_image'])) { + $items[$id][0] = (array) $file + array( + 'is_default' => TRUE, + 'alt' => '', + 'title' => '', + ); + } + } + } +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_presave.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_presave.twig new file mode 100644 index 00000000..342b680b --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_presave.twig @@ -0,0 +1,14 @@ +/** + * Implements hook_field_presave(). + */ +function {{ machine_name }}_field_presave($entity_type, $entity, $field, $instance, $langcode, &$items) { + if ($field['type'] == 'number_decimal') { + // Let PHP round the value to ensure consistent behavior across storage + // backends. + foreach ($items as $delta => $item) { + if (isset($item['value'])) { + $items[$delta]['value'] = round($item['value'], $field['settings']['scale']); + } + } + } +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_purge_field.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_purge_field.twig new file mode 100644 index 00000000..18f3fb41 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_purge_field.twig @@ -0,0 +1,8 @@ +/** + * Implements hook_field_purge_field(). + */ +function {{ machine_name }}_field_purge_field($field) { + db_delete('my_module_field_info') + ->condition('id', $field['id']) + ->execute(); +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_purge_instance.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_purge_instance.twig new file mode 100644 index 00000000..120bb8e4 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_purge_instance.twig @@ -0,0 +1,8 @@ +/** + * Implements hook_field_purge_instance(). + */ +function {{ machine_name }}_field_purge_instance($instance) { + db_delete('my_module_field_instance_info') + ->condition('id', $instance['id']) + ->execute(); +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_read_field.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_read_field.twig new file mode 100644 index 00000000..bd2962d1 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_read_field.twig @@ -0,0 +1,6 @@ +/** + * Implements hook_field_read_field(). + */ +function {{ machine_name }}_field_read_field($field) { + // @todo Needs function body. +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_read_instance.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_read_instance.twig new file mode 100644 index 00000000..71c969b9 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_read_instance.twig @@ -0,0 +1,6 @@ +/** + * Implements hook_field_read_instance(). + */ +function {{ machine_name }}_field_read_instance($instance) { + // @todo Needs function body. +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_schema.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_schema.twig new file mode 100644 index 00000000..4ac78da8 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_schema.twig @@ -0,0 +1,42 @@ +/** + * Implements hook_field_schema(). + */ +function {{ machine_name }}_field_schema($field) { + if ($field['type'] == 'text_long') { + $columns = array( + 'value' => array( + 'type' => 'text', + 'size' => 'big', + 'not null' => FALSE, + ), + ); + } + else { + $columns = array( + 'value' => array( + 'type' => 'varchar', + 'length' => $field['settings']['max_length'], + 'not null' => FALSE, + ), + ); + } + $columns += array( + 'format' => array( + 'type' => 'varchar', + 'length' => 255, + 'not null' => FALSE, + ), + ); + return array( + 'columns' => $columns, + 'indexes' => array( + 'format' => array('format'), + ), + 'foreign keys' => array( + 'format' => array( + 'table' => 'filter_format', + 'columns' => array('format' => 'format'), + ), + ), + ); +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_settings_form.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_settings_form.twig new file mode 100644 index 00000000..fb8d5c81 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_settings_form.twig @@ -0,0 +1,15 @@ +/** + * Implements hook_field_settings_form(). + */ +function {{ machine_name }}_field_settings_form($field, $instance, $has_data) { + $settings = $field['settings']; + $form['max_length'] = array( + '#type' => 'textfield', + '#title' => t('Maximum length'), + '#default_value' => $settings['max_length'], + '#required' => FALSE, + '#element_validate' => array('element_validate_integer_positive'), + '#description' => t('The maximum length of the field in characters. Leave blank for an unlimited size.'), + ); + return $form; +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_storage_create_field.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_storage_create_field.twig new file mode 100644 index 00000000..7aa884f5 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_storage_create_field.twig @@ -0,0 +1,10 @@ +/** + * Implements hook_field_storage_create_field(). + */ +function {{ machine_name }}_field_storage_create_field($field) { + $schema = _field_sql_storage_schema($field); + foreach ($schema as $name => $table) { + db_create_table($name, $table); + } + drupal_get_schema(NULL, TRUE); +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_storage_delete.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_storage_delete.twig new file mode 100644 index 00000000..089c8d40 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_storage_delete.twig @@ -0,0 +1,13 @@ +/** + * Implements hook_field_storage_delete(). + */ +function {{ machine_name }}_field_storage_delete($entity_type, $entity, $fields) { + list($id, $vid, $bundle) = entity_extract_ids($entity_type, $entity); + + foreach (field_info_instances($entity_type, $bundle) as $instance) { + if (isset($fields[$instance['field_id']])) { + $field = field_info_field_by_id($instance['field_id']); + field_sql_storage_field_storage_purge($entity_type, $entity, $field, $instance); + } + } +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_storage_delete_field.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_storage_delete_field.twig new file mode 100644 index 00000000..610de3f4 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_storage_delete_field.twig @@ -0,0 +1,20 @@ +/** + * Implements hook_field_storage_delete_field(). + */ +function {{ machine_name }}_field_storage_delete_field($field) { + // Mark all data associated with the field for deletion. + $field['deleted'] = 0; + $table = _field_sql_storage_tablename($field); + $revision_table = _field_sql_storage_revision_tablename($field); + db_update($table) + ->fields(array('deleted' => 1)) + ->execute(); + + // Move the table to a unique name while the table contents are being deleted. + $field['deleted'] = 1; + $new_table = _field_sql_storage_tablename($field); + $revision_new_table = _field_sql_storage_revision_tablename($field); + db_rename_table($table, $new_table); + db_rename_table($revision_table, $revision_new_table); + drupal_get_schema(NULL, TRUE); +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_storage_delete_instance.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_storage_delete_instance.twig new file mode 100644 index 00000000..f796835c --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_storage_delete_instance.twig @@ -0,0 +1,18 @@ +/** + * Implements hook_field_storage_delete_instance(). + */ +function {{ machine_name }}_field_storage_delete_instance($instance) { + $field = field_info_field($instance['field_name']); + $table_name = _field_sql_storage_tablename($field); + $revision_name = _field_sql_storage_revision_tablename($field); + db_update($table_name) + ->fields(array('deleted' => 1)) + ->condition('entity_type', $instance['entity_type']) + ->condition('bundle', $instance['bundle']) + ->execute(); + db_update($revision_name) + ->fields(array('deleted' => 1)) + ->condition('entity_type', $instance['entity_type']) + ->condition('bundle', $instance['bundle']) + ->execute(); +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_storage_delete_revision.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_storage_delete_revision.twig new file mode 100644 index 00000000..2d99caef --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_storage_delete_revision.twig @@ -0,0 +1,18 @@ +/** + * Implements hook_field_storage_delete_revision(). + */ +function {{ machine_name }}_field_storage_delete_revision($entity_type, $entity, $fields) { + list($id, $vid, $bundle) = entity_extract_ids($entity_type, $entity); + + if (isset($vid)) { + foreach ($fields as $field_id) { + $field = field_info_field_by_id($field_id); + $revision_name = _field_sql_storage_revision_tablename($field); + db_delete($revision_name) + ->condition('entity_type', $entity_type) + ->condition('entity_id', $id) + ->condition('revision_id', $vid) + ->execute(); + } + } +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_storage_details.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_storage_details.twig new file mode 100644 index 00000000..2c72e67e --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_storage_details.twig @@ -0,0 +1,22 @@ +/** + * Implements hook_field_storage_details(). + */ +function {{ machine_name }}_field_storage_details($field) { + $details = array(); + + // Add field columns. + foreach ((array) $field['columns'] as $column_name => $attributes) { + $real_name = _field_sql_storage_columnname($field['field_name'], $column_name); + $columns[$column_name] = $real_name; + } + return array( + 'sql' => array( + FIELD_LOAD_CURRENT => array( + _field_sql_storage_tablename($field) => $columns, + ), + FIELD_LOAD_REVISION => array( + _field_sql_storage_revision_tablename($field) => $columns, + ), + ), + ); +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_storage_details_alter.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_storage_details_alter.twig new file mode 100644 index 00000000..8d9d248b --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_storage_details_alter.twig @@ -0,0 +1,19 @@ +/** + * Implements hook_field_storage_details_alter(). + */ +function {{ machine_name }}_field_storage_details_alter(&$details, $field) { + if ($field['field_name'] == 'field_of_interest') { + $columns = array(); + foreach ((array) $field['columns'] as $column_name => $attributes) { + $columns[$column_name] = $column_name; + } + $details['drupal_variables'] = array( + FIELD_LOAD_CURRENT => array( + 'moon' => $columns, + ), + FIELD_LOAD_REVISION => array( + 'mars' => $columns, + ), + ); + } +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_storage_info.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_storage_info.twig new file mode 100644 index 00000000..54ac287f --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_storage_info.twig @@ -0,0 +1,12 @@ +/** + * Implements hook_field_storage_info(). + */ +function {{ machine_name }}_field_storage_info() { + return array( + 'field_sql_storage' => array( + 'label' => t('Default SQL storage'), + 'description' => t('Stores fields in the local SQL database, using per-field tables.'), + 'settings' => array(), + ), + ); +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_storage_info_alter.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_storage_info_alter.twig new file mode 100644 index 00000000..8b816001 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_storage_info_alter.twig @@ -0,0 +1,9 @@ +/** + * Implements hook_field_storage_info_alter(). + */ +function {{ machine_name }}_field_storage_info_alter(&$info) { + // Add a setting to a storage type. + $info['field_sql_storage']['settings'] += array( + 'mymodule_additional_setting' => 'default value', + ); +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_storage_load.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_storage_load.twig new file mode 100644 index 00000000..0eb4b5a8 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_storage_load.twig @@ -0,0 +1,50 @@ +/** + * Implements hook_field_storage_load(). + */ +function {{ machine_name }}_field_storage_load($entity_type, $entities, $age, $fields, $options) { + $load_current = $age == FIELD_LOAD_CURRENT; + + foreach ($fields as $field_id => $ids) { + // By the time this hook runs, the relevant field definitions have been + // populated and cached in FieldInfo, so calling field_info_field_by_id() + // on each field individually is more efficient than loading all fields in + // memory upfront with field_info_field_by_ids(). + $field = field_info_field_by_id($field_id); + $field_name = $field['field_name']; + $table = $load_current ? _field_sql_storage_tablename($field) : _field_sql_storage_revision_tablename($field); + + $query = db_select($table, 't') + ->fields('t') + ->condition('entity_type', $entity_type) + ->condition($load_current ? 'entity_id' : 'revision_id', $ids, 'IN') + ->condition('language', field_available_languages($entity_type, $field), 'IN') + ->orderBy('delta'); + + if (empty($options['deleted'])) { + $query->condition('deleted', 0); + } + + $results = $query->execute(); + + $delta_count = array(); + foreach ($results as $row) { + if (!isset($delta_count[$row->entity_id][$row->language])) { + $delta_count[$row->entity_id][$row->language] = 0; + } + + if ($field['cardinality'] == FIELD_CARDINALITY_UNLIMITED || $delta_count[$row->entity_id][$row->language] < $field['cardinality']) { + $item = array(); + // For each column declared by the field, populate the item + // from the prefixed database column. + foreach ($field['columns'] as $column => $attributes) { + $column_name = _field_sql_storage_columnname($field_name, $column); + $item[$column] = $row->$column_name; + } + + // Add the item to the field values for the entity. + $entities[$row->entity_id]->{$field_name}[$row->language][] = $item; + $delta_count[$row->entity_id][$row->language]++; + } + } + } +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_storage_pre_insert.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_storage_pre_insert.twig new file mode 100644 index 00000000..aa100dfb --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_storage_pre_insert.twig @@ -0,0 +1,22 @@ +/** + * Implements hook_field_storage_pre_insert(). + */ +function {{ machine_name }}_field_storage_pre_insert($entity_type, $entity, &$skip_fields) { + if ($entity_type == 'node' && $entity->status && _forum_node_check_node_type($entity)) { + $query = db_insert('forum_index')->fields(array('nid', 'title', 'tid', 'sticky', 'created', 'comment_count', 'last_comment_timestamp')); + foreach ($entity->taxonomy_forums as $language) { + foreach ($language as $delta) { + $query->values(array( + 'nid' => $entity->nid, + 'title' => $entity->title, + 'tid' => $delta['value'], + 'sticky' => $entity->sticky, + 'created' => $entity->created, + 'comment_count' => 0, + 'last_comment_timestamp' => $entity->created, + )); + } + } + $query->execute(); + } +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_storage_pre_load.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_storage_pre_load.twig new file mode 100644 index 00000000..1f12dd0a --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_storage_pre_load.twig @@ -0,0 +1,6 @@ +/** + * Implements hook_field_storage_pre_load(). + */ +function {{ machine_name }}_field_storage_pre_load($entity_type, $entities, $age, &$skip_fields, $options) { + // @todo Needs function body. +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_storage_pre_update.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_storage_pre_update.twig new file mode 100644 index 00000000..7e48fc77 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_storage_pre_update.twig @@ -0,0 +1,37 @@ +/** + * Implements hook_field_storage_pre_update(). + */ +function {{ machine_name }}_field_storage_pre_update($entity_type, $entity, &$skip_fields) { + $first_call = &drupal_static(__FUNCTION__, array()); + + if ($entity_type == 'node' && $entity->status && _forum_node_check_node_type($entity)) { + // We don't maintain data for old revisions, so clear all previous values + // from the table. Since this hook runs once per field, per entity, make + // sure we only wipe values once. + if (!isset($first_call[$entity->nid])) { + $first_call[$entity->nid] = FALSE; + db_delete('forum_index')->condition('nid', $entity->nid)->execute(); + } + // Only save data to the table if the node is published. + if ($entity->status) { + $query = db_insert('forum_index')->fields(array('nid', 'title', 'tid', 'sticky', 'created', 'comment_count', 'last_comment_timestamp')); + foreach ($entity->taxonomy_forums as $language) { + foreach ($language as $delta) { + $query->values(array( + 'nid' => $entity->nid, + 'title' => $entity->title, + 'tid' => $delta['value'], + 'sticky' => $entity->sticky, + 'created' => $entity->created, + 'comment_count' => 0, + 'last_comment_timestamp' => $entity->created, + )); + } + } + $query->execute(); + // The logic for determining last_comment_count is fairly complex, so + // call _forum_update_forum_index() too. + _forum_update_forum_index($entity->nid); + } + } +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_storage_purge.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_storage_purge.twig new file mode 100644 index 00000000..4d9d0158 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_storage_purge.twig @@ -0,0 +1,17 @@ +/** + * Implements hook_field_storage_purge(). + */ +function {{ machine_name }}_field_storage_purge($entity_type, $entity, $field, $instance) { + list($id, $vid, $bundle) = entity_extract_ids($entity_type, $entity); + + $table_name = _field_sql_storage_tablename($field); + $revision_name = _field_sql_storage_revision_tablename($field); + db_delete($table_name) + ->condition('entity_type', $entity_type) + ->condition('entity_id', $id) + ->execute(); + db_delete($revision_name) + ->condition('entity_type', $entity_type) + ->condition('entity_id', $id) + ->execute(); +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_storage_purge_field.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_storage_purge_field.twig new file mode 100644 index 00000000..be79851b --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_storage_purge_field.twig @@ -0,0 +1,9 @@ +/** + * Implements hook_field_storage_purge_field(). + */ +function {{ machine_name }}_field_storage_purge_field($field) { + $table_name = _field_sql_storage_tablename($field); + $revision_name = _field_sql_storage_revision_tablename($field); + db_drop_table($table_name); + db_drop_table($revision_name); +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_storage_purge_field_instance.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_storage_purge_field_instance.twig new file mode 100644 index 00000000..8cbb3553 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_storage_purge_field_instance.twig @@ -0,0 +1,8 @@ +/** + * Implements hook_field_storage_purge_field_instance(). + */ +function {{ machine_name }}_field_storage_purge_field_instance($instance) { + db_delete('my_module_field_instance_info') + ->condition('id', $instance['id']) + ->execute(); +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_storage_query.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_storage_query.twig new file mode 100644 index 00000000..7d7febc6 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_storage_query.twig @@ -0,0 +1,103 @@ +/** + * Implements hook_field_storage_query(). + */ +function {{ machine_name }}_field_storage_query($query) { + $groups = array(); + if ($query->age == FIELD_LOAD_CURRENT) { + $tablename_function = '_field_sql_storage_tablename'; + $id_key = 'entity_id'; + } + else { + $tablename_function = '_field_sql_storage_revision_tablename'; + $id_key = 'revision_id'; + } + $table_aliases = array(); + // Add tables for the fields used. + foreach ($query->fields as $key => $field) { + $tablename = $tablename_function($field); + // Every field needs a new table. + $table_alias = $tablename . $key; + $table_aliases[$key] = $table_alias; + if ($key) { + $select_query->join($tablename, $table_alias, "$table_alias.entity_type = $field_base_table.entity_type AND $table_alias.$id_key = $field_base_table.$id_key"); + } + else { + $select_query = db_select($tablename, $table_alias); + $select_query->addTag('entity_field_access'); + $select_query->addMetaData('base_table', $tablename); + $select_query->fields($table_alias, array('entity_type', 'entity_id', 'revision_id', 'bundle')); + $field_base_table = $table_alias; + } + if ($field['cardinality'] != 1) { + $select_query->distinct(); + } + } + + // Add field conditions. + foreach ($query->fieldConditions as $key => $condition) { + $table_alias = $table_aliases[$key]; + $field = $condition['field']; + // Add the specified condition. + $sql_field = "$table_alias." . _field_sql_storage_columnname($field['field_name'], $condition['column']); + $query->addCondition($select_query, $sql_field, $condition); + // Add delta / language group conditions. + foreach (array('delta', 'language') as $column) { + if (isset($condition[$column . '_group'])) { + $group_name = $condition[$column . '_group']; + if (!isset($groups[$column][$group_name])) { + $groups[$column][$group_name] = $table_alias; + } + else { + $select_query->where("$table_alias.$column = " . $groups[$column][$group_name] . ".$column"); + } + } + } + } + + if (isset($query->deleted)) { + $select_query->condition("$field_base_table.deleted", (int) $query->deleted); + } + + // Is there a need to sort the query by property? + $has_property_order = FALSE; + foreach ($query->order as $order) { + if ($order['type'] == 'property') { + $has_property_order = TRUE; + } + } + + if ($query->propertyConditions || $has_property_order) { + if (empty($query->entityConditions['entity_type']['value'])) { + throw new EntityFieldQueryException('Property conditions and orders must have an entity type defined.'); + } + $entity_type = $query->entityConditions['entity_type']['value']; + $entity_base_table = _field_sql_storage_query_join_entity($select_query, $entity_type, $field_base_table); + $query->entityConditions['entity_type']['operator'] = '='; + foreach ($query->propertyConditions as $property_condition) { + $query->addCondition($select_query, "$entity_base_table." . $property_condition['column'], $property_condition); + } + } + foreach ($query->entityConditions as $key => $condition) { + $query->addCondition($select_query, "$field_base_table.$key", $condition); + } + + // Order the query. + foreach ($query->order as $order) { + if ($order['type'] == 'entity') { + $key = $order['specifier']; + $select_query->orderBy("$field_base_table.$key", $order['direction']); + } + elseif ($order['type'] == 'field') { + $specifier = $order['specifier']; + $field = $specifier['field']; + $table_alias = $table_aliases[$specifier['index']]; + $sql_field = "$table_alias." . _field_sql_storage_columnname($field['field_name'], $specifier['column']); + $select_query->orderBy($sql_field, $order['direction']); + } + elseif ($order['type'] == 'property') { + $select_query->orderBy("$entity_base_table." . $order['specifier'], $order['direction']); + } + } + + return $query->finishQuery($select_query, $id_key); +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_storage_update_field.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_storage_update_field.twig new file mode 100644 index 00000000..97ce7744 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_storage_update_field.twig @@ -0,0 +1,22 @@ +/** + * Implements hook_field_storage_update_field(). + */ +function {{ machine_name }}_field_storage_update_field($field, $prior_field, $has_data) { + if (!$has_data) { + // There is no data. Re-create the tables completely. + $prior_schema = _field_sql_storage_schema($prior_field); + foreach ($prior_schema as $name => $table) { + db_drop_table($name, $table); + } + $schema = _field_sql_storage_schema($field); + foreach ($schema as $name => $table) { + db_create_table($name, $table); + } + } + else { + // There is data. See field_sql_storage_field_storage_update_field() for + // an example of what to do to modify the schema in place, preserving the + // old data as much as possible. + } + drupal_get_schema(NULL, TRUE); +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_storage_write.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_storage_write.twig new file mode 100644 index 00000000..adab9fcc --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_storage_write.twig @@ -0,0 +1,82 @@ +/** + * Implements hook_field_storage_write(). + */ +function {{ machine_name }}_field_storage_write($entity_type, $entity, $op, $fields) { + list($id, $vid, $bundle) = entity_extract_ids($entity_type, $entity); + if (!isset($vid)) { + $vid = $id; + } + + foreach ($fields as $field_id) { + $field = field_info_field_by_id($field_id); + $field_name = $field['field_name']; + $table_name = _field_sql_storage_tablename($field); + $revision_name = _field_sql_storage_revision_tablename($field); + + $all_languages = field_available_languages($entity_type, $field); + $field_languages = array_intersect($all_languages, array_keys((array) $entity->$field_name)); + + // Delete and insert, rather than update, in case a value was added. + if ($op == FIELD_STORAGE_UPDATE) { + // Delete languages present in the incoming $entity->$field_name. + // Delete all languages if $entity->$field_name is empty. + $languages = !empty($entity->$field_name) ? $field_languages : $all_languages; + if ($languages) { + db_delete($table_name) + ->condition('entity_type', $entity_type) + ->condition('entity_id', $id) + ->condition('language', $languages, 'IN') + ->execute(); + db_delete($revision_name) + ->condition('entity_type', $entity_type) + ->condition('entity_id', $id) + ->condition('revision_id', $vid) + ->condition('language', $languages, 'IN') + ->execute(); + } + } + + // Prepare the multi-insert query. + $do_insert = FALSE; + $columns = array('entity_type', 'entity_id', 'revision_id', 'bundle', 'delta', 'language'); + foreach ($field['columns'] as $column => $attributes) { + $columns[] = _field_sql_storage_columnname($field_name, $column); + } + $query = db_insert($table_name)->fields($columns); + $revision_query = db_insert($revision_name)->fields($columns); + + foreach ($field_languages as $langcode) { + $items = (array) $entity->{$field_name}[$langcode]; + $delta_count = 0; + foreach ($items as $delta => $item) { + // We now know we have something to insert. + $do_insert = TRUE; + $record = array( + 'entity_type' => $entity_type, + 'entity_id' => $id, + 'revision_id' => $vid, + 'bundle' => $bundle, + 'delta' => $delta, + 'language' => $langcode, + ); + foreach ($field['columns'] as $column => $attributes) { + $record[_field_sql_storage_columnname($field_name, $column)] = isset($item[$column]) ? $item[$column] : NULL; + } + $query->values($record); + if (isset($vid)) { + $revision_query->values($record); + } + + if ($field['cardinality'] != FIELD_CARDINALITY_UNLIMITED && ++$delta_count == $field['cardinality']) { + break; + } + } + } + + // Execute the query if we have values to insert. + if ($do_insert) { + $query->execute(); + $revision_query->execute(); + } + } +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_update.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_update.twig new file mode 100644 index 00000000..79acf7c8 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_update.twig @@ -0,0 +1,29 @@ +/** + * Implements hook_field_update(). + */ +function {{ machine_name }}_field_update($entity_type, $entity, $field, $instance, $langcode, &$items) { + if (variable_get('taxonomy_maintain_index_table', TRUE) && $field['storage']['type'] == 'field_sql_storage' && $entity_type == 'node') { + $first_call = &drupal_static(__FUNCTION__, array()); + + // We don't maintain data for old revisions, so clear all previous values + // from the table. Since this hook runs once per field, per object, make + // sure we only wipe values once. + if (!isset($first_call[$entity->nid])) { + $first_call[$entity->nid] = FALSE; + db_delete('taxonomy_index')->condition('nid', $entity->nid)->execute(); + } + // Only save data to the table if the node is published. + if ($entity->status) { + $query = db_insert('taxonomy_index')->fields(array('nid', 'tid', 'sticky', 'created')); + foreach ($items as $item) { + $query->values(array( + 'nid' => $entity->nid, + 'tid' => $item['tid'], + 'sticky' => $entity->sticky, + 'created' => $entity->created, + )); + } + $query->execute(); + } + } +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_update_field.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_update_field.twig new file mode 100644 index 00000000..1fdc7f93 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_update_field.twig @@ -0,0 +1,7 @@ +/** + * Implements hook_field_update_field(). + */ +function {{ machine_name }}_field_update_field($field, $prior_field, $has_data) { + // Reset the static value that keeps track of allowed values for list fields. + drupal_static_reset('list_allowed_values'); +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_update_forbid.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_update_forbid.twig new file mode 100644 index 00000000..dd1e03eb --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_update_forbid.twig @@ -0,0 +1,22 @@ +/** + * Implements hook_field_update_forbid(). + */ +function {{ machine_name }}_field_update_forbid($field, $prior_field, $has_data) { + // A 'list' field stores integer keys mapped to display values. If + // the new field will have fewer values, and any data exists for the + // abandoned keys, the field will have no way to display them. So, + // forbid such an update. + if ($has_data && count($field['settings']['allowed_values']) < count($prior_field['settings']['allowed_values'])) { + // Identify the keys that will be lost. + $lost_keys = array_diff(array_keys($field['settings']['allowed_values']), array_keys($prior_field['settings']['allowed_values'])); + // If any data exist for those keys, forbid the update. + $query = new EntityFieldQuery(); + $found = $query + ->fieldCondition($prior_field['field_name'], 'value', $lost_keys) + ->range(0, 1) + ->execute(); + if ($found) { + throw new FieldUpdateForbiddenException("Cannot update a list field not to include keys with existing data"); + } + } +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_update_instance.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_update_instance.twig new file mode 100644 index 00000000..e0208bbf --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_update_instance.twig @@ -0,0 +1,6 @@ +/** + * Implements hook_field_update_instance(). + */ +function {{ machine_name }}_field_update_instance($instance, $prior_instance) { + // @todo Needs function body. +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_validate.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_validate.twig new file mode 100644 index 00000000..45864cbc --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_validate.twig @@ -0,0 +1,15 @@ +/** + * Implements hook_field_validate(). + */ +function {{ machine_name }}_field_validate($entity_type, $entity, $field, $instance, $langcode, $items, &$errors) { + foreach ($items as $delta => $item) { + if (!empty($item['value'])) { + if (!empty($field['settings']['max_length']) && drupal_strlen($item['value']) > $field['settings']['max_length']) { + $errors[$field['field_name']][$langcode][$delta][] = array( + 'error' => 'text_max_length', + 'message' => t('%name: the value may not be longer than %max characters.', array('%name' => $instance['label'], '%max' => $field['settings']['max_length'])), + ); + } + } + } +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_widget_WIDGET_TYPE_form_alter.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_widget_WIDGET_TYPE_form_alter.twig new file mode 100644 index 00000000..366ed69e --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_widget_WIDGET_TYPE_form_alter.twig @@ -0,0 +1,9 @@ +/** + * Implements hook_field_widget_WIDGET_TYPE_form_alter(). + */ +function {{ machine_name }}_field_widget_WIDGET_TYPE_form_alter(&$element, &$form_state, $context) { + // Code here will only act on widgets of type WIDGET_TYPE. For example, + // hook_field_widget_mymodule_autocomplete_form_alter() will only act on + // widgets of type 'mymodule_autocomplete'. + $element['#autocomplete_path'] = 'mymodule/autocomplete_path'; +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_widget_error.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_widget_error.twig new file mode 100644 index 00000000..2c6100b0 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_widget_error.twig @@ -0,0 +1,6 @@ +/** + * Implements hook_field_widget_error(). + */ +function {{ machine_name }}_field_widget_error($element, $error, $form, &$form_state) { + form_error($element, $error['message']); +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_widget_form.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_widget_form.twig new file mode 100644 index 00000000..c6fcf5c1 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_widget_form.twig @@ -0,0 +1,10 @@ +/** + * Implements hook_field_widget_form(). + */ +function {{ machine_name }}_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element) { + $element += array( + '#type' => $instance['widget']['type'], + '#default_value' => isset($items[$delta]) ? $items[$delta] : '', + ); + return array('value' => $element); +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_widget_form_alter.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_widget_form_alter.twig new file mode 100644 index 00000000..03f04be1 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_widget_form_alter.twig @@ -0,0 +1,10 @@ +/** + * Implements hook_field_widget_form_alter(). + */ +function {{ machine_name }}_field_widget_form_alter(&$element, &$form_state, $context) { + // Add a css class to widget form elements for all fields of type mytype. + if ($context['field']['type'] == 'mytype') { + // Be sure not to overwrite existing attributes. + $element['#attributes']['class'][] = 'myclass'; + } +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_widget_info.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_widget_info.twig new file mode 100644 index 00000000..a72061c5 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_widget_info.twig @@ -0,0 +1,36 @@ +/** + * Implements hook_field_widget_info(). + */ +function {{ machine_name }}_field_widget_info() { + return array( + 'text_textfield' => array( + 'label' => t('Text field'), + 'field types' => array('text'), + 'settings' => array('size' => 60), + 'behaviors' => array( + 'multiple values' => FIELD_BEHAVIOR_DEFAULT, + 'default value' => FIELD_BEHAVIOR_DEFAULT, + ), + ), + 'text_textarea' => array( + 'label' => t('Text area (multiple rows)'), + 'field types' => array('text_long'), + 'settings' => array('rows' => 5), + 'behaviors' => array( + 'multiple values' => FIELD_BEHAVIOR_DEFAULT, + 'default value' => FIELD_BEHAVIOR_DEFAULT, + ), + ), + 'text_textarea_with_summary' => array( + 'label' => t('Text area with a summary'), + 'field types' => array('text_with_summary'), + 'settings' => array('rows' => 20, 'summary_rows' => 5), + 'behaviors' => array( + 'multiple values' => FIELD_BEHAVIOR_DEFAULT, + 'default value' => FIELD_BEHAVIOR_DEFAULT, + ), + // As an advanced widget, force it to sink to the bottom of the choices. + 'weight' => 2, + ), + ); +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_widget_info_alter.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_widget_info_alter.twig new file mode 100644 index 00000000..8d2f5c20 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_widget_info_alter.twig @@ -0,0 +1,12 @@ +/** + * Implements hook_field_widget_info_alter(). + */ +function {{ machine_name }}_field_widget_info_alter(&$info) { + // Add a setting to a widget type. + $info['text_textfield']['settings'] += array( + 'mymodule_additional_setting' => 'default value', + ); + + // Let a new field type re-use an existing widget. + $info['options_select']['field types'][] = 'my_field_type'; +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_widget_properties_ENTITY_TYPE_alter.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_widget_properties_ENTITY_TYPE_alter.twig new file mode 100644 index 00000000..b141b6a2 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_widget_properties_ENTITY_TYPE_alter.twig @@ -0,0 +1,11 @@ +/** + * Implements hook_field_widget_properties_ENTITY_TYPE_alter(). + */ +function {{ machine_name }}_field_widget_properties_ENTITY_TYPE_alter(&$widget, $context) { + // Change a widget's type according to the time of day. + $field = $context['field']; + if ($field['field_name'] == 'field_foo') { + $time = date('H'); + $widget['type'] = $time < 12 ? 'widget_am' : 'widget_pm'; + } +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_widget_properties_alter.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_widget_properties_alter.twig new file mode 100644 index 00000000..8e4f42a6 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_widget_properties_alter.twig @@ -0,0 +1,11 @@ +/** + * Implements hook_field_widget_properties_alter(). + */ +function {{ machine_name }}_field_widget_properties_alter(&$widget, $context) { + // Change a widget's type according to the time of day. + $field = $context['field']; + if ($context['entity_type'] == 'node' && $field['field_name'] == 'field_foo') { + $time = date('H'); + $widget['type'] = $time < 12 ? 'widget_am' : 'widget_pm'; + } +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_widget_settings_form.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_widget_settings_form.twig new file mode 100644 index 00000000..c398ccb1 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_widget_settings_form.twig @@ -0,0 +1,28 @@ +/** + * Implements hook_field_widget_settings_form(). + */ +function {{ machine_name }}_field_widget_settings_form($field, $instance) { + $widget = $instance['widget']; + $settings = $widget['settings']; + + if ($widget['type'] == 'text_textfield') { + $form['size'] = array( + '#type' => 'textfield', + '#title' => t('Size of textfield'), + '#default_value' => $settings['size'], + '#element_validate' => array('element_validate_integer_positive'), + '#required' => TRUE, + ); + } + else { + $form['rows'] = array( + '#type' => 'textfield', + '#title' => t('Rows'), + '#default_value' => $settings['rows'], + '#element_validate' => array('element_validate_integer_positive'), + '#required' => TRUE, + ); + } + + return $form; +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/file_copy.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/file_copy.twig new file mode 100644 index 00000000..d7ecc192 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/file_copy.twig @@ -0,0 +1,13 @@ +/** + * Implements hook_file_copy(). + */ +function {{ machine_name }}_file_copy($file, $source) { + $file_user = user_load($file->uid); + // Make sure that the file name starts with the owner's user name. + if (strpos($file->filename, $file_user->name) !== 0) { + $file->filename = $file_user->name . '_' . $file->filename; + $file->save(); + + watchdog('file', t('Copied file %source has been renamed to %destination', array('%source' => $source->filename, '%destination' => $file->filename))); + } +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/file_delete.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/file_delete.twig new file mode 100644 index 00000000..76b55890 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/file_delete.twig @@ -0,0 +1,7 @@ +/** + * Implements hook_file_delete(). + */ +function {{ machine_name }}_file_delete($file) { + // Delete all information associated with the file. + db_delete('upload')->condition('fid', $file->fid)->execute(); +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/file_download.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/file_download.twig new file mode 100644 index 00000000..fd145381 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/file_download.twig @@ -0,0 +1,19 @@ +/** + * Implements hook_file_download(). + */ +function {{ machine_name }}_file_download($uri) { + // Check if the file is controlled by the current module. + if (!file_prepare_directory($uri)) { + $uri = FALSE; + } + if (strpos(file_uri_target($uri), variable_get('user_picture_path', 'pictures') . '/picture-') === 0) { + if (!user_access('access user profiles')) { + // Access to the file is denied. + return -1; + } + else { + $info = image_get_info($uri); + return array('Content-Type' => $info['mime_type']); + } + } +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/file_download_access.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/file_download_access.twig new file mode 100644 index 00000000..0648ab51 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/file_download_access.twig @@ -0,0 +1,8 @@ +/** + * Implements hook_file_download_access(). + */ +function {{ machine_name }}_file_download_access($file_item, $entity_type, $entity) { + if ($entity_type == 'node') { + return node_access('view', $entity); + } +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/file_download_access_alter.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/file_download_access_alter.twig new file mode 100644 index 00000000..7a619985 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/file_download_access_alter.twig @@ -0,0 +1,9 @@ +/** + * Implements hook_file_download_access_alter(). + */ +function {{ machine_name }}_file_download_access_alter(&$grants, $file_item, $entity_type, $entity) { + // For our example module, we always enforce the rules set by node module. + if (isset($grants['node'])) { + $grants = array('node' => $grants['node']); + } +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/file_insert.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/file_insert.twig new file mode 100644 index 00000000..da167b19 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/file_insert.twig @@ -0,0 +1,10 @@ +/** + * Implements hook_file_insert(). + */ +function {{ machine_name }}_file_insert($file) { + // Add a message to the log, if the file is a jpg + $validate = file_validate_extensions($file, 'jpg'); + if (empty($validate)) { + watchdog('file', 'A jpg has been added.'); + } +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/file_load.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/file_load.twig new file mode 100644 index 00000000..8ba6da0e --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/file_load.twig @@ -0,0 +1,12 @@ +/** + * Implements hook_file_load(). + */ +function {{ machine_name }}_file_load($files) { + // Add the upload specific data into the file object. + $result = db_query('SELECT * FROM {upload} u WHERE u.fid IN (:fids)', array(':fids' => array_keys($files)))->fetchAll(PDO::FETCH_ASSOC); + foreach ($result as $record) { + foreach ($record as $key => $value) { + $files[$record['fid']]->$key = $value; + } + } +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/file_mimetype_mapping_alter.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/file_mimetype_mapping_alter.twig new file mode 100644 index 00000000..af72a39a --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/file_mimetype_mapping_alter.twig @@ -0,0 +1,11 @@ +/** + * Implements hook_file_mimetype_mapping_alter(). + */ +function {{ machine_name }}_file_mimetype_mapping_alter(&$mapping) { + // Add new MIME type 'drupal/info'. + $mapping['mimetypes']['example_info'] = 'drupal/info'; + // Add new extension '.info' and map it to the 'drupal/info' MIME type. + $mapping['extensions']['info'] = 'example_info'; + // Override existing extension mapping for '.ogg' files. + $mapping['extensions']['ogg'] = 189; +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/file_move.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/file_move.twig new file mode 100644 index 00000000..2f13cb8f --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/file_move.twig @@ -0,0 +1,13 @@ +/** + * Implements hook_file_move(). + */ +function {{ machine_name }}_file_move($file, $source) { + $file_user = user_load($file->uid); + // Make sure that the file name starts with the owner's user name. + if (strpos($file->filename, $file_user->name) !== 0) { + $file->filename = $file_user->name . '_' . $file->filename; + $file->save(); + + watchdog('file', t('Moved file %source has been renamed to %destination', array('%source' => $source->filename, '%destination' => $file->filename))); + } +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/file_presave.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/file_presave.twig new file mode 100644 index 00000000..bee1b0c9 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/file_presave.twig @@ -0,0 +1,7 @@ +/** + * Implements hook_file_presave(). + */ +function {{ machine_name }}_file_presave($file) { + // Change the file timestamp to an hour prior. + $file->timestamp -= 3600; +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/file_update.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/file_update.twig new file mode 100644 index 00000000..b8064d13 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/file_update.twig @@ -0,0 +1,14 @@ +/** + * Implements hook_file_update(). + */ +function {{ machine_name }}_file_update($file) { + $file_user = user_load($file->uid); + // Make sure that the file name starts with the owner's user name. + if (strpos($file->filename, $file_user->name) !== 0) { + $old_filename = $file->filename; + $file->filename = $file_user->name . '_' . $file->filename; + $file->save(); + + watchdog('file', t('%source has been renamed to %destination', array('%source' => $old_filename, '%destination' => $file->filename))); + } +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/file_url_alter.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/file_url_alter.twig new file mode 100644 index 00000000..05dc7176 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/file_url_alter.twig @@ -0,0 +1,47 @@ +/** + * Implements hook_file_url_alter(). + */ +function {{ machine_name }}_file_url_alter(&$uri) { + global $user; + + // User 1 will always see the local file in this example. + if ($user->uid == 1) { + return; + } + + $cdn1 = 'http://cdn1.example.com'; + $cdn2 = 'http://cdn2.example.com'; + $cdn_extensions = array('css', 'js', 'gif', 'jpg', 'jpeg', 'png'); + + // Most CDNs don't support private file transfers without a lot of hassle, + // so don't support this in the common case. + $schemes = array('public'); + + $scheme = file_uri_scheme($uri); + + // Only serve shipped files and public created files from the CDN. + if (!$scheme || in_array($scheme, $schemes)) { + // Shipped files. + if (!$scheme) { + $path = $uri; + } + // Public created files. + else { + $wrapper = file_stream_wrapper_get_instance_by_scheme($scheme); + $path = $wrapper->getDirectoryPath() . '/' . file_uri_target($uri); + } + + // Clean up Windows paths. + $path = str_replace('\\', '/', $path); + + // Serve files with one of the CDN extensions from CDN 1, all others from + // CDN 2. + $pathinfo = pathinfo($path); + if (isset($pathinfo['extension']) && in_array($pathinfo['extension'], $cdn_extensions)) { + $uri = $cdn1 . '/' . $path; + } + else { + $uri = $cdn2 . '/' . $path; + } + } +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/file_validate.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/file_validate.twig new file mode 100644 index 00000000..9023d789 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/file_validate.twig @@ -0,0 +1,15 @@ +/** + * Implements hook_file_validate(). + */ +function {{ machine_name }}_file_validate($file) { + $errors = array(); + + if (empty($file->filename)) { + $errors[] = t("The file's name is empty. Please give a name to the file."); + } + if (strlen($file->filename) > 255) { + $errors[] = t("The file's name exceeds the 255 characters limit. Please rename the file and try again."); + } + + return $errors; +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/filetransfer_info.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/filetransfer_info.twig new file mode 100644 index 00000000..60dace2e --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/filetransfer_info.twig @@ -0,0 +1,12 @@ +/** + * Implements hook_filetransfer_info(). + */ +function {{ machine_name }}_filetransfer_info() { + $info['sftp'] = array( + 'title' => t('SFTP (Secure FTP)'), + 'file' => 'sftp.filetransfer.inc', + 'class' => 'FileTransferSFTP', + 'weight' => 10, + ); + return $info; +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/filetransfer_info_alter.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/filetransfer_info_alter.twig new file mode 100644 index 00000000..abb026c9 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/filetransfer_info_alter.twig @@ -0,0 +1,11 @@ +/** + * Implements hook_filetransfer_info_alter(). + */ +function {{ machine_name }}_filetransfer_info_alter(&$filetransfer_info) { + if (variable_get('paranoia', FALSE)) { + // Remove the FTP option entirely. + unset($filetransfer_info['ftp']); + // Make sure the SSH option is listed first. + $filetransfer_info['ssh']['weight'] = -10; + } +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/filter_format_disable.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/filter_format_disable.twig new file mode 100644 index 00000000..94ad1e91 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/filter_format_disable.twig @@ -0,0 +1,6 @@ +/** + * Implements hook_filter_format_disable(). + */ +function {{ machine_name }}_filter_format_disable($format) { + mymodule_cache_rebuild(); +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/filter_format_insert.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/filter_format_insert.twig new file mode 100644 index 00000000..ba10a453 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/filter_format_insert.twig @@ -0,0 +1,6 @@ +/** + * Implements hook_filter_format_insert(). + */ +function {{ machine_name }}_filter_format_insert($format) { + mymodule_cache_rebuild(); +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/filter_format_update.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/filter_format_update.twig new file mode 100644 index 00000000..d7328937 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/filter_format_update.twig @@ -0,0 +1,6 @@ +/** + * Implements hook_filter_format_update(). + */ +function {{ machine_name }}_filter_format_update($format) { + mymodule_cache_rebuild(); +} diff --git a/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/filter_info.twig b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/filter_info.twig new file mode 100644 index 00000000..f17e6280 --- /dev/null +++ b/old.vendor/chi-teck/drupal-code-generator/templates/d7/hook/filter_info.twig @@ -0,0 +1,24 @@ +/** + * Implements hook_filter_info(). + */ +function {{ machine_name }}_filter_info() { + $filters['filter_html'] = array( + 'title' => t('Limit allowed HTML tags'), + 'description' => t('Allows you to restrict the HTML tags the user can use. It will also remove harmful content such as JavaScript events, JavaScript URLs and CSS styles from those tags that are not removed.'), + 'process callback' => '_filter_html', + 'settings callback' => '_filter_html_settings', + 'default settings' => array( + 'allowed_html' => '